CAS 3.5.2.1 是Spring 3.1 MVC应用程序。
目前,应用程序使用ContextLoaderListener从名为deployerContextConfig.xml的 xml 文件填充WebApplicationContext
我可以在 deployerContextConfig.xml 文件中使用属性(例如从cas.properties加载的属性)吗?如果是这样,怎么做?
CAS 3.5.2.1 是Spring 3.1 MVC应用程序。
目前,应用程序使用ContextLoaderListener从名为deployerContextConfig.xml的 xml 文件填充WebApplicationContext
我可以在 deployerContextConfig.xml 文件中使用属性(例如从cas.properties加载的属性)吗?如果是这样,怎么做?
我在 CAS 3.5.0 上,但我认为它与您的版本相同。首先,web.xml 将加载 /WEB-INF/spring-configuration 目录和 /WEB-INF/deployerConfigContext.xml 中的所有 *.xml 文件
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/spring-configuration/*.xml
/WEB-INF/deployerConfigContext.xml
</param-value>
</context-param>
/WEB-INF/spring-configuration/propertyFileConfigurer.xml 将加载 cas.properties 文件
<bean id="propertyPlaceholderConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
p:location="/WEB-INF/cas.properties" />
在 deployerConfigContext.xml 内部:
<!-- Define the contextSource -->
<bean id="contextSourceRepository" class="org.springframework.ldap.core.support.LdapContextSource">
<property name="pooled" value="false" />
<property name="urls">
<bean class="org.springframework.util.StringUtils"
factory-method="commaDelimitedListToSet">
<constructor-arg type="java.lang.String"
value="${ldap.repository.server.urls}" />
</bean>
</property>
<property name="userDn" value="${ldap.authentication.manager.userdn}" />
<property name="password" value="${ldap.authentication.manager.password}" />
<property name="baseEnvironmentProperties">
<map>
<entry key="com.sun.jndi.ldap.connect.timeout" value="${ldap.authentication.jndi.connect.timeout}" />
<entry key="com.sun.jndi.ldap.read.timeout" value="${ldap.authentication.jndi.read.timeout}" />
<entry key="java.naming.security.authentication" value="${ldap.authentication.jndi.security.level}" />
</map>
</property>
</bean>
还有你的 cas.properties:
ldap.repository.server.urls=ldap://ldap.usfca.edu:389