js.annotation.Inject Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tiny-container Show documentation
Show all versions of tiny-container Show documentation
Web Tiny Container is a service oriented Servlet extension that allows for reflexive Java methods invocation via HTTP.
package js.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Managed instance field value injection. This annotation takes effect only when applied to managed classes fields; on other
* contexts is simply ignored. Usually target fields are of managed class type but plain Java objects are supported, of course
* if instantiable with no argument. Field access modifier is not relevant but is not allowed to use this annotation on final or
* static fields.
*
* As result from sample code below injection annotation does not have any parameters.
*
*
* class DaoImpl implements Dao {
* @Inject
* private SessionManager sm;
* ...
* }
*
*
* Field injection is in contrast with constructor injection that can be enacted by simple declaring constructor with fields to
* inject. Above fields injection can be rewritten as sample below.
*
*
* class DaoImpl implements Dao {
* private final SessionManager sm;
* ...
* public DaoImpl(SesionManager sm) {
* this.sm = sm;
* }
* }
*
*
* @author Iulian Rotaru
* @version final
*/
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface Inject {
}