Can I inject properties from Maven (passwords defined in settings.xml) into my Spring container?

后端 未结 4 1262
自闭症患者
自闭症患者 2020-12-25 15:08

I define passwords to servers via properties I define in my ~/.m2/settings.xml (could be anywhere, though, including pom.xml) for my deployment plugin. I\'d like to use the

4条回答
  •  感情败类
    2020-12-25 15:19

    You can get Maven to substitute a particular value into your xml file when maven builds your project with a certain profile. So for example you would set up a test prfile in your maven pom and when you build with that profile the xml file in your jar will have the desired property in it. Look at this for an example.

提交回复
热议问题