Skip to main content

Posts

Showing posts from November, 2017

Disable Datasource Auto Configuration in Spring Boot

Today morning, We had an interesting situation. Our spring boot application which is configured to run on MySQL needs to be run on a system which does not have MySQL database installed. But we had to develop few UI modules alone. So we decided to go ahead but how do we disable MySQL database auto-configuration? Here is what we did . Spring Boot is an interesting framework that helps auto configure everything for you. In case you need to override any of the auto-configuration, all you need to do is to simply customize it. The auto-configuration backs away. In this typical scenario, we dont want to customize the auto-configuration, rather we want to disable it temporarily until we complete our UI modules. As soon as the system is ready or we find alternate systems, we can run the Application with full-blown schema. OK. so how did we disable the database auto configuration? We are using Spring Boot with JPA, Hibernate and FlywayDB migration tool. If this is going to be your boot