The Talon Manual

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

@Configured ElementType 
propertyString, requiredThe configuration property name.
requiredboolean, optionalFlag indicating whether the property is required or not. Default: false
defaultValueString, optionalThe default value of the property. Default: "<null>"
descriptionString, optionalA description of the property. Default: "<null>"

@AppIntrospectionPoints

Any @Configured annotated field or method in the main application class will be discovered by the Talon XVM. If additional classes in your application contain configured fields or methods, they can be exposed to the server using the @AppIntrospectionPoints annotation or @AppConfiguredAccessor annotation. The AppIntrospectionPoints annotation exposes a collection of application objects to introspect for any type of annotation supported by Talon while the AppConfiguredAccessor exposes a set of objects that should only be introspected for @Configured annotations. One can use the more narrowly scoped AppConfiguredAccessor annotation for applications that have a large number of objects to reduce the number of objects that the XVM needs to scan. 

Example:

Code Block
java
java
    @AppHAPolicy(HAPolicy.EventSourcing)
    public static class MyApp {
        MyOtherClass someOtherClass = new MyOtherClass();

        @AppIntrospectionPoints 
        public void getApplicationObjects(Set<Object> object) {
            containers.add(someOtherClass );
        }
    }

    private static class MyOtherClass {
        @Configured(property = "simulator.ems.orderPreallocateCount", defaultValue = "1048576")
		private int orderPreallocateCount;
		MyOtherClass() {
        }
    }

@AppConfiguredAccessor

Any @Configured annotated field or method in the main application class will be discovered by the Talon server. If additional classes in your application contain configured fields or methods, they can be exposed to the server using the @AppConfiguredAccessor annotation.

...

 

 

Code Block
languagejava
import com.neeve.cli.annotations.Configured;
 
public voidclass MyApp() {

  @Configured(property = "simulator.ems.orderPreallocateCount", defaultValue = "1048576")
  private int orderPreallocateCount;
}

Setter Methods

When running in a Talon Server, it is possible to annotate @Configured setter methods:

Code Block
languagejava
import com.neeve.cli.annotations.Configured;
 
public voidclass MyApp() {
  private int orderPreallocateCount;

  @Configured(property = "simulator.ems.orderPreallocateCount", defaultValue = "1048576")
  void setOrderPreallocateCount(int orderPreallocateCount) {
	this.orderPreallocateCount = orderPreallocateCount;
  }
}

Limitations

In order to avoid potential race conditions with static fields and preserve the semantics of the "final" keyword, the @Configured annotation does not support injecting properties into fields that are declared static or final. In these cases, the framework will throw a CliException at initialization time.

...