在Intellij IDEA中查看@Autowired Bean时未反映@ConditionalOnProperty

时间:2018-11-19 18:57:16

标签: spring-boot intellij-idea

假设我有@Configuration类,该类有条件地使用RestClient注册了@ConditionalOnProperty类型的bean。

@Configuration
public class RestClientConfig {

    @Bean("restClient")
    @ConditionalOnProperty(prefix = "rest.client", name = "enabled", havingValue = "false", matchIfMissing = true)
    public RestClient restClient(RestProperties properties) {
        return new HttpRestClient(...);
    }

    @Bean("restClient")
    @ConditionalOnProperty(prefix = "rest.client", name = "enabled", havingValue = "true")
    public RestClient mockRestClient(RestProperties properties) {
        return new MockRestClient();
    }

}

当我运行此应用程序时,一切正常。当我在另一个bean中自动装配RestClient时,正确选择了给定类型的实现。

但是,当我在Intellij IDEA中查看此设置时,它报告: enter image description here

是否可以指示Intellij了解@ConditionalOnProperty或在Spring Boot中以其他方式进行操作?

0 个答案:

没有答案