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

推荐订阅源

爱范儿
爱范儿
P
Palo Alto Networks Blog
月光博客
月光博客
H
Hackread – Cybersecurity News, Data Breaches, AI and More
I
InfoQ
aimingoo的专栏
aimingoo的专栏
腾讯CDC
T
Threatpost
D
DataBreaches.Net
Vercel News
Vercel News
F
Fortinet All Blogs
Engineering at Meta
Engineering at Meta
C
Cybersecurity and Infrastructure Security Agency CISA
Forbes - Security
Forbes - Security
U
Unit 42
C
Check Point Blog
Blog — PlanetScale
Blog — PlanetScale
O
OpenAI News
量子位
TaoSecurity Blog
TaoSecurity Blog
Microsoft Azure Blog
Microsoft Azure Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
V
Visual Studio Blog
Recorded Future
Recorded Future
云风的 BLOG
云风的 BLOG
Security Archives - TechRepublic
Security Archives - TechRepublic
The Last Watchdog
The Last Watchdog
S
Security Affairs
Attack and Defense Labs
Attack and Defense Labs
罗磊的独立博客
Stack Overflow Blog
Stack Overflow Blog
Microsoft Security Blog
Microsoft Security Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
V
V2EX
小众软件
小众软件
S
SegmentFault 最新的问题
www.infosecurity-magazine.com
www.infosecurity-magazine.com
W
WeLiveSecurity
AI
AI
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
博客园 - 聂微东
I
Intezer
Know Your Adversary
Know Your Adversary
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Proofpoint News Feed
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
The Cloudflare Blog
博客园_首页
NISL@THU
NISL@THU
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO

博客园 - 李学斌

写单元测试,我不认为是件容易的事 服务治理咋这么难?我想得换个治法了。 百度大会见解 李学斌:论复杂系统中的应用间协作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>