Last Updated On : 4-Jun-2026
Stop guessing. Start passing. Our 2V0-72.22 practice test questions gives you the exact question types, timed conditions, and real-world scenarios you'll face on exam day. No fluff just up-to-date questions that mirror the official Professional Develop VMware Spring exam. Whether you're new to VMware or leveling up, this is your shortcut to get "certified." Try a Free 2V0-72.22 exam questions now and feel the difference.
✅ Trusted by 500+ IT pros | Updated for 2026 | Real style questions | 30–40% higher pass rate
Refer to the exhibit.

How can a response status code be set for No Content (204)? (Choose the best answer.)
A. Annotate the update() handler method with @PutMapping(“/store/orders/{id”}”, HttpStatus.NO_CONTENT).
B. Annotate the update() handler method with @ResponseStatus(HttpStatus.NO_CONTENT).
C. Annotate the update() handler method with @ResponseEntity(204).
D. The update() handler method cannot return a void type, it must return a ResponseEntity type.
Explanation:
In Spring MVC, to set a fixed HTTP status code for a handler method (such as 204 No Content), you use the @ResponseStatus annotation at the method level.
@ResponseStatus(HttpStatus.NO_CONTENT) tells Spring to respond with HTTP 204 when the method completes successfully, regardless of the return type (including void).
204 No Content is commonly used for PUT, POST, or DELETE requests where the server successfully processes the request but has no response body to return.
❌ Why the others are incorrect
A – @PutMapping does not accept a status code as an argument. The @RequestMapping variants (like @PutMapping) only accept path, headers, produces/consumes, etc. Putting HttpStatus.NO_CONTENT there is syntactically invalid.
C – @ResponseEntity is a class, not an annotation. Returning new ResponseEntity<>(HttpStatus.NO_CONTENT) would work, but @ResponseEntity(204) is not valid annotation syntax. The question asks for annotating the method, not returning a specific type.
D – False. A handler method can return void (e.g., when using @ResponseStatus), and Spring still sends the correct status code. Returning ResponseEntity is one option but not required.
📘 Reference
Spring Framework Documentation — @ResponseStatus annotation:
"Marks a method or exception class with the status code and reason that should be returned."
HTTP 204: Successful request, no content to send in response body.
Refer to the exhibit.

