Exam Information
Free practice questions with explanations
VMware 2V0-72.22 Practice Questions
Answer a question to see the correct answer and the explanation, or click Show answer. Newest questions first.
- Questions
- 14
- Answered
- 0
- Correct
- 0
- Score
- -
-
1 Question 1 Single choice Data Management
A retail company runs an order-processing service on Spring Boot with JdbcTemplate. A method debits a customer account and then inserts an order row. Under peak load, a deadlock occurs in the inserts and the framework throws a database-specific exception. The team wants callers to handle failures uniformly without parsing vendor error codes, and wants the original SQLException preserved for diagnostics. Which approach best meets these requirements?
Correct Answer: BExplanationJdbcTemplate translates vendor-specific SQLException instances into Spring's unchecked DataAccessException hierarchy through its SQLExceptionTranslator, so callers can handle failures without knowing the database vendor, and the translated exception keeps the original SQLException as its cause for diagnostics. Catching and rethrowing as a generic RuntimeException discards the translation and forces string parsing. Returning null hides the deadlock and makes failures silent. Abandoning JdbcTemplate for raw connections reintroduces the boilerplate and vendor coupling the team is trying to remove.
-
2 Question 2 Drag and drop Spring Core
A platform team maintains a Spring application where a PaymentGateway bean must open a connection pool only once the context starts and release it cleanly when the context closes, and a ReportCache bean must be created lazily on first use. Match each requirement to the mechanism that satisfies it.
Drag each item onto its matching target. On a phone: tap an item, then tap a target.
Release pooled connections cleanly when the context shuts downDefer creation of the ReportCache bean until it is first requestedRun initialisation logic after dependency injection completesMark the bean definition with @LazyRegister a Java configuration class with @ProfileAnnotate a method with @PreDestroyAnnotate a method with @PostConstructDeclare the bean with prototype scopeCorrect Answer:- Release pooled connections cleanly when the context shuts down → Annotate a method with @PreDestroy
- Defer creation of the ReportCache bean until it is first requested → Mark the bean definition with @Lazy
- Run initialisation logic after dependency injection completes → Annotate a method with @PostConstruct
Explanation@PreDestroy methods run during context shutdown, which is the right hook for releasing resources, while @PostConstruct runs after dependencies are injected and suits opening the pool. @Lazy delays bean instantiation until first injection or lookup, which matches the lazy cache requirement. Prototype scope creates a new instance on each request rather than deferring a singleton's creation, and @Profile controls activation by environment rather than timing, so neither fits the lifecycle requirements.
-
3 Question 3 Single choice Security
A healthcare SaaS provider exposes a Spring Boot REST API for clinicians. Requirements state that only users with the CLINICIAN role may read patient records, and that a service method updating medication orders must reject callers who lack the PHYSICIAN authority even if the request passes URL-level filtering. Engineers have already configured HttpSecurity with authorizeHttpRequests. Which additional change most directly enforces the service-layer requirement?
Correct Answer: CExplanationMethod-level security in Spring Security is activated with @EnableMethodSecurity, and @PreAuthorize with a SpEL expression checks authorities before the service method executes, regardless of how the call arrived. URL-level rules in HttpSecurity never see internal service calls, so they cannot satisfy the requirement. @EnableWebSecurity belongs on the web configuration rather than the controller, and @Secured checks a role name rather than the PHYSICIAN authority the rule demands. A servlet filter trusting a header is spoofable and bypassed by internal callers, and a default user property does not authorise real clinicians.
-
4 Question 4 Order list Spring Boot
A team needs to add a custom health indicator that reports whether a third-party inventory API responds within a timeout, and to expose it only on the management port while keeping the main application port free of actuator endpoints. The application is a Spring Boot 2.x service. Arrange the steps in the correct order.
Drag the steps into the correct order, or use the arrows.
- Add spring-boot-starter-actuator to the pom.xml dependencies
- Include health in management.endpoints.web.exposure.include
- Restart the application and verify the health endpoint on the management port
- Set management.server.port to a separate port number in application.properties
- Implement HealthIndicator in a @Component class that calls the inventory API and returns Health.up or Health.down
Correct Answer:- Set management.server.port to a separate port number in application.properties
- Implement HealthIndicator in a @Component class that calls the inventory API and returns Health.up or Health.down
- Add spring-boot-starter-actuator to the pom.xml dependencies
- Include health in management.endpoints.web.exposure.include
- Restart the application and verify the health endpoint on the management port
ExplanationThe actuator starter must be added first so its auto-configuration and endpoint infrastructure exist. The custom HealthIndicator is then implemented, which is picked up by component scanning and contributes to the health endpoint. Exposure of the health endpoint is configured next, then the management port is separated so actuator traffic stays off the main port, and finally the application is restarted to verify the change. Setting the port before the dependency exists would have no effect, and verifying before restart would show stale configuration.
-
5 Question 5 Multiple choice Testing
A team maintains a Spring Boot application with a JPA repository backed by PostgreSQL. Their current test suite loads the full application context for every controller test, making the build slow. They want fast controller tests that verify JSON serialisation and HTTP status codes without starting the database layer, and they want the database-backed repository test to run against a real PostgreSQL instance rather than an embedded substitute. Which two actions together meet these requirements? (Choose two.)
Correct Answer: A, BExplanation@WebMvcTest is a slice test that loads only the web layer, which keeps controller tests fast while MockMvc checks serialisation and status codes. @DataJpaTest loads only the JPA layer, and by default it replaces the DataSource with an embedded database; setting replace to NONE keeps the real PostgreSQL configuration, which a Testcontainers instance can supply. A full @SpringBootTest with random port stays slow, and the default H2 replacement contradicts the real PostgreSQL requirement. Mocking the repository inside a full context still pays the full startup cost.
-
6 Question 6 Dropdown Spring Core
A developer is configuring a Spring Boot service that reads a feature flag from application-prod.properties. The flag must be injected into a field of a component using the Spring Expression Language, and the component must only be created when the prod profile is active. Complete the annotations by selecting the correct value for each blank.
Choose the correct value for each blank.
@Component
@("prod")
public class FeatureService {
@Value("")
private boolean enabled;
}Correct Answer:@Component
@Profile("prod")
public class FeatureService {
@Value("${feature.enabled}")
private boolean enabled;
}ExplanationThe @Profile annotation restricts bean registration to the named profile, which matches the requirement that the component exists only in prod. The placeholder syntax ${...} resolves a property from the environment, which is how an externalised property from application-prod.properties is injected. The SpEL form #{...} evaluates an expression rather than reading a property key, so it would not map the flag directly, and @Conditional requires a custom Condition class rather than a profile name.
-
7 Question 7 Single choice Data Management
A billing service uses Spring Data JPA. A method createInvoice calls chargeCustomer, which is annotated @Transactional with the default REQUIRED propagation, and then writes an audit record. Requirements state that the audit record must be persisted even if chargeCustomer throws a RuntimeException, and the charge must roll back in that case. Which configuration on the audit method meets this?
Correct Answer: CExplanationREQUIRES_NEW suspends the outer transaction and runs writeAudit in an independent transaction that commits separately, so the audit survives a rollback of the charge. The charge itself rolls back because a RuntimeException propagates out of chargeCustomer's transactional boundary. MANDATORY would join the existing transaction and roll the audit back with it, and NEVER throws if a transaction is active. SUPPORTS joins whatever exists and offers no independence, so removing the outer transaction also breaks the charge rollback requirement.
-
8 Question 8 Drag and drop Spring MVC
A payments team exposes a REST API built with Spring MVC on Spring Boot. Each requirement below calls for a specific annotation or client component. Match each requirement to the component that satisfies it.
Drag each item onto its matching target. On a phone: tap an item, then tap a target.
Handle an HTTP DELETE request to remove a resource by identifierSerialise a returned Java object into a JSON response bodyInvoke a downstream REST service from a service class@RequestParam on a controller methodRestTemplate bean with exchange or getForObject@ConfigurationProperties on a configuration class@DeleteMapping on a controller method@RestController with the object returned from the handlerCorrect Answer:- Handle an HTTP DELETE request to remove a resource by identifier → @DeleteMapping on a controller method
- Serialise a returned Java object into a JSON response body → @RestController with the object returned from the handler
- Invoke a downstream REST service from a service class → RestTemplate bean with exchange or getForObject
Explanation@DeleteMapping maps an HTTP DELETE verb to a handler method, and @RestController combines @Controller with response-body marshalling so returned objects become JSON. RestTemplate is the client abstraction used to call remote RESTful services from application code. @RequestParam binds query parameters rather than routing verbs, and @ConfigurationProperties binds external properties, so neither satisfies the stated requirements.
-
9 Question 9 Single choice Spring Boot
A team runs a Spring Boot 2.x service in three environments. A default port of 8080 is hard-coded in application.properties. The operations team needs the production deployment to listen on 9090 without rebuilding the artifact, and development must keep 8080. The build produces a single jar that is promoted through all environments unchanged. Which approach best meets this?
Correct Answer: CExplanationSpring Boot externalised configuration gives command-line arguments the highest precedence among property sources, so --server.port=9090 overrides the packaged default without touching the jar, preserving the promote-unchanged rule. Editing properties inside the jar violates the immutability requirement and is fragile. A separate production build breaks the single-artifact promotion constraint. Setting an environment variable only in the build pipeline does not reach the running production process.
-
10 Question 10 Multiple choice Spring Core
A team is refactoring a Spring Boot application that currently uses XML bean definitions. The new design should use Java configuration for the data layer, while keeping one legacy XML file that defines a third-party bean they cannot modify. They need the context to load both sources and to ensure the Java configuration beans can depend on the XML-defined bean. Which two actions together meet this? (Choose two.)
Correct Answer: D, EExplanation@ImportResource loads the legacy XML definitions into the same application context alongside the Java configuration, which satisfies the requirement to load both sources. Declaring the dependency as a @Bean method parameter lets Spring resolve the XML-defined bean from the context, which handles the inter-bean dependency. @Import expects another configuration class rather than an XML file, copying the bean is impossible because the team cannot modify the third-party bean, and @Primary only resolves ambiguity among candidates without loading anything.
-
11 Question 11 Single choice Spring Boot
A microservice uses Spring Boot Actuator and exposes the metrics endpoint over HTTP. A security review requires that actuator endpoints other than health remain inaccessible to anonymous users, and that the metrics endpoint is available only to users holding the OPS role. Spring Security is already on the classpath with a custom SecurityFilterChain. Which configuration is the most appropriate?
Correct Answer: DExplanationEndpointRequest provides a Spring Security matcher that targets actuator endpoints by identity, so a rule can require the OPS role on metrics while others require authentication, which precisely matches the policy. Excluding metrics removes the endpoint entirely and does not implement role-based access. Disabling the endpoint and permitting all paths opens everything to anonymous users. Disabling security on a separate port is an exposure risk the review explicitly prohibits.
-
12 Question 12 Dropdown Testing
A team wants a JUnit 5 integration test for a Spring Boot service that must run under a test-specific profile so it picks up application-test.properties, and must roll back database changes after each test method. Complete the annotations by selecting the correct value for each blank.
Choose the correct value for each blank.
@SpringBootTest
@("test")
@
class OrderServiceIT {
}Correct Answer:@SpringBootTest
@ActiveProfiles("test")
@Transactional
class OrderServiceIT {
}Explanation@ActiveProfiles activates the named profile for the test context, so application-test.properties is loaded. Annotating the test class with @Transactional causes Spring's test framework to roll back each test method's transaction by default, which satisfies the cleanup requirement. @Profile is a bean-level annotation and does not activate profiles in tests, while @Rollback(false) and @Commit would keep changes, the opposite of what is required.
-
13 Question 13 Single choice Data Management
A reporting service uses Spring Data JPA with repositories for Customer and Order entities. A query method findByStatusAndRegion has become hard to read as criteria grow, and the team needs the query to be built from optional filters supplied at runtime. Their repository interface must remain free of hand-written SQL. Which approach is most appropriate?
Correct Answer: DExplanationJpaSpecificationExecutor allows dynamic, optional predicates composed into Specification objects at runtime, keeping the repository interface free of hand-written query text as required. Concatenating JPQL strings reintroduces the string-built queries and injection risk the team wants to avoid. Derived methods for every combination grow combinatorially and become unmaintainable. Replacing the repository with JdbcTemplate abandons Spring Data and the explicit requirement to keep the repository layer intact.
-
14 Question 14 Single choice Spring Core
A team defines a Spring singleton service that holds a reference to a stateful PaymentSession bean declared with prototype scope. Each call to processPayment should receive a fresh PaymentSession, but testing shows every call reuses the same instance. The service is injected with the session through a constructor parameter. Which change best fixes the behaviour without redesigning the service's public API?
Correct Answer: AExplanationA prototype bean injected once into a singleton is resolved only at injection time, so the singleton keeps one instance forever; ObjectProvider or a method-level lookup requests a fresh prototype each time it is called without changing the public API. Switching to singleton makes the sharing worse, not better. @Lazy delays initial creation but still yields one injected instance. Request scope only applies in a web request context and would not give a fresh instance per processPayment call from a background task.
These are 14 of the 79 questions in the full 2V0-72.22 pack.
Get All 79 QuestionsGet all 79 questions & answers
Full access options for VMware 2V0-72.22
Self-study
PDF Version
- 79 actual exam questions
- Compatible with all devices
- Printable PDF format
- No download limits
- 90 days free updates
- 24/7 customer support
Best value
Bundle Pack
- Discounted PDF + online access
- 79 actual exam questions
- Both PDF and online practice test
- Free 90 days updates
- No download or practice limits
- 24/7 customer support
Exam simulation
Online Practice Test
- 79 actual exam questions
- Actual exam environment
- 90 days free updates
- Browser-based software
- 24/7 customer support
100% Money Back Guarantee
Your success comes first
At DumpsProvider, we give you a 100% money back guarantee on all of our exam dumps. For us, your success is the #1 priority and we are more than confident that our exam material will help you pass the 2V0-72.22 Exam (Professional Develop VMware Spring) on your very first attempt.
In a rare case, if you fail your exam, we will refund your amount without asking a single question.