OSDN Git Service

DAO化の初期フェーズ
[rabbit-bts/RabbitBTS.git] / war / WEB-INF / rabbitBTS-servlet.xml
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" xmlns:context="http://www.springframework.org/schema/context"
4         xmlns:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop"
5
6         xsi:schemaLocation="http://www.springframework.org/schema/beans
7            http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
8            http://www.springframework.org/schema/context
9            http://www.springframework.org/schema/context/spring-context-2.5.xsd
10            http://www.springframework.org/schema/aop
11            http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
12            ">
13         <!-- aspect -->
14         <!--
15                 <aop:aspectj-autoproxy /> <bean
16                 class="org.springframework.aop.aspectj.annotation.AnnotationAwareAspectJAutoProxyCreator"
17                 /> <bean class="jp.sourceforge.rabbitBTS.TestAspect" />
18         -->
19
20         <!-- validator -->
21         <bean id="configurationLoader"
22                 class="org.springmodules.validation.bean.conf.loader.annotation.AnnotationBeanValidationConfigurationLoader" />
23         <bean id="validator" class="org.springmodules.validation.bean.BeanValidator"
24                 p:configurationLoader-ref="configurationLoader" />
25         <!-- Load messages -->
26         <bean id="messageSource"
27                 class="org.springframework.context.support.ReloadableResourceBundleMessageSource"
28                 p:basenames="WEB-INF/messages">
29                 <property name="cacheSeconds" value="1"></property>
30         </bean>
31
32         <!-- Controller etc. -->
33         <bean class="jp.sourceforge.rabbitBTS.interceptors.TraceInterceptor"
34                 id="tracer" />
35         <bean class="jp.sourceforge.rabbitBTS.interceptors.AuthenticationInterceptor"
36                 id="authInterceptor" />
37         <bean class="jp.sourceforge.rabbitBTS.interceptors.CSRFInterceptor"
38                 id="csrf" />
39         <bean
40                 class="org.springframework.orm.jdo.support.OpenPersistenceManagerInViewInterceptor"
41                 id="openInView">
42                 <property name="persistenceManagerFactory" ref="pmf"></property>
43         </bean>
44
45         <bean
46                 class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
47                 <property name="interceptors">
48                         <list>
49                                 <ref bean="tracer" />
50                                 <ref bean="openInView" />
51                                 <ref bean="authInterceptor" />
52                                 <ref bean="csrf" />
53                         </list>
54                 </property>
55         </bean>
56         <bean id="annotationMethodHandlerAdapter"
57                 class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
58                 <!-- spring bugs -->
59                 <property name="webBindingInitializer">
60                         <bean class="jp.sourceforge.rabbitBTS.SomeBindingInitializer" />
61                 </property>
62         </bean>
63
64         <!-- view -->
65         <!--
66                 <bean
67                 class="org.springframework.web.servlet.view.InternalResourceViewResolver">
68                 <property name="viewClass"
69                 value="org.springframework.web.servlet.view.JstlView" /> <property
70                 name="prefix" value="/WEB-INF/views/" /> <property name="suffix"
71                 value=".jsp" /> </bean>
72         -->
73
74         <bean id="freemarkerConfig"
75                 class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
76                 <property name="templateLoaderPath" value="/WEB-INF/views/" />
77                 <property name="freemarkerSettings">
78                         <props>
79                                 <prop key="default_encoding">utf-8</prop>
80                                 <prop key="url_escaping_charset">utf-8</prop>
81                         </props>
82                 </property>
83
84         </bean>
85         <bean id="viewResolver"
86                 class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver">
87                 <property name="cache" value="false" />
88                 <property name="prefix" value="" />
89                 <property name="suffix" value=".ftl" />
90                 <property name="requestContextAttribute" value="rc" />
91                 <property name="exposeSpringMacroHelpers" value="true" />
92                 <property name="contentType">
93                         <value>text/html; charset=utf-8</value>
94                 </property>
95         </bean>
96         <bean
97                 class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping">
98                 <property name="interceptors">
99                         <list>
100                                 <ref bean="tracer" />
101                                 <ref bean="openInView" />
102                                 <ref bean="authInterceptor" />
103                                 <ref bean="csrf" />
104                         </list>
105                 </property>
106         </bean>
107
108         <!--  trace log -->
109         <!--
110                 <bean id="dInterceptor"
111                 class="org.springframework.aop.interceptor.DebugInterceptor" /> <bean
112                 id="advisor"
113                 class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor">
114                 <property name="advice"> <ref bean="dInterceptor" /> </property>
115                 <property name="mappedName"> <value>index</value> </property> </bean>
116         -->
117
118         <!-- DAO -->
119         <bean id="pmf"
120                 class="org.springframework.orm.jdo.LocalPersistenceManagerFactoryBean">
121                 <property name="persistenceManagerFactoryName" value="transactions-optional" />
122         </bean>
123
124         <!-- TODO:こきたないハック -->
125         <bean class="jp.sourceforge.rabbitBTS.PMFSupport" />
126
127         <bean id="abstractDao" abstract="true">
128                 <property name="persistenceManagerFactory" ref="pmf"></property>
129         </bean>
130
131         <bean id="accountDao" parent="abstractDao"
132                 class="jp.sourceforge.rabbitBTS.dao.jdo.AccountDaoImpl">
133         </bean>
134
135         <bean id="bbsDao" parent="abstractDao"
136                 class="jp.sourceforge.rabbitBTS.dao.jdo.BbsDaoImpl">
137         </bean>
138
139         <!-- サービス -->
140         <bean class="jp.sourceforge.rabbitBTS.services.BbsService">
141         </bean>
142         <bean class="jp.sourceforge.rabbitBTS.services.AccountService">
143                 <property name="firstSuperUser" value="test@example.com" />
144         </bean>
145
146         <!-- アノテーションベースの設定 -->
147         <context:component-scan base-package="jp.sourceforge.rabbitBTS"
148                 use-default-filters="true" />
149
150 </beans>