привет всем,
есть веб приложение (spring + Tapestry + hibernate ), в нем
есть файл web.xml в котором я описываю класс загружающий контекст приложения [applicationСontext.xml ],
ВОПРОС : как получить указатель на него в данном случае ?
web.xml
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>Spring Countries</display-name>
<description>Spring Countries sample application</description>
<context-param>
<param-name>contextParam</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<filter>
<filter-name>redirect</filter-name>
<filter- class >org.apache.tapestry.RedirectFilter</filter- class >
</filter>
<filter-mapping>
<filter-name>redirect</filter-name>
<url-pattern>/</url-pattern>
</filter-mapping>
<listener>
<listener- class >org.springframework.web.context.ContextLoaderListener</listener- class >
</listener>
<servlet>
<servlet-name>countries</servlet-name>
<servlet- class >org.apache.tapestry.ApplicationServlet</servlet- class >
<load-on-startup> 1 </load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>countries</servlet-name>
<url-pattern>/app</url-pattern>
</servlet-mapping>
</web-app>
applicationContext.xml
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="dataSource" class ="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName"><value>org.firebirdsql.jdbc.FBDriver</value></property>
<property name="url"><value>jdbc:firebirdsql:localhost:c:/temp/enetdatabase.fdb</value></property>
<property name="username"><value>SYSDBA</value></property>
<property name="password"><value>masterkey</value></property>
</bean>
<bean id="sessionFactory" class ="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource"><ref local="dataSource"/></property>
<property name="mappingResources">
<list>
<value>resource/User.hbm.xml</value>
<value>resource/Answer.hbm.xml</value>
<value>resource/Voiting.hbm.xml</value>
<value>resource/VariantOfAnswer.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.FirebirdDialect</prop>
<prop key="hibernate.hbm2ddl.auto">create</prop>
</props>
</property>
</bean>
<bean id="transactionManager" class ="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory"><ref local="sessionFactory"/></property>
</bean>
<bean id="transactionAttributes"
class ="org.springframework.transaction.interceptor.NameMatchTransactionAttributeSource">
<property name="properties">
<props>
<prop key="save*">PROPAGATION_REQUIRED</prop>
<prop key="delete*">PROPAGATION_REQUIRED</prop>
<prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
</props>
</property>
</bean>
<bean id="nameMatchTxInterceptor" class ="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager"><ref bean="transactionManager"/></property>
<property name="transactionAttributeSource"><ref bean="transactionAttributes"/></property>
</bean>
<!-- Add DAO Object here -->
<bean id="userDAO" class ="com.enetcyberserver.dao.impl.UserDAOImpl">
<property name="sessionFactory"><ref local="sessionFactory"/></property>
</bean>
<bean id="answerDAO" class ="com.enetcyberserver.dao.impl.AnswerDAOImpl">
<property name="sessionFactory"><ref local="sessionFactory"/></property>
</bean>
<bean id="variantOfAnswer" class ="com.enetcyberserver.dao.impl.VariantOfAnswerImpl">
<property name="sessionFactory"><ref local="sessionFactory"/></property>
</bean>
<bean id="voiting" class ="com.enetcyberserver.dao.impl.VotingDAOImpl">
<property name="sessionFactory"><ref local="sessionFactory"/></property>
</bean>
<!-- Add Managers here -->
<bean id="userManager" class ="com.enetcyberserver.services.impl.UserManager">
<property name="userDAO">
<ref local="userDAO"/>
</property>
</bean>
</beans>