Which two statements are correct regarding Spring Boot auto-configuration? (Choose two.)
Which two statements are correct regarding Spring Boot auto-configuration? (Choose two.)
Spring Boot's auto-configuration uses @Conditional annotations to determine when it should be applied, ensuring that certain configurations happen only if specific conditions are met. Additionally, auto-configuration can apply when a bean is missing, meaning that it will provide a default configuration in the absence of user-defined beans, but it will not override existing user-defined beans.
E is wrong since auto-configuration is applied AFTER user-defined beans have been registered.
C is wrong auto-configuration classes are here META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports and not spring.factories
C is correct, the actual processing is in spring.factories
A and C Auto-configuration could apply when the bean is present or not and Auto-configuration is applied after user define , in that way can take user define confg.
A and B are correct. A) Spring Boot's auto-configuration classes use conditional annotations to set up auto configuration B) B is right because Auto-configuration can apply when any auto-configuration bean is missing after initializing user-defined beans (E is wrong due to this, since user defined beans are always loaded first, before auto-configuration applies) but it can not apply when bean is present. for example, if I as a developer, define auto-configuration bean myself and they are initialized by user's custom definition, then auto-configuration will not apply for that specific class.
I think A and E are the best answer
E is not correct. User-defined beans are always loaded first before auto-configuration applies. Thus, if you define your own Bean types which would be auto-configured otherwise, auto-configuration will not apply for that specific bean. For example, if I define DataSource bean in my own configuration class, my DataSource bean will initialize and auto-configuration will not configure any other DataSource anymore, since my DataSource bean is present.