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.
Which option is true about use of mocks in a Spring Boot web slice test? (Choose the best answer.)
A. Mocking a Spring Bean requires annotating it with @MockBean annotation.
B. If a Spring Bean already exists in the web slice test spring context, it cannot be mocked.
C. Mocks cannot be used in a Spring Boot web slice test.
D. Mocking a Spring Bean requires annotating it with @Mock annotation.
Which two statements are true regarding a Spring Boot-based Spring MVC application? (Choose two.)
A. The default embedded servlet container can be replaced with Undertow.
B. Jetty is the default servlet container.
C. Spring Boot starts up an embedded servlet container by default.
D. The default port of the embedded servlet container is 8088.
E. Spring MVC starts up an in-memory database by default.
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
Refer to the exhibit.
Which option is a valid way to retrieve the account id? (Choose the best answer.)
A. Add @PathVariable("id") String accountId argument to the update() handler method.
B. Add @PathVariable long accountId argument to the update() handler method.
C. Add @RequestParam long accountId argument to the update() handler method.
D. Add @RequestParam("id") String accountId argument to the update() handler method.
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.
Which statement is true? (Choose the best answer.)
A. @ActiveProfiles is a class-level annotation that is used to instruct the Spring TestContext Framework to record all application events that are published in the ApplicationContext during the execution of a single test.
B. @ActiveProfiles is a class-level annotation that you can use to configure how the Spring TestContext Framework is bootstrapped.
C. @ActiveProfiles is a class-level annotation that you can use to configure the locations of properties files and inlined properties to be added to the set of PropertySources in the Environment for an ApplicationContext loaded for an integration test.
D. @ActiveProfiles is a class-level annotation that is used to declare which bean definition profiles should be active when loaded an ApplicationContext for an integration test.
Which two statements are true about @Controller annotated classes? (Choose two.)
A. The @Controller annotated classes can only render views.
B. The classes are eligible for handling requests in Spring MVC.
C. The classes must be annotated together with @EnableMvcMappings to be discovered via component scanning.
D. @Controller is interchangeable with @RestController with no extra code changes for the methods inside the class.
E. The @Controller annotation is a stereotype annotation like @Component.
Refer to the exhibit.
It is a Java code fragment from a Spring application. Which statement is true with regard to the above example? (Choose the best answer.)
A. This syntax is invalid because the result of the getBean() method call should be cast to ClientService.
B. It will return a bean called ClientService regardless of its id or name.
C. This syntax is invalid because the bean id must be specified as a method parameter.
D. It will return a bean of the type ClientService regardless of its id or name.
What are the two reasons Spring be used to build a Java application? (Choose two.)
A. Spring automates a Java application build.
B. Spring provides a Dependency Injection container.
C. Spring automates deployment of Java applications to all of the major cloud providers.
D. Spring provides comprehensive Java IDE support.
E. Spring provides abstractions over infrastructure such as persistence and messaging.