nerdexam
Broadcom-VMware

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

Cloud Native

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)
  • A
    73% (29)
  • B
    3% (1)
  • C
    8% (3)
  • D
    18% (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

#@ConditionalOnBean#JdbcTemplate#DataSource#auto-configuration

Community Discussion

No community discussion yet for this question.

Full 2V0-72.22PSE Practice