带有maven配置文件属性的Spring 3 @value注释

Pet*_*rta 1 java spring annotations properties maven

我在pom.xml中为不同的配置文件定义了一堆属性.我想使用@value注释来注入属性值.只需在构建时获取值即可.

我对这个@value注释有什么样的选择?我是否必须拥有单独的属性文件,还是可以使用applicationContext.xml?

Sea*_*oyd 5

我会做的就是使用性质Maven插件写项目属性到一个文件,然后从春季引用文件,通过PropertyPlaceHolderConfigurer机制