VMware 2v0-72-22 practice test

Exam Title: Professional Develop VMware Spring

Last update: Dec 25 ,2025
Question 1

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

  • A. spring-boot-devtools
  • B. spring-boot-initializr
  • C. spring-boot-starter-devtools
  • D. spring-boot-restart
Answer:

C


Explanation:
Spring Boot provides a set of tools for improving the development experience, such as automatic
restart, live reload, remote debugging, etc. These tools are included in the spring-boot-starter-
devtools dependency, which can be added to the project’s pom.xml or build.gradle file. The
automatic restart feature will monitor the classpath for changes and trigger a restart of the
application when necessary.

vote your answer:
A
B
C
D
A 0 B 0 C 0 D 0
Comments
Question 2

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

  • A. prototype
  • B. singleton
  • C. request
  • D. session
Answer:

B


Explanation:
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.
Reference: https://stackoverflow.com/questions/17599216/spring-bean-scopes

vote your answer:
A
B
C
D
A 0 B 0 C 0 D 0
Comments
Question 3

Refer to the exhibit.

Which option is a valid way to retrieve the account id? (Choose the best answer.)

  • A. Add @PathVariable(“id”) String accountId argument to the update() handler method.
  • B. Add @PathVariable long accountId argument to the update() handler method.
  • C. Add @RequestParam long accountId argument to the update() handler method.
  • D. Add @RequestParam(“id”) String accountId argument to the update() handler method.
Answer:

B


vote your answer:
A
B
C
D
A 0 B 0 C 0 D 0
Comments
Question 4

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.
Answer:

A


Explanation:
Spring Security provides a fluent API for configuring web security based on URL patterns and request
matchers. The authorizeRequests() method returns an expression that allows specifying access rules
for different URLs using methods such as antMatchers(), regexMatchers(), mvcMatchers(), etc. The
order of these rules matters, as they are evaluated from top to bottom. Therefore, it is
recommended to put the most specific rules first and the least specific ones last.
Reference: https://www.baeldung.com/security-none-filters-none-access-permitAll

vote your answer:
A
B
C
D
A 0 B 0 C 0 D 0
Comments
Question 5

In which three ways are Security filters used in Spring Security? (Choose three.)

  • A. To provide risk governance.
  • B. To drive authentication.
  • C. To manage application users.
  • D. To provide a logout capability.
  • E. To enforce authorization (access control).
  • F. To encrypt data.
Answer:

BDE


Explanation:
Spring Security uses a filter-based architecture to provide security services for web applications. A
filter is an object that intercepts HTTP requests and responses and performs some logic before or
after the request is processed by the servlet. Spring Security provides a number of filters for different
purposes, such as:
Authentication: Filters that handle the authentication process, such as
UsernamePasswordAuthenticationFilter, BasicAuthenticationFilter,
RememberMeAuthenticationFilter, etc.
User management: Filters that manage the user details and roles, such as
SecurityContextPersistenceFilter, AnonymousAuthenticationFilter, ConcurrentSessionFilter, etc.
Logout: Filters that handle the logout process, such as LogoutFilter and
SecurityContextLogoutHandler.
Authorization: Filters that enforce access control rules based on the user’s authentication and roles,
such as FilterSecurityInterceptor, ExceptionTranslationFilter, etc.
Reference: https://www.javadevjournal.com/spring-security/spring-security-filters/

vote your answer:
A
B
C
D
E
F
A 0 B 0 C 0 D 0 E 0 F 0
Comments
Question 6

Refer to the exhibit.

The above code shows a conditional @Bean method for the creation of a JdbcTemplate bean. Which
two statements correctly describe the code behavior? (Choose two.)

  • A. @ConditionalOnBean(name= “dataSource”) should be replaced with @ConditionalOnBean (DataSource.class) for greater flexibility.
  • B. @ConditionalOnBean(name= “dataSource”) should be replaced with @ConditionalOnMissingBean (DataSource.class) for greater flexibility.
  • C. The @Bean annotation should be removed.
  • D. A JdbcTemplate bean will be created when the DataSource class is in the classpath but there is no DataSource bean.
  • E. A JdbcTemplate bean will be created when a bean named dataSource has already been created.
Answer:

AE


Explanation:
The @Bean annotation is used to declare a method that returns an object that should be registered
as a bean in the application context. The @ConditionalOnBean annotation is used to specify a
condition for the bean creation based on the presence or absence of other beans in the application
context. The name attribute of this annotation can be used to specify the bean name or names that
must be present or absent for the condition to match. However, this approach is less flexible than
using the value or type attribute, which can specify the bean class or classes that must be present or
absent for the condition to match. Therefore, it is recommended to use
@ConditionalOnBean(DataSource.class) instead of @ConditionalOnBean(name= “dataSource”) for
greater flexibility.
The JdbcTemplate class is a Spring class that simplifies the use of JDBC and helps to avoid common
errors. It executes core JDBC workflow, leaving application code to provide SQL and extract results. To
create a JdbcTemplate object, we need to pass a DataSource object as a constructor argument. The
DataSource interface is a Java interface that represents a factory of connection objects. In this code,
the jdbcTemplate() method takes a DataSource object as a parameter and returns a new
JdbcTemplate object. This method is annotated with @Bean and @ConditionalOnBean(name=
“dataSource”), which means that it will only create a JdbcTemplate bean when there is already a
bean named dataSource in the application context.

