Which statement is true about the @PropertySource annotation? (Choose the best answer.)
A. Used to add a set of name/value pairs to the Spring Environment from an external source.
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 designate the location of the application.properties file in a Spring Boot application.
正解:B
質問 2:
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. This syntax is invalid because the bean id must be specified as a method parameter.
C. It will return a bean of the type ClientService regardless of its id or name.
D. It will return a bean called ClientService regardless of its id or name.
正解:C
質問 3:
Which two statements are true concerning constructor injection? (Choose two.)
A. Field injection is preferred over constructor injection from a unit testing standpoint.
B. Constructor injection is preferred over field injection to support unit testing.
C. If there is only one constructor the @Autowired annotation is not required.
D. Construction injection can be used with multiple constructors without @Autowired annotation.
E. Constructor injection only allows one value to be injected.
正解:A,B
質問 4:
Which two are required to use transactions in Spring? (Choose two.)
A. Add @EnableTransactionManagement to a Java configuration class.
B. A class requiring a transaction must implement the TransactionInterceptor interface.
C. Write a Spring AOP advice to implement transactional behavior.
D. Annotate a class, an interface, or individual methods requiring a transaction with the @Transactional annotation.
E. A class must be annotated with @Service and @Transaction.
正解:A,D
質問 5:
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
@ConditionalOnMissingBean (DataSource.class) for greater flexibility.
B. A JdbcTemplate bean will be created when a bean named dataSource has already been created.
C. The @Bean annotation should be removed.
D. @ConditionalOnBean(name= "dataSource") should be replaced with @ConditionalOnBean (DataSource.class) for greater flexibility.
E. A JdbcTemplate bean will be created when the DataSource class is in the classpath but there is no DataSource bean.
正解:D,E
質問 6:
Which two statements are correct when @SpringBootApplication is annotated on a class? (Choose two.)
A. Component scanning will start from the package of the class.
B. A separate ApplicationContext will be created for each class annotated with
C. All other annotations on the class will be ignored.
D. It causes Spring Boot to enable auto-configuration by default.
E. Methods in the class annotated with @Bean will be ignored.
正解:B,D
解説: (Pass4Test メンバーにのみ表示されます)
Kiuchi -
まさかの満点で試験を受かりました。やったぜ!
Pass4Testの担当様、本当にありがとうございました。
今回2V0-72.22を目指しますが、その時はまたよろしくお願いしますね。