阅读背景:

Spring中的@Profile与@ActiveProfile_码农书生_activeprofile

来源:互联网 

1、使用@Profile

配置类

@Configuration
public class ProfileConfig {
    @Bean
    @Profile("upper")
    public UpperAction upperAction1(){
        return  new UpperAction("Tom");
    }

    @Bean
    @Profile("upper1")
    public UpperAction upperAction2(){
        return  new UpperAction("Jack");
    }

    @Bean
    @Profile("lower")
    public LowerAction lowerAction1(){
        return new LowerAction();
    }
/*
    @Bean
    @Profile("upper0")
    public Action action(){

        Action action1 =(Action) new UpperAction("Tom");

        return action1;
    }
*/
}
@Configuration
public clas



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: