RedisHttpSessionConfiguration 里的 PropertySourcesPlaceholderConfigurer 可能会覆盖自己定义的 PropertySourcesPlaceholderConfigurer 可以写在同一个 @Configuration 里来解决 例如 :
@EnableRedisHttpSession(redisNamespace = "u") @Configuration @ImportResource(locations = { "classpath:applicationContext.xml" }) public class ConfigClass {
[@Bean](https://my.oschina.net/bean)
public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
PropertySourcesPlaceholderConfigurer p = new PropertySourcesPlaceholderConfigurer();
p.setIgnoreUnresolvablePlaceholders(true);
org.springframework.core.io.Resource[] resourceLocations = new ClassPathResource[] {
new ClassPathResource("common.properties"), new ClassPathResource("config.properties") };
p.setLocations(resourceLocations);
return p;
}
}