2v0-7222 Exam QuestionsBrowse all questions from this exam

2v0-7222 Exam - Question 44


Which two statements are correct regarding Spring Boot auto-configuration? (Choose two.)

Show Answer
Correct Answer: AB

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.

Discussion

4 comments
Sign in to comment
Lych33Options: AC
Dec 10, 2023

E is wrong since auto-configuration is applied AFTER user-defined beans have been registered.

C4RNAGE
Mar 16, 2024

C is wrong auto-configuration classes are here META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports and not spring.factories

softarts
Jul 1, 2024

C is correct, the actual processing is in spring.factories

rhuancaOptions: AC
Mar 26, 2023

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.

Tolo01Options: AE
Jul 31, 2023

I think A and E are the best answer

C4RNAGE
Mar 16, 2024

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.

C4RNAGEOptions: AB
Mar 16, 2024

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.