给出下面的spring / boot应用程序。
@SpringBootApplication
@Configuration
@ComponentScan
@EnableGlobalMethodSecurity(
prePostEnabled = true,
securedEnabled = false,
jsr250Enabled = false)
@EnableJms // we would like to control this from an application property on/off
public class PayZilchCustomerServiceApplication {
static {
SSLUtilities.trustAllHostnames();
SSLUtilities.trustAllHttpsCertificates();
}
public static void main(String[] args) {
SpringApplication.run(PayZilchCustomerServiceApplication.class, args);
}
}
我们发现对于某些本地调试方案,我们希望关闭@EnableJms
。我们注释掉代码行。我们有时会创建带有注释行的PR。 PR正在通过代码审查来捕获。
将要经过一天。我们如何从应用程序属性文件控制@EnableJms
,最好是默认情况下它处于打开状态,但可以通过application-local.properties
条目将其关闭。
创建一个新类,并使用以下3个注释进行标记:
@Configuration
@EnableJms
@ConditionalOnProperty(name = "turnonjms", havingValue = "true")
public class EnableMyJmsClass {
//you can keep it empty. Just make sure this is present in the same folder where main class is
}