Feb 16 2009
Spring annotations based config
Application context
In your web/WEB-INF folder, create a new applicationContext.xml file. That file will contain the Spring configuration.
XML:
-
<xml version="1.0" encoding="UTF-8"/>
-
<beans xmlns="http://www.springframework.org/schema/beans"
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-
xmlns:context="http://www.springframework.org/schema/context"
-
xsi:schemaLocation="http://www.springframework.org/schema/beans
-
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
-
http://www.springframework.org/schema/context
-
http://www.springframework.org/schema/context/spring-context-2.5.xsd">
-
-
<!-- Let us use annotation driven beans -->
-
<context:annotation-config/>
-
-
<!-- Classpath components scanning -->
-
<context:component-scan base-package="PACKAGE_TO_BE_SCANNED"/>
-
-
</beans>
- The <context:annotation-config /> element is used to automatically register all of Spring's standard post-processors for annotation-based configuration.
- The <context:component-scan annotation> element is used to enable autodetection of the stereotyped classes in the scanned package.


