简体   繁体   中英

Multiple Spring profiles and Maven profiles in one war

I got parser Spring Batch sheduled jobs. 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:

spring:
  profiles.active: @activatedProperties@

And pom.xml: Some profiles from big list of them:

<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@

If I check more than one maven profile only one will work. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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