nerdexam
Broadcom-VMware

2V0-72.22 · 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

Application Deployment and Management

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

(39 responses)
  • A
    85% (33)
  • B
    8% (3)
  • C
    5% (2)
  • D
    3% (1)

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

#@ConditionalOnBean#JdbcTemplate#DataSource#Spring Boot conditional

Community Discussion

No community discussion yet for this question.

Full 2V0-72.22 Practice