How can you create a bean only if no other bean of the same type exists and a specific property service.enabled is set to true?
A@Bean
@ConditionalOnMissingBean
@ConditionalOnProperty(name = "service.enabled", havingValue = "true")
public Service service() { return new Service(); }
B@Bean
@ConditionalOnBean(Service.class)
@ConditionalOnProperty(name = "service.enabled", havingValue = "true")
public Service service() { return new Service(); }
C@Bean
@ConditionalOnMissingBean
@ConditionalOnProperty(name = "service.enabled", havingValue = "false")
public Service service() { return new Service(); }
D@Bean
@ConditionalOnClass(Service.class)
@ConditionalOnProperty(name = "service.enabled")
public Service service() { return new Service(); }