There are use cases where we need to disable amazon cloud related bean auto configurations( Amazon S3, for eg). It would be nice to have auto configurations that will only activated based on a property. spring.cloud.aws.s3.enabled. Similar properties can be made available to other AWS components configured by Spring Cloud.
Well, mostly it's not necessarily. You always can rely on the Spring Boot exclude option: http://docs.spring.io/spring-boot/docs/1.5.3.RELEASE/reference/htmlsingle/#using-boot-disabling-specific-auto-configuration
I think it forces the user to understand the different dependent auto configuration classes vs just having a simple property and let the framework have that knowledge. @artembilan
Yes, I see your point. But in fact there are not so much options in Spring Boot per se, which are aimed for switching feature off by properties. Mostly we really have to do spring.autoconfigure.exclude, if some feature is auto-configured without our wishes.
Turning off particular features through properties is the approach used in Spring Cloud GCP. I like this approach and believe it's easier to pick up than turning off autoconfiguration through exclusions.
This feature would be good... is it still the case that spring cloud in general is activated using the cloud profile? Could AWS config be conditional in the same way as that? I'd be happy to try and help out if required
Happened to be helping someone that ran into this too. They tried using @SpringBootApplication(exclude but it doesn't work since the classes are named deceptively - to be autoconfigurations I think they need @EnableAutoConfiguration. Currently they're just normal @Configuration and can't be used with that parameter. Instead, they need to be filtered using @ComponentScan.
Does it make sense to add @EnableAutoConfiguration or otherwise rename those classes to *Configuration instead of auto? (latter is breaking and probably not a great idea but just for completeness).
/cc @jcchavez
Most helpful comment
Turning off particular features through properties is the approach used in Spring Cloud GCP. I like this approach and believe it's easier to pick up than turning off autoconfiguration through exclusions.