How can a Spring Bean be created from this LegacySingleton class?
A. Call LegacySingleton.getInstance() from within a @Bean method and return the instance.
B. Return an instance of LegacySingleton using the new keyword from a @Bean method.
C. It is not possible without modifying the LegacySingleton class, the constructor must be public.
D. Modify the LegacySingleton class by adding the @Autowired annotation to the instance variable.
Explanation
The LegacySingleton class (from the exhibit — assumed to have a private constructor and a static getInstance() method, typical of a classic Singleton pattern) cannot be instantiated with the new keyword from outside the class.
Spring can still manage it as a bean by using a @Bean method that calls the static factory method getInstance() and returns that instance. Spring will then register that returned object as a singleton bean in its IoC container.
❌ Why the others are incorrect
B – Incorrect because if the constructor is private (as in typical Singleton), new LegacySingleton() will cause a compilation error. The question’s “LegacySingleton” strongly implies a classic Singleton with a private constructor.
C – False. You can create a Spring bean without modifying the class, by using a factory method (@Bean wrapping getInstance()). Modifying the class is not necessary.
D – False. Adding @Autowired to the instance variable does nothing to create a bean from the class. @Autowired is for dependency injection, not bean definition. The class would still need a way to be instantiated by Spring (which it doesn’t have without modification).
📘 Reference
Spring Framework Documentation — Instantiating beans via static factory method:
“You can also use the @Bean method to call a static factory method and return the object.”
This approach is commonly used to integrate legacy code or third-party classes that control their own instantiation.
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.
Explanation:
The method context.getBean(ClientService.class) uses Spring’s BeanFactory.getBean(Class
This syntax is valid and type-safe, requiring no explicit cast, unlike the older getBean(String) method.
❌ Why other options are incorrect:
A – False. No cast is needed because getBean(Class
B – False. The method does not look up a bean by its name (“ClientService”). It looks up by type (the ClientService class). A bean named differently (e.g., clientServiceImpl) but of the correct type would still be returned.
C – False. The bean ID is not required as a method parameter. The Class
📚 References
Spring Framework 5.x API Documentation – BeanFactory.getBean(Class
“Return an instance, which may be shared or independent, of the specified bean. This method allows a Spring-style lookup by type.”
Spring Core Documentation – BeanFactory APIs:
“The getBean(Class) method is type-safe and resolves a single bean matching the given type, irrespective of the bean name.”
Refer to the exhibit.

Which statement is true? (Choose the best answer.)
A. CustomerRepository should be a class, not an interface.
B. JPA annotations are required on the Customer class to successfully use Spring Data JDBC.
C. An implementation of this repository can be automatically generated by Spring Data JPA.
D. A class that implements CustomerRepository must be implemented and declared as a Spring Bean.
Explanation:
CustomerRepository extends CrudRepository
❌ Why other options are incorrect:
A – False. In Spring Data, repositories must be interfaces. Concrete classes are not supported for automatic proxy generation. The interface is the correct design.
B – False. For Spring Data JDBC specifically, JPA annotations (like @Entity, @Id) are not required. Spring Data JDBC uses its own lightweight persistence model (e.g., @Id from Spring Data Commons, not JPA). JPA annotations are optional or irrelevant here.
D – False. No manual implementation class is needed. Spring Data generates the implementation automatically at runtime and registers it as a Spring bean. Writing a custom implementation would defeat the purpose of Spring Data.
📚 References
Spring Data JPA Documentation – "Using Repositories":
“Spring Data JPA provides an implementation of the repository interface automatically. You only need to write the interface definition.”
Spring Data Commons – CrudRepository JavaDoc:
“Central interface in Spring Data repository abstraction. Implemented by Spring Data modules automatically at runtime.”
Which three dependencies are provided by the spring-boot-starter-test? (Choose three.)
A. Cucumber
B. Hamcrest
C. spring-test
D. Junit
E. EasyMock
F. PowerMock
Explanation
The spring-boot-starter-test starter POM is designed to provide a comprehensive set of testing libraries for Spring Boot applications. According to the official Spring Boot documentation, this starter includes JUnit, Spring Test & Spring Boot Test, AssertJ, Hamcrest, Mockito, JSONassert, JsonPath, and Awaitility .
B. Hamcrest – Included as a library of matcher objects (constraints or predicates) that allow expressive assertThat style assertions in tests .
C. spring-test – Included as part of Spring Test & Spring Boot Test modules, providing utilities and integration test support for Spring applications .
D. Junit – JUnit 5 (JUnit Jupiter) is included as the de-facto standard for unit testing Java applications. The starter also includes the vintage engine for backward compatibility with JUnit 4 tests .
❌ Why other options are incorrect:
A. Cucumber – Not included in spring-boot-starter-test. Cucumber is a separate BDD (Behavior-Driven Development) framework that must be added as an explicit dependency if needed.
E. EasyMock – Not included. While spring-boot-starter-test provides Mockito as its mocking framework, EasyMock is a different mocking library that requires a separate dependency .
F. PowerMock – Not included. PowerMock is an advanced mocking framework that extends other mocking libraries like Mockito or EasyMock. It is not part of the starter and must be added separately.
📚 Valid References
Spring Boot Official Documentation – "Test Scope Dependencies":
"The spring-boot-starter-test starter (in the test scope) contains the following provided libraries: JUnit 5, Spring Test & Spring Boot Test, AssertJ, Hamcrest, Mockito, JSONassert, JsonPath, Awaitility"
Spring Boot Reference Guide (1.2.1.RELEASE) – Section 35.1:
"If you use the spring-boot-starter-test 'Starter POM', you will find the following provided libraries: Spring Test, JUnit, Hamcrest and Mockito"
Refer to the exhibit.

AppConfig is a Java configuration class. Which two statements are true? (Choose two.)
A. The clientService bean declared will have prototype scope by default.
B. The name of the clientService() method is invalid and will throw an error.
C. The clientService bean will be lazy initialized the first time accessed.
D. The bean is of type clientService and by default will be a Singleton.
E. The Java configuration can be profile specific by adding a @Profile annotation.
Explanation:
Bean Type and Scope (Option D):
The method signature returns a ClientService object, making that the registered bean type. In Spring, all beans declared via the @Bean annotation default to singleton scope. The IoC container creates exactly one instance, caching it for all subsequent requests during the application lifecycle.
Profile Configuration (Option E):
The @Profile annotation can be placed at the class level of a @Configuration class (or directly on @Bean methods). This instructs Spring to only register these beans when the specified environment profile (e.g., dev, prod) is active.
Why the Other Options Are Incorrect
A is incorrect:
Spring beans are singletons by default. A prototype scope (which creates a new instance every time the bean is requested) must be explicitly configured using @Scope("prototype").
B is incorrect:
The method name clientService() is perfectly valid. In Spring Java configuration, the method name serves automatically as the default bean identifier (id).
C is incorrect:
Singleton beans are eagerly initialized at application startup to catch configuration errors early. To make a bean initialize only when first requested, you must explicitly annotate it with @Lazy.
References
Spring Framework Core Documentation: Section 1.12.1: Declaring a Bean – States that the return type dictates the bean type and the method name serves as the bean ID.
Spring Framework Core Documentation: Section 1.5: Bean Scopes – Confirms that the singleton scope is the default fallback for all Spring beans.
Refer to the exhibit.

What statement is true about @DirtiesContext?
A. It will close the existing cached ApplicationContext and recreate a new one before the test method.
B. It will close the existing cached ApplicationContext and recreate a new one after the test method.
C. It will keep the existing cached ApplicationContext, all changes to Spring managed beans will be reverted after the test.
D. It will recreate only the Spring managed beans that are modified inside the test method.
Explanation:
@DirtiesContext is a Spring Test annotation that indicates the ApplicationContext should be marked as "dirty" after the test method (or test class) has been executed. When a context is dirty, Spring Test will close the existing cached ApplicationContext and recreate a new one for any subsequent tests that require a fresh context.
By default, @DirtiesContext recreates the context after the test method runs. This ensures that any side effects from the test (e.g., modified beans, changed database state, altered system properties) do not leak into other tests that share the same context.
❌ Why other options are incorrect:
A – False.Before the test method is too early. The default behavior is after the test method, not before. However, @DirtiesContext(methodMode = BEFORE_METHOD) exists as an option, but the default (and most common usage) is after.
C – False. @DirtiesContext does not revert changes within the same context. Instead, it discards the entire context and creates a new one. Reverting changes without recreation is not how this annotation works.
D – False. Spring does not selectively recreate only modified beans. The entire ApplicationContext is closed and rebuilt, which is more expensive but guarantees a completely fresh state.
📚 References
Spring Framework Testing Documentation – @DirtiesContext:
“Annotation indicating that the ApplicationContext associated with a test is dirty and should be closed. It will be removed from the context cache and recreated for subsequent tests.”
Spring Test Context Framework – Context caching:
“By default, the context is marked dirty after the test method. The next test requiring a context of the same configuration will trigger a new context to be built.”
Which two statements are true about Spring AOP? (Choose two.)
A. The @After advice type is invoked regardless of whether a method successfully returned or an exception was thrown.
B. In Spring AOP, a join point represents a method execution or property access.
C. Spring AOP does not use AspectJ's pointcut expression language.
D. Examples of cross-cutting concerns include security, caching, transaction.
E. There are in total 4 types of advice, @Before, @After, @AfterReturning and @AfterThrowing.
Explanation
@After Advice Behavior (Option A):
Often referred to as "after (finally)" advice, @After mirrors a standard Java finally block. It executes immediately after a matched method completes its runtime execution, whether that completion is a normal return or an abrupt exit due to an uncaught exception.
Cross-Cutting Concerns (Option D):
These represent system-wide auxiliary functionalities that span across multiple, distinct layers of an application. Instead of duplicating logic like security checks, performance caching, or database transaction management inside every business service method, Aspect-Oriented Programming (AOP) modularizes them into clean, reusable aspects.
Why the Other Options Are Incorrect
B is incorrect:
Spring AOP utilizes a pure proxy-based architecture, meaning it only supports method execution join points. Property/field access interception is not supported by Spring AOP (it requires a full AspectJ framework setup).
C is incorrect:
Spring AOP integrates and directly uses AspectJ's pointcut expression language parser for matching pointcuts. It uses annotations like @Pointcut("execution(...)" directly out of the box.
E is incorrect:
There are 5 types of advice in Spring AOP, not 4. The missing type is @Around, which is the most powerful advice type capable of wrapping around the entire target method execution.
References
Spring Framework Documentation: Core Technologies - Aspect Oriented Programming with Spring:
Section 5.2.1 (AOP Concepts): Outlines the 5 advice types (including Around) and defines cross-cutting concerns.
| Page 1 out of 10 Pages |
| 123 |