spring-cloud / spring-cloud-zookeeper

Spring Cloud Zookeeper
http://cloud.spring.io/spring-cloud-zookeeper/
Apache License 2.0
556 stars 413 forks source link

`@ConditionalOnProperty` target property with no metadata #174

Open snicoll opened 6 years ago

snicoll commented 6 years ago

Several auto-configurations use a condition on a property that has no metadata. As a result, trying to use it to customize the auto-configuration lead to a warning in an IDE.

The report detected the following:

org.springframework.cloud.zookeeper.config.ZookeeperConfigAutoConfiguration [spring.cloud.zookeeper.config.enabled]
org.springframework.cloud.zookeeper.config.ZookeeperConfigAutoConfiguration.ZkRefreshConfiguration#configWatcher [spring.cloud.zookeeper.config.watcher.enabled]
org.springframework.cloud.zookeeper.discovery.ConditionalOnRibbonZookeeper [ribbon.zookeeper.enabled]
org.springframework.cloud.zookeeper.discovery.ZookeeperRibbonClientConfiguration#dependenciesBasedLoadBalancer [spring.cloud.zookeeper.dependency.ribbon.loadbalancer]
org.springframework.cloud.zookeeper.discovery.dependency.DependencyFeignClientAutoConfiguration [spring.cloud.zookeeper.dependency.headers.enabled]
org.springframework.cloud.zookeeper.discovery.dependency.DependencyRestTemplateAutoConfiguration [spring.cloud.zookeeper.dependency.resttemplate.enabled]
org.springframework.cloud.zookeeper.discovery.dependency.DependencyRibbonAutoConfiguration#loadBalancerClient [spring.cloud.zookeeper.dependency.ribbon.enabled]
org.springframework.cloud.zookeeper.serviceregistry.ZookeeperServiceRegistryAutoConfiguration [spring.cloud.service-registry.enabled]
hu-chia commented 4 years ago

BTW, spring-cloud-zookeeper-config:2.2.1-RELEASE do not have spring-autoconfigure-metadata and additional-spring-autoconfigure-metadata.

image

ryanjbaxter commented 3 years ago

Fixed via 009ee54

snicoll commented 3 years ago

@ryanjbaxter I don't think that commit fixed the problem I reported.

Taking the first example in the description above (updated with recent code): spring.cloud.zookeeper.enabled is used in ConditionalOnZookeeperEnabled but there is no metadata for that property. It is flagged as unresolved as far as I know.

ryanjbaxter commented 3 years ago

Sorry @snicoll I didnt check the issues the PR claimed it fixed, thanks for reopening.