3
PropertyPlaceholderConfigurer
がXMLファイルを使用している場合、Spring @Configuration
が処理するすべてのBeanのプロパティのソースとして使用できますか?以上によりSpring @Configurationのプロパティ
@Configuration
@ComponentScan(value = { "x.y.z })
@ImportResource({ "classpath:remote-properties/applicationContext.xml",})
public class CoreConfiguration implements TransactionManagementConfigurer {
@Resource(name = "com.c.h.c.PropertyPlaceholderConfigurer")
public PropertyPlaceholderConfigurer pp;
@Bean
public PropertyPlaceholderConfigurer propertiesFactoryBean() {
return pp;
}
}
、それはpp
に私のブレークポイントにヒットすることはありません。 @Bean
とそのメソッドを削除すると、pp
が入力されていることが確認できます。だから私はどのように私は構成でそれを登録することができますか?
http://forum.springsource.org/showthread.php?107194-PropertyPlaceholderConfigurer-and-javconfig –
@Robを見直しましたか?プロパティファイルを直接使用することはできません。そのアプリケーションコンテンツからPropertyPlaceholderConfigurer Beanを使用するか、2番目のプロパティファイルのURLを持つプロパティファイルをロードしてから、そのプロパティファイルをロードする必要があります。私はそれがばかげているのは分かっていますが、それは私が複数の環境問題を解決しているチームです。 – AHungerArtist
@Robさらに、@Configurationクラスだけでなく、 '@ComponentScan'が '@Service'アノテートされたクラスの魔法を実行するときに利用できるようになりました( '@Value'アノテーションは正しく入力されます)。 – AHungerArtist