Exam 2v0-7222 All QuestionsBrowse all questions from this 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.)

    Correct Answer: C, E

    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
2211094Options: CE

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.