惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Recent Commits to openclaw:main
Recent Commits to openclaw:main
N
News | PayPal Newsroom
TaoSecurity Blog
TaoSecurity Blog
Google Online Security Blog
Google Online Security Blog
NISL@THU
NISL@THU
T
Threatpost
C
CXSECURITY Database RSS Feed - CXSecurity.com
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Engineering at Meta
Engineering at Meta
AWS News Blog
AWS News Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
P
Privacy International News Feed
B
Blog
PCI Perspectives
PCI Perspectives
Martin Fowler
Martin Fowler
Spread Privacy
Spread Privacy
P
Proofpoint News Feed
T
Tenable Blog
F
Fortinet All Blogs
G
GRAHAM CLULEY
V2EX - 技术
V2EX - 技术
C
Check Point Blog
Project Zero
Project Zero
P
Palo Alto Networks Blog
J
Java Code Geeks
W
WeLiveSecurity
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
The Exploit Database - CXSecurity.com
博客园 - 司徒正美
P
Privacy & Cybersecurity Law Blog
S
SegmentFault 最新的问题
Last Week in AI
Last Week in AI
Forbes - Security
Forbes - Security
C
Cybersecurity and Infrastructure Security Agency CISA
Security Latest
Security Latest
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Vercel News
Vercel News
Recent Announcements
Recent Announcements
博客园 - Franky
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Recorded Future
Recorded Future
The Last Watchdog
The Last Watchdog
MongoDB | Blog
MongoDB | Blog
人人都是产品经理
人人都是产品经理
酷 壳 – CoolShell
酷 壳 – CoolShell
Cisco Talos Blog
Cisco Talos Blog
量子位
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC

博客园 - 李学斌

写单元测试,我不认为是件容易的事 服务治理咋这么难?我想得换个治法了。 百度大会见解 李学斌:论复杂系统中的应用间协作V3 大视角、大方向、大问题、大架构:(结局)解决问题的出发点 大视角、大方向、大问题、大架构:(二)应用的相关问题 大视角、大方向、大问题、大架构:(一)信息时代下的管理 信息时代下,如何看待技术与理论 狼的架构暗示 狼群的架构暗示 基因与架构 由“I”到“T” 产品的臃肿过程 我们是在开发产品还是项目? 未来电子商务,未来的超市 创业期的软件开发管理(二) 创业期的软件开发管理(一) 平台架构--用户系统 平台架构——体系结构
maven spring profile 协同
李学斌 · 2014-05-06 · via 博客园 - 李学斌

  请在网上查相关的使用情景,这里直接上要点。另外,可能不只一种方法,但这里只有一种。

  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>