我已经将swagger插入我的春季启动应用程序.Spring启动允许您拥有每个环境的属性文件.有没有办法禁用生产环境的招摇?
是否可以以一种不被一组配置文件使用的方式配置bean?目前我可以这样做(我相信):
@Profile("!dev, !qa, !local")
Run Code Online (Sandbox Code Playgroud)
是否有更简洁的符号来实现这一目标?我们假设我有很多个人资料.另外,如果我有一个Mock和一些服务(或其他)的具体实现,我可以只注释其中一个,并假设另一个将用于所有其他情况?换句话说,这是必要的:
@Profile("dev, prof1, prof2")
public class MockImp implements MyInterface {...}
@Profile("!dev, !prof1, !prof2") //assume for argument sake that there are many other profiles
public class RealImp implements MyInterface {...}
Run Code Online (Sandbox Code Playgroud)
我可以只注释其中一个,并@Primary在另一个上添加注释吗?
本质上我想要这个:
@Profile("!(dev, prof1, prof2)")
Run Code Online (Sandbox Code Playgroud)
提前致谢!