新浪博客

SpringBoot@Profile用法

2022-10-22 17:20阅读:
// 启动时指定的profile包含有profile1或profiles的时候实例化
@Service
@Profile({'profile1', 'profile2'})
public class Printer2 implements Printer {
}
// '不包含profile1或不包含profile2的时候实例化
@Service
@Profile({'!profile1', '!profile2'})
public class Printer2 implements Printer {
}

我的更多文章

下载客户端阅读体验更佳

APP专享