简体   繁体   English

一战中多个Spring配置文件和Maven配置文件

[英]Multiple Spring profiles and Maven profiles in one war

I got parser Spring Batch sheduled jobs. 我得到了解析器Spring Batch的工作。 I got many jobs and here are just two of them: 我有很多工作,这里只有两个:

@Profile("eodT0")
@EnableBatchProcessing
@Configuration
public class JobConfigurationEodT0 { ... }

@Profile("eodRepo")
@EnableBatchProcessing
@Configuration
public class JobConfigurationEodRepo { ... }

My application.yml config: 我的application.yml配置:

spring:
  profiles.active: @activatedProperties@

And pom.xml: Some profiles from big list of them: pom.xml:其中的一些概要文件:

<profiles>
    <profile>
        <id>eodT0</id>
        <properties>
            <activatedProperties>eodT0</activatedProperties>
        </properties>
    </profile>
    <profile>
        <id>eodRepo</id>
        <properties>
            <activatedProperties>eodRepo</activatedProperties>
        </properties>
    </profile>
</profiles>

I want it to be like 我希望它像

spring: profiles.active: eodT0, eodRepo instead of @activatedProperties@ 春季:profiles.active:eodT0,eodRepo而不是@ activatedProperties @

If I check more than one maven profile only one will work. 如果我检查了多个Maven配置文件,则只有一个可用。 I need to check profiles depending on what jobs I want to do to make them all active to make war and put it on server. 我需要根据要执行的工作来检查配置文件,以使其全部活跃起来进行战争并将其放置在服务器上。 How is it to be done? 怎么做?

为什么不将其作为系统属性传递。

mvn package -DactivatedProperties=eodT0,eodT1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM