2V0-72.22PSE · Question #35
Refer to the exhibit. The above code shows a conditional @Bean method for the creation of a JdbcTemplate bean. Which two statements correctly describe the code behavior? (Choose two.)
The correct answer is A. @ConditionalOnBean(name= "dataSource") should be replaced with @ConditionalOnBean E. A JdbcTemplate bean will be created when a bean named dataSource has already been. Option D is incorrect because the @ConditionalOnBean annotation requires that a bean with the specified name or class already exists in the application context for the JdbcTemplate bean to be
Question
Refer to the exhibit. The above code shows a conditional @Bean method for the creation of a JdbcTemplate bean. Which two statements correctly describe the code behavior? (Choose two.)
Options
- A@ConditionalOnBean(name= "dataSource") should be replaced with @ConditionalOnBean
- B@ConditionalOnBean(name= "dataSource") should be replaced with
- CThe @Bean annotation should be removed.
- DA JdbcTemplate bean will be created when the DataSource class is in the classpath but there
- EA JdbcTemplate bean will be created when a bean named dataSource has already been
How the community answered
(40 responses)- A73% (29)
- B3% (1)
- C8% (3)
- D18% (7)
Explanation
Option D is incorrect because the @ConditionalOnBean annotation requires that a bean with the specified name or class already exists in the application context for the JdbcTemplate bean to be
Topics
Community Discussion
No community discussion yet for this question.