Labour Day Sale Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: buysanta

Exact2Pass Menu

Question # 4

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.

B.

@ConditionalOnBean(name= “dataSource”) should be replaced with

@ConditionalOnMissingBean (DataSource.class) for greater flexibility.

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.

E.

A JdbcTemplate bean will be created when a bean named dataSource has already been created.

Full Access
Question # 5

Which statement is true about the @PropertySource annotation? (Choose the best answer.)

A.

Used to designate the location of the application.properties file in a Spring Boot application.

B.

Used to easily look up and return a single property value from some external property file.

C.

Used to designate the file directory of the application.properties file in a Spring Boot application.

D.

Used to add a set of name/value pairs to the Spring Environment from an external source.

Full Access
Question # 6

If a class is annotated with @Component, what should be done to have Spring automatically detect the annotated class and load it as a bean? (Choose the best answer.)

A.

Ensure a valid bean name in the @Component annotation is specified.

B.

Ensure a valid @ComponentScan annotation in the Java configuration is specified.

C.

Ensure a valid @Scope for the class is specified.

D.

Ensure a valid @Bean for the class is specified.

Full Access
Question # 7

Refer to the exhibit.

How can a response status code be set for No Content (204)? (Choose the best answer.)

A.

Annotate the update() handler method with @PutMapping(“/store/orders/{id”}”, HttpStatus.NO_CONTENT).

B.

Annotate the update() handler method with @ResponseStatus(HttpStatus.NO_CONTENT).

C.

Annotate the update() handler method with @ResponseEntity(204).

D.

The update() handler method cannot return a void type, it must return a ResponseEntity type.

Full Access
Question # 8

Which statement describes the propagation behavior of Propagation.REQUIRES_NEW annotation? (Choose the best answer.)

A.

Starts a new transaction but throws an exception if an active transaction already exists.

B.

Joins a transaction if one already exists; throws an exception if an active transaction does not exist.

C.

Starts a new transaction; if an active transaction already exists, it is suspended.

D.

Runs in a nested transaction if an active transaction exists; throws an exception if an active transaction does not exist.

Full Access
Question # 9

Which dependency enables an automatic restart of the application as code is changed during development of a Spring boot configuration on a web application? (Choose the best answer.)

A.

spring-boot-devtools

B.

spring-boot-initializr

C.

spring-boot-starter-devtools

D.

spring-boot-restart

Full Access