Which statement about @TestPropertySource annotation is true? (Choose the best answer.)
Refer to the exhibit.
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.)
When using Spring transaction management with annotation-driven mode, the @Transactional annotation will be processed by a TransactionInterceptor that implements the AOP advice interface. This interceptor will be applied to the target bean through a proxy that implements the same interface as the target bean. Therefore, when a method of the target bean is called from outside, it will actually invoke the proxy method, which will delegate to the interceptor and then to the actual target method.
However, when a method of the target bean is called from within the same bean, it will not go through the proxy and thus bypass the interceptor logic. In this case, when update1() calls update2(), it will not start a new transaction as specified by REQUIRES_NEW propagation level, but rather join the existing transaction initiated by update1() itself.
Which three statements are advantages of using Spring's Dependency Injection? (Choose three.)
C . Dependencies between application components can be managed external to the components.
D . Configuration can be externalized and centralized in a small set of files.
F . Dependency injection facilitates loose coupling between components.
Which two statements are true regarding Spring Security? (Choose two.)
Spring Security is a framework that provides comprehensive security services for Java applications, such as authentication, authorization, encryption, session management, and more. One of its features is method security, which allows applying access control rules at the method level using annotations or XML configuration. Another feature is authentication, which is the process of verifying the identity of a user or a system. Spring Security supports various authentication mechanisms, such as username and password, tokens, certificates, etc., and can access authentication data from different sources, such as databases, LDAP directories, in-memory stores, etc.
Which option is true about use of mocks in a Spring Boot web slice test? (Choose the best answer.)
A web slice test is a type of test in Spring Boot that focuses on testing only the web layer of an application, without starting a full server or requiring a real database. To isolate the web layer from other dependencies, such as services or repositories, mocks can be used to simulate their behavior and return predefined responses. To create and inject a mock for an existing bean in the application context, the @MockBean annotation can be used on a field or a parameter in the test class. This annotation will replace any existing bean of the same type with a mock created by Mockito.