e3bc2a5dc1f08eec3a4f76fa19e3b157a656aef6
[JavaForFun] /
1 <?xml version="1.0" encoding="UTF-8"?>
2 <beans xmlns="http://www.springframework.org/schema/beans"
3        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4        xmlns:context="http://www.springframework.org/schema/context" 
5        xsi:schemaLocation="http://www.springframework.org/schema/beans 
6                                                    http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
7                                                    http://www.springframework.org/schema/context 
8                                                    http://www.springframework.org/schema/context/spring-context-2.5.xsd">
9
10         <!--    This would be useful in case of not using a xml file for the beans declaration
11                 (we can use @Bean with @Configuration annotation instead of xml files) Not sure
12                 if this is useful in case of searching custom annotations. Apparently this code does not
13                 need it, so I will no use it.
14         <context:annotation-config/>
15         -->
16
17         <!-- 
18                      Spring makes the nasty work for us (it searches the annotations) 
19                 See: http://static.springsource.org/spring/docs/3.1.0.RC1/spring-framework-reference/html/beans.html#beans-annotation-config
20                  
21                      With filters we can narrow down the targets and hopefully improve the 
22                 performance while searching annotations in the Spring context. 
23                 Besides we disable automatic detection of classes annotated with 
24                 @Component, @Repository, @Service, or @Controller because we do not
25                 need here that feature.
26         -->
27     <context:component-scan base-package="de.spring.example" use-default-filters="false">
28         <context:include-filter 
29         type="annotation" 
30         expression="de.spring.example.annotation.CustomTransactional" />
31         </context:component-scan>
32
33
34         <!-- Our annotations handler -->        
35         <bean id="annotationsHandler" class="de.spring.example.AnnotationsHandler" >
36         
37         </bean>
38         
39     <!-- 
40                 In order to find annotations in inner classes we have to create Spring 
41         beans of them.
42     -->
43     <bean id="testOuter" class="de.spring.example.Test"/>
44     <bean id="testInner" class="de.spring.example.Test$InnerService">
45         <constructor-arg ref="testOuter"/>
46     </bean>
47
48 </beans>