春によってロードされたプロパティファイルのすべてのコンテンツを単純にログに記録することは可能<context:property-placeholder />
ですか?
ありがとう
春によってロードされたプロパティファイルのすべてのコンテンツを単純にログに記録することは可能<context:property-placeholder />
ですか?
ありがとう
のログレベルorg.springframework.core.env.PropertySourcesPropertyResolver
を「debug」に設定できます。その後、解決中にプロパティの値を確認できます。
あなたはこのようにそれを行うことができます:
<context:property-placeholder properties-ref="myProperties"/>
<bean id="myProperties"
class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="locations">
<list>
.. locations
</list>
</property>
</bean>
以下のようなロギングBeanを追加します(ここではアノテーションベースでslf4j apiを使用):
@Component
public class PropertiesLogger {
private static Logger logger = LoggerFactory.getLogger(PropertiesLogger.class);
@Resource("myProperties")
private Properties props;
@PostConstruct
public void init() {
for (Map.Entry<Object, Object> prop : props.entrySet()) {
logger.debug("{}={}", prop.getKey(), prop.getValue());
}
}
}