Conditional spring bean creation

后端 未结 4 1323
悲哀的现实
悲哀的现实 2020-12-03 04:42

I have a question about Spring annotation configurations. I have a bean:

@Bean 
public ObservationWebSocketClient observationWebSocketClient(){
    log.info(&         


        
4条回答
  •  暖寄归人
    2020-12-03 04:54

    Annotate your bean method with @ConditionalOnProperty("createWebSocket").

    Note that Spring Boot offers a number of useful conditions prepackaged.

提交回复
热议问题