2v0-7222 Exam QuestionsBrowse all questions from this exam

2v0-7222 Exam - Question 66


Refer to the exhibit.

Which two statements are correct regarding auto-configuration of DataSource and JdbcTemplate beans given a Spring Boot application with only these two dependencies? (Choose two.)

Show Answer
Correct Answer: CE

When using Spring Boot with the dependencies org.springframework.boot:spring-boot-starter-jdbc and org.hsqldb:hsqldb, it will automatically configure both a DataSource and a JdbcTemplate bean. This is because the presence of spring-boot-starter-jdbc triggers Spring Boot's auto-configuration mechanism to set up a DataSource bean, and subsequently, a JdbcTemplate bean using that DataSource. Therefore, a DataSource bean will be auto-configured, and a JdbcTemplate bean will also be auto-configured.

Discussion

1 comment
Sign in to comment
2211094Options: CE
Jul 1, 2024

CE is valid answer. Because spring boot does this auto-configurations based on those dependencies under the hood, you do not need to define them explicitly.