Spring Boot : How does @EnableAutoConfiguration annotation works?

Spring Boot framework allows to create spring based applications with minimizing the effort of doing manual spring configurations. Spring Boot automatically do the configuration on behalf of the developer. You might be wonder how does the spring boot framework do the configuration automatically.

                This is done with the @EnableAutoConfiguration annotation available in the Spring framework. @EnableAutoConfiguration will automatically do the spring configurations. it will create, register and load the Spring configuration beans required by the applications from the classes available in the class path.

e.g:- For example if  JpaRepository class is present on the class path, then the RabbitAutoConfiguration will be enabled.

Spring Boot is designed so that you can gradually replaced the auto-configuration as needed. To exclude an auto configuration, use the exclude attribute of the @EnableAutoConfiguration annotation as below:



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s