【发布时间】:2014-09-15 07:18:11
【问题描述】:
我在@Configuration 类中有以下内容
@PropertySource(name = "applicationProperties", value = {
"classpath:application.properties",
"classpath:${spring.profiles.active}.properties",
"classpath:hibernate.properties",
"classpath:${spring.profiles.active}.hibernate.properties" })
我想以 java.util.Properties 对象的形式检索所有属性,或者使用 @Value 通过前缀将其过滤为属性子集。
//This works but only gives System.properties
@Value("#{systemProperties}")
private Properties systemProperties;
//I want to do this, but I can't find a way to make it work with Spring EL if there is a way.
@Value("#{application.Properties}")
private Properties appProperties;
我使用的是纯 java 配置,我只需要以某种方式获取由 @PropertySource 配置的属性。 Spring Environment 一次只允许您获取一个属性。
简而言之,我真正想要的是所有以hibernate为前缀的属性。*
【问题讨论】: