2v0-7222 Exam QuestionsBrowse all questions from this exam

2v0-7222 Exam - Question 31


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

Show Answer
Correct Answer: ABE

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

3 comments
Sign in to comment
Tolo01Options: AB
Jul 28, 2023

A and B

zakupowerOptions: AB
Mar 12, 2023

These are correct

2211094Options: AB
Jun 15, 2024

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.