RedisHttpSessionConfiguration 裏的 PropertySourcesPlaceholderConfigurer 可能會覆蓋本身定義的 PropertySourcesPlaceholderConfigurer 能夠寫在同一個 @Configuration 裏來解決 例如 :redis
@EnableRedisHttpSession(redisNamespace = "u") @Configuration @ImportResource(locations = { "classpath:applicationContext.xml" }) public class ConfigClass {spring
[@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; }
}app