maven spring profile 协同
生活随笔
收集整理的這篇文章主要介紹了
maven spring profile 协同
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
請在網上查相關的使用情景,這里直接上要點。另外,可能不只一種方法,但這里只有一種。
1、POM.XML片段,使web.xml文件中有關活躍spring profile的內容可以被maven自動替換
<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-war-plugin</artifactId><version>2.4</version><configuration><webResources><resource><filtering>true</filtering><directory>src/main/webapp</directory><includes><include>**/web.xml</include></includes></resource></webResources><warSourceDirectory>src/main/webapp</warSourceDirectory><webXml>src/main/webapp/WEB-INF/web.xml</webXml></configuration></plugin>2、POM.XML片段,在profile中自定義屬性。注意id與屬性值的一致!
<profile><id>test</id><properties><profile.active>test</profile.active>……</properties></profile><profile><id>dev</id><properties><profile.active>dev</profile.active>……</properties></profile>3、web.xml片段,使用maven中定義的屬性
<context-param><param-name>spring.profiles.active</param-name><param-value>${profile.active}</param-value></context-param>4、spring配置文件,定義各種Beans的所適用的profile。
<beans profile="test,online"></beans><beans profile="dev"></beans>?
總結
以上是生活随笔為你收集整理的maven spring profile 协同的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 基于HAproxy的web动静分离及输出
- 下一篇: Word 2010中利用尾注添加参考文献