spring-projects / spring-boot

Spring Boot helps you to create Spring-powered, production-grade applications and services with absolute minimum fuss.
https://spring.io/projects/spring-boot
Apache License 2.0
75.08k stars 40.67k forks source link

allow CassandraAutoConfiguration to be disabled with a property #30560

Closed wakingrufus closed 2 years ago

wakingrufus commented 2 years ago

In my organization's microservices, we do our own wiring for the datastax cassandra driver, so I would like to disable spring boot's auto configuration of the cassandra driver. Because CassandraAutoConfiguration is only conditional on CqlSession existing on the classpath, the only way to do this is via @SpringBootApplication(exclude = {CassandraAutoConfiguration.class}).

However, we have a custom ApplicationContextInitializer that pre-sets some environment properties for our environment, so if there was a way to set a property to disable CassandraAutoConfiguration we would not need the boilerplate to disable in each and every microservice.

I propose a @ConditionalOnProperty for CassandraAutoConfiguration which defaults to true. I will be opening a PR for this shortly.

wilkinsona commented 2 years ago

Duplicates #30561.