Questions for the 2V0-72-22 were updated on : Oct 04 ,2024
Page 1 out of 4. Viewing questions 1-15 out of 60
Question 1
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.
Assume that the application is using Spring transaction management which uses Spring AOP internally. Choose the statement that describes what is happening when the update1 method is called? (Choose the best answer.)
A. There are 2 transactions because REQUIRES_NEW always runs in a new transaction.
B. An exception is thrown as another transaction cannot be started within an existing transaction.
C. There is only one transaction because REQUIRES_NEW will use an active transaction if one already exists.
D. There is only one transaction initiated by update1() because the call to update2() does not go through the proxy.
Answer:
D
User Votes:
A
50%
B
50%
C
50%
D
50%
Discussions
0/ 1000
Question 9
Which two statements are true concerning constructor injection? (Choose two.)
A. If there is only one constructor the @Autowired annotation is not required.
B. Constructor injection only allows one value to be injected.
C. Constructor injection is preferred over field injection to support unit testing.
D. Construction injection can be used with multiple constructors without @Autowired annotation.
E. Field injection is preferred over constructor injection from a unit testing standpoint.
Answer:
CE
User Votes:
A
50%
B
50%
C
50%
D
50%
E
50%
Discussions
0/ 1000
Question 10
Given an ApplicationContext containing three bean definitions of type Foo with bean ids foo1, foo2, and foo3, which three @Autowired scenarios are valid and will allow the ApplicationContext to initialize successfully? (Choose three.)
A. @Autowired public void setFoo (Foo foo) {…}
B. @Autowired @Qualifier (“foo3”) Foo foo;
C. @Autowired public void setFoo (@Qualifier (“foo1”) Foo foo) {…}
D. @Autowired private Foo foo;
E. @Autowired private Foo foo2;
F. @Autowired public void setFoo(Foo foo2) {…}
Answer:
ADF
User Votes:
A
50%
B
50%
C
50%
D
50%
E
50%
F
50%
Discussions
0/ 1000
Question 11
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.)
Which strategy is correct for configuring Spring Security to intercept particular URLs? (Choose the best answer.)
A. The URLs can be specified via configuration (using authorizeRequests () and request matchers), with the most specific rule first and the least specific last.
B. Spring Security can obtain URLs from Spring MVC controllers, the Spring Security configuration just needs a reference to the controller to be protected.
C. The URLs are specified in a special properties file, used by Spring Security.
D. The URLs can be specified via configuration (using authorizeRequests () and request matchers), with the least specific rule first and the most specific last.