ExamGecko
Question list
Search
Search

Question 16 - 2V0-72.22 discussion

Report
Export

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.)

A.
@ConditionalOnBean(name= “dataSource”) should be replaced with @ConditionalOnBean(DataSource.class) for greater flexibility.
Answers
A.
@ConditionalOnBean(name= “dataSource”) should be replaced with @ConditionalOnBean(DataSource.class) for greater flexibility.
B.
@ConditionalOnBean(name= “dataSource”) should be replaced with@ConditionalOnMissingBean (DataSource.class) for greater flexibility.
Answers
B.
@ConditionalOnBean(name= “dataSource”) should be replaced with@ConditionalOnMissingBean (DataSource.class) for greater flexibility.
C.
The @Bean annotation should be removed.
Answers
C.
The @Bean annotation should be removed.
D.
A JdbcTemplate bean will be created when the DataSource class is in the classpath but there is no DataSource bean.
Answers
D.
A JdbcTemplate bean will be created when the DataSource class is in the classpath but there is no DataSource bean.
E.
A JdbcTemplate bean will be created when a bean named dataSource has already been created.
Answers
E.
A JdbcTemplate bean will be created when a bean named dataSource has already been created.
Suggested answer: A, D
asked 16/09/2024
Oleksii Derevianchenko
33 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first