Exam 2v0-7222 All QuestionsBrowse all questions from this exam
Question 31

Which two statements are correct when @SpringBootApplication is annotated on a class? (Choose two.)

    Correct Answer: A, B

    When the @SpringBootApplication annotation is used on a class, it has two main effects. First, it enables auto-configuration by default, which means Spring Boot will automatically configure Spring application based on the dependencies found in the classpath (Option A). Second, it triggers component scanning starting from the package of the class on which it is annotated, scanning for Spring components such as @Controller, @Service, @Repository, and @Configuration (Option B). Other options are incorrect: @SpringBootApplication does not lead to all other annotations on the class being ignored, methods annotated with @Bean are not ignored, and normally only one ApplicationContext is created in a Spring Boot application.

Discussion
Tolo01Options: AB

A and B

2211094Options: AB

Correct answer is AB. A reason why E is not a valid answer is because in typical Apring boot application, there will only be one ApplicationContext created however you can have multiple but this will lead to complication and unexpected behaviour to happen.

zakupowerOptions: AB

These are correct