代码如下
applicationContext.xml
<bean class="org.springframework.context.support.PropertySourcesPlaceholderConfigurer">
<property name="locations">
<list>
<value>/WEB-INF/config/jdbc.properties</value>
<value>/WEB-INF/config/webapp.properties</value>
<value>/WEB-INF/config/thauth.properties</value>
</list>
</property>
</bean>
web.xml
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/config/spring/common/*-context.xml
/WEB-INF/config/spring/components/*-context.xml
</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
java 代码
@Value("${dataSource.jndiName}")
private String value;
@Value注解的这个类是否被Spring扫描到,是否加了@Component注解或其他。