All Downloads are FREE. Search and download functionalities are using the official Maven repository.

js.annotation.Inject Maven / Gradle / Ivy

Go to download

Web Tiny Container is a service oriented Servlet extension that allows for reflexive Java methods invocation via HTTP.

There is a newer version: 1.3.0
Show newest version
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 { }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy