我正在使用与jersey 2.x集成的传统spring 2.0.6项目。
应用程序上下文包含一些bean:
<!-- - Application context definition -->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd">
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="propertiesArray">
<list>
<bean factory-bean="propertiesHolder" factory-method="asProperties" />
</list>
</property>
</bean>
<bean name="propertiesHolder"
class="com.my.TenantPropertiesHolder" scope="request">
<aop:scoped-proxy/>
</bean>
<!-- LDAP Repository -->
<bean id="LDAP" class="com.my.LdapRepository">
<property name="name" value="${LDAP.name}" />
<property name="providerUrl" value="${LDAP.providerUrl}" />
<property name="baseQuery" value="${LDAP.baseQuery}" />
<property name="userCommonName" value="${LDAP.userCommonName}" />
<property name="userPassword" value="${LDAP.userPassword}" />
</bean>
在web.xml中我有:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:klas-auth-Context.xml
</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.request.RequestContextListener </listener-class>
</listener>
<servlet>
<servlet-name>Secured REST Service</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>com.my</param-value>
</init-param>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>com.my.core.auth.injection.JAXRSConfig</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
我怎样才能让它发挥作用? 如何在没有spring web context loader侦听器的情况下恢复ldap bean?
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
来自我的休息服务?
使用上下文加载器侦听器这是我的服务代码:
private static ApplicationContext appContext;
@PostConstruct
public void init() {
appContext = WebApplicationContextUtils.getWebApplicationContext(request.getSession().getServletContext());
}
现在怎么办?