VMware Professional Develop VMware Spring 2V0-72.22 Exam Practice Test

Page: 1 / 14
Total 79 questions
Question 1

Which two statements are true regarding a Spring Boot "fat" JAR? (Choose two.)



Answer : C, E


Question 2

Spring puts each bean instance in a scope. What is the default scope? (Choose the best answer.)



Answer : B

Spring supports different scopes for bean instances, such as singleton, prototype, request, session, etc. The scope determines how many instances of a bean are created and how they are shared among other components. The default scope is singleton, which means that only one instance of a bean is created per application context and it is shared by all components that depend on it.


Question 3

Which two statements are correct regarding the differences between @ConfigurationProperties and @Value? (Choose two.)



Question 4

Which is the correct approach to register for a bean destruction callback?



Answer : B


Question 5

Which two are required to use transactions in Spring? (Choose two.)



Answer : A, B

Transactions are units of work that ensure data consistency and integrity by enforcing atomicity, consistency, isolation, and durability (ACID) properties. Spring provides an abstraction layer for transaction management that supports various transaction APIs such as JDBC, JPA, Hibernate, etc. To use transactions in Spring, we need to do two things:

Enable transaction management by adding @EnableTransactionManagement annotation to a Java configuration class ortx:annotation-driven/element to an XML configuration file.

Declare transactional boundaries by annotating a class, an interface, or individual methods with the @Transactional annotation. This annotation indicates that the execution of the annotated element should be wrapped in a transaction.


Question 6

Which two statements are true about Spring Boot and Spring Data JPA? (Choose two.)



Answer : A, B

A . @EntityScan and spring.jpa.* properties can be used to customize Spring Data JPA.

This is true because the @EntityScan annotation can be used to specify the base packages to scan for JPA entities, instead of using the default package of the main application class. The spring.jpa.* properties can be used to configure various aspects of Spring Data JPA, such as the database platform, the DDL generation, the show-sql flag, etc.

B . Any kind of Hibernate property can be passed to Spring Data JPA like spring.jpa.properties.xxx.

This is true because Spring Data JPA supports passing any Hibernate-specific property by using the prefix spring.jpa.properties. For example, we can use spring.jpa.properties.hibernate.format_sql=true to format the SQL statements generated by Hibernate.


Question 7

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.)



Answer : D

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.


Page:    1 / 14   
Total 79 questions