XBean > Home > Features > Annotation based Dependency Injection > Other Annotations |
|
Optional AnnotationsIn addition to those defined in JSR 250, the following annotations MAY be handled by the container. @AsyncIndicates that a method call could actually be performed asynchronously in the background using a proxy of some kind to avoid blocking the calling thread. @SingletonAllow POJOs to be marked as being singletons so that an IoC container does not create multiple instances of them. @OptionalResourceUsed to mark a property or field as optional; but also allow indication of the name you'd like to use in JNDI to look it up if it is available. @NameAwareIn most containers; Spring, SCA, JNDI, EJB3 - there is typically a logical name of a POJO; so we should be able to mark a String setter as being @NameAware so that the name can be injected IdeasThe following are just ideas for future consideration @AutowireVarious things like JNDI contexts or MBeanServer and the like are often singletons for a given POJOs context. We could have annotations like @ContextAware and @ApplicationContextAware and @MBeanServerAware; but maybe we just need to mark things as being auto-wired by default by the container? This could be very useful to deal with
@FactoryUsed to indicate that a POJO is really a factory bean in the Spring sense; the @Factory annotation is applied to a public method on the POJO indicating that the factory method should be called to actually create the object. |