A simple snippet showing how to turn on Annotations in Spring Configuration file
Annotations came into picture with JDK 1.5 to make life of a developer easier. Annotations are meta-data which provides additional information about something. It is applied to various variables , methods , classes , constructors and other declarations. Spring provides annotations as an alternative way over xml based configuration.
Annotations are turned off by-default by Spring Framework. In order to turn it on we have to provide a entry in Spring Configuration file. Using tag context:annotation-config from Spring's context namespace makes it turn on. Annotation makes development easier and faster. It also takes addition of information closer to source code. Annotation injection is done prior to xml based injection by Spring Framework.
After the annotations in Spring file is turned on, Spring automatically wires many components such as properties , constructors and various stuff to a value.
Annotations came into picture with JDK 1.5 to make life of a developer easier. Annotations are meta-data which provides additional information about something. It is applied to various variables , methods , classes , constructors and other declarations. Spring provides annotations as an alternative way over xml based configuration.
Annotations are turned off by-default by Spring Framework. In order to turn it on we have to provide a entry in Spring Configuration file. Using tag context:annotation-config from Spring's context namespace makes it turn on. Annotation makes development easier and faster. It also takes addition of information closer to source code. Annotation injection is done prior to xml based injection by Spring Framework.
|
After the annotations in Spring file is turned on, Spring automatically wires many components such as properties , constructors and various stuff to a value.