vote your answer:
A
B
C
D
E
A 0 B 0 C 0 D 0 E 0
Comments
Question 7

What is a Spring Boot starter dependency? (Choose the best answer.)

  • A. A setting for specifying which code you want Spring Boot to generate for you.
  • B. A specific POM which you must build to control Spring Boot’s opinionated runtime.
  • C. A pre-existing model project you can download and use as the basis of your project.
  • D. An easy way to include multiple, coordinated dependencies related to a specific technology, like web or JDBC.
Answer:

D


Explanation:
A Spring Boot starter dependency is a special type of dependency that provides a convenient way to
add multiple, coordinated dependencies related to a specific technology or feature, such as web,
JDBC, security, etc. A starter dependency usually has a name that starts with spring-boot-starter-
followed by the name of the technology or feature. For example, spring-boot-starter-web is a starter
dependency that includes all the dependencies needed for creating web applications with Spring
MVC and RESTful services.
Reference: https://developer.ibm.com/tutorials/j-spring-boot-basics-perry/

vote your answer:
A
B
C
D
A 0 B 0 C 0 D 0
Comments
Question 8

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

  • A. Add @EnableTransactionManagement to a Java configuration class.
  • B. Annotate a class, an interface, or individual methods requiring a transaction with the @Transactional annotation.
  • C. A class must be annotated with @Service and @Transaction.
  • D. A class requiring a transaction must implement the TransactionInterceptor interface.
  • E. Write a Spring AOP advice to implement transactional behavior.
Answer:

AB


Explanation:
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 or
tx: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.
Reference: 5
Reference: https://www.baeldung.com/transaction-configuration-with-jpa-and-spring

vote your answer:
A
B
C
D
E
A 0 B 0 C 0 D 0 E 0
Comments
Question 9

Which two statements are true regarding the RestTemplate class? (Choose two.)

  • A. It supports asynchronous non-blocking model.
  • B. It automatically supports sending and receiving Java objects.
  • C. It provides convenience methods for writing REST clients.
  • D. It provides convenience methods for writing REST services.
  • E. Sending an HTTP request with a custom header is not possible when using RestTemplate.
Answer:

BC


Explanation:
The RestTemplate class is a Spring class that provides an easy way to communicate with RESTful
web services from within an application. It offers several convenience methods for performing HTTP
requests and handling HTTP responses, such as getForObject(), postForEntity(), exchange(), etc. It
also supports automatic conversion of Java objects to and from JSON or XML using
HttpMessageConverter instances.
Reference: https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/client/RestTemplate.html

vote your answer:
A
B
C
D
E
A 0 B 0 C 0 D 0 E 0
Comments
Question 10

Which statement is true? (Choose the best answer.)

  • A. @ActiveProfiles is a class-level annotation that is used to instruct the Spring TestContext Framework to record all application events that are published in the ApplicationContext during the execution of a single test.
  • B. @ActiveProfiles is a class-level annotation that you can use to configure how the Spring TestContext Framework is bootstrapped.
  • C. @ActiveProfiles is a class-level annotation that you can use to configure the locations of properties files and inlined properties to be added to the set of PropertySources in the Environment for an ApplicationContext loaded for an integration test.
  • D. @ActiveProfiles is a class-level annotation that is used to declare which bean definition profiles should be active when loaded an ApplicationContext for an integration test.
Answer:

D


Explanation:
A bean definition profile is a named logical grouping of bean definitions that can be activated or
deactivated in different environments. For example, we can define different profiles for
development, testing, and production environments. Spring provides the @Profile annotation to
mark a bean definition or a configuration class as belonging to a specific profile. To activate a profile,
we can use the spring.profiles.active property or the ConfigurableEnvironment.setActiveProfiles()
method.
The @ActiveProfiles annotation is a class-level annotation that is used in conjunction with the Spring
TestContext Framework to declare which profiles should be active when loading an
ApplicationContext for an integration test. This annotation can be applied to any class annotated
with @ContextConfiguration or a meta-annotation that is composed of @ContextConfiguration.
Reference: https://docs.spring.io/spring-framework/docs/4.2.x/spring-framework-reference/html/integration-testing.html

vote your answer:
A
B
C
D
A 0 B 0 C 0 D 0
Comments
Page 1 out of 7
Viewing questions 1-10 out of 79
Go To
page 2