2V0-72.22 Exam Dumps, 2V0-72.22 Practice Test Questions [Q32-Q56]

Share

2V0-72.22 Exam Dumps, 2V0-72.22 Practice Test Questions

PDF (New 2025) Actual VMware 2V0-72.22 Exam Questions

NEW QUESTION # 32
Which two use cases can be addressed by the method level security annotation @PreAuthorize? (Choose two.)

  • A. Allow access to a method based on roles.
  • B. Allow access to a method based on the returned object.
  • C. Allow access to a method based on user identity.
  • D. Allow access to a method based on HTTP method.
  • E. Allow access to a method based on request URL.

Answer: A,C

Explanation:
A . Allow access to a method based on user identity.
This is true because the @PreAuthorize annotation can use the principal object to access the user identity and check if it matches a certain condition. For example, we can use the following expression to allow access only to the user with the username "admin":
@PreAuthorize("principal.username == 'admin'")
E . Allow access to a method based on roles.
This is true because the @PreAuthorize annotation can use the hasRole, hasAnyRole, or hasAuthority methods to check if the user has a certain role or authority. For example, we can use the following expression to allow access only to users who have the role "ADMIN" or "USER":
@PreAuthorize("hasAnyRole('ADMIN', 'USER')")


NEW QUESTION # 33
Which two statements are correct regarding Spring Boot auto-configuration customization? (Choose two.)

  • A. Use the @AutoConfigureAfter or @AutoConfigureBefore annotations to apply configuration in a specific order.
  • B. Provide customized auto-configuration by subclassing the provided Spring Boot auto-configuration classes.
  • C. Control the order of auto-configuration classes applied with @AutoConfigureOrder.
  • D. Disable specific auto-configuration classes by using the exclude attribute on the
    @EnableAutoConfiguation annotation.
  • E. Enable component scanning within auto-configuration classes to find necessary components.

Answer: A,D

Explanation:
Section: (none)
Explanation


NEW QUESTION # 34
Which two statements are correct regarding Spring Boot 2.x Actuator Metrics? (Choose two.)

  • A. The metrics endpoint /actuator/metrics is exposed over HTTP by default.
  • B. Custom metrics can be measured using Meter primitives such as Counter, Gauge, Timer, and DistributionSummary.
  • C. Timer measures both the number of timed events and the total time of all events timed.
  • D. An external monitoring system must be used with Actuator.
  • E. A metric must be created with one or more tags.

Answer: B,C

Explanation:
Custom metrics can be measured using Meter primitives such as Counter, Gauge, Timer, and DistributionSummary: Spring Boot Actuator Metrics allows you to define and measure custom metrics using various Meter primitives. These primitives include Counter (counting occurrences), Gauge (providing a current value), Timer (measuring the time taken for a task), and DistributionSummary (collecting and summarizing distribution statistics).


NEW QUESTION # 35
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.)

  • A. There are 2 transactions because REQUIRES_NEW always runs in a new transaction.
  • B. An exception is thrown as another transaction cannot be started within an existing transaction.
  • C. There is only one transaction initiated by update1() because the call to update2() does not go through the proxy.
  • D. There is only one transaction because REQUIRES_NEW will use an active transaction if one already exists.

Answer: C


NEW QUESTION # 36
Which following statements are true about Spring Data? (Choose two.)

  • A. Spring Data works by applying the JPA annotations to data stores such as MongoDB, Neo4j, and Redis.
  • B. Spring Data is specifically designed for JPA, JDBC, and relational database access only.
  • C. Spring Data cannot be used together with Spring MVC.
  • D. Spring Data implementations exist for many data storage types, such as MongoDB, Neo4j, and Redis.
  • E. Spring Data can greatly reduce the amount of "boilerplate" code typically needed for data access.

Answer: B,E


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

  • A. @EntityScan and spring.jpa.* properties can be used to customize Spring Data JPA.
  • B. Any kind of Hibernate property can be passed to Spring Data JPA like spring.jpa.properties.xxx.
  • C. Scanning of JPA Entities can not be customized, the whole classpath is scanned.
  • D. Embedded Databases (H2, HSQLDB, Derby) are not re-created during the startup.
  • E. Spring Data JPA is the only implementation for relational databases.

Answer: A,B

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


NEW QUESTION # 38
Which two statements are correct regarding the Health Indicator status? (Choose two.)

  • A. Custom status values can be created.
  • B. The status with the least severity is used as the top-level status.
  • C. The built-in status values are DOWN, OUT_OF_SERVICE, UNKNOWN, and UP in decreasing order of severity.
  • D. The last status in a sorted list of HealthIndicators is used to derive the final system health.
  • E. The severity order cannot be changed due to security reasons.

Answer: A,C


NEW QUESTION # 39
In which three ways are Security filters used in Spring Security? (Choose three.)

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

Answer: A,B,F


NEW QUESTION # 40
Refer to the exhibit.

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

  • A. JPA annotations are required on the Customer class to successfully use Spring Data JDBC.
  • B. An implementation of this repository can be automatically generated by Spring Data JPA.
  • C. CustomerRepository should be a class, not an interface.
  • D. A class that implements CustomerRepository must be implemented and declared as a Spring Bean.

Answer: B


NEW QUESTION # 41
Which two statements are true concerning constructor injection? (Choose two.)

  • A. If there is only one constructor the @Autowired annotation is not required.
  • B. Constructor injection only allows one value to be injected.
  • C. Construction injection can be used with multiple constructors without @Autowired annotation.
  • D. Field injection is preferred over constructor injection from a unit testing standpoint.
  • E. Constructor injection is preferred over field injection to support unit testing.

Answer: D,E


NEW QUESTION # 42
Which two annotations are meta-annotations on the @SpringBootApplication composed annotation? (Choose two.)

  • A. @Configuration
  • B. @SpringBootConfiguration
  • C. @ComponentScan
  • D. @SpringApplication
  • E. @AutoConfiguration

Answer: A,C

Explanation:
A . @Configuration This annotation indicates that the class has @Bean definition methods and may be processed by the Spring container to generate bean definitions and service requests for those beans at runtime. B. @ComponentScan This annotation configures component scanning directives for use with @Configuration classes. Provides support parallel with Spring XML's context:component-scan element.


NEW QUESTION # 43
Refer to the exhibit.

Based on the default Spring behavior, choose the correct answer. (Choose the best answer.)

  • A. Two AccountRepository beans will be instantiated as the accountRepository() method will be called two times.
  • B. One AccountRepository bean will be instantiated since the default scope is singleton.
  • C. Three AccountRepository beans will be instantiated as the accountRepository() method will be called three times.
  • D. Many AccountRepository beans will be instantiated, depending how often accountRepository(), transferService() and accountService() are called.

Answer: D


NEW QUESTION # 44
Which two statements about pointcut expressions are true? (Choose two.)

  • A. A pointcut expression will throw an exception if no methods are matched.
  • B. A pointcut expression cannot have a wildcard for a method name.
  • C. A pointcut expression can include operators such as the following: && (and), || (or), ! (not).
  • D. A pointcut expression cannot specify the type of parameters.
  • E. A pointcut expression can be used to select join points which have been annotated with a specific annotation.

Answer: C,E


NEW QUESTION # 45
Which two statements are correct regarding the Actuator info endpoint? (Choose two.)

  • A. It can be used to display arbitrary application information.
  • B. It can be used to change a property value on a running application.
  • C. It is not enabled by default.
  • D. Typically it is used to display build or source control information.
  • E. It provides configuration options through which only an authenticated user can display application information.

Answer: A,C


NEW QUESTION # 46
Which option is true about use of mocks in a Spring Boot web slice test? (Choose the best answer.)

  • A. Mocking a Spring Bean requires annotating it with @MockBean annotation.
  • B. Mocking a Spring Bean requires annotating it with @Mock annotation.
  • C. Mocks cannot be used in a Spring Boot web slice test.
  • D. If a Spring Bean already exists in the web slice test spring context, it cannot be mocked.

Answer: A


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

  • A. @Value must be used for environment variables, as @ConfigurationProperties cannot access the environment.
  • B. @ConfigurationProperties supports relaxed binding of properties, but not property binding through SpEL.
  • C. @ConfigurationProperties is preferable over @Value when type-safety during property binding is a concern.
  • D. @ConfigurationProperties only bind properties from .properties files, not from .yml files.
  • E. @Value supports relaxed binding of properties, but not property binding through SpEL.

Answer: B,C

Explanation:
https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#features.external-config.typesafe-configuration-properties.vs-value-annotation


NEW QUESTION # 48
Which statement is true about the @PropertySource annotation? (Choose the best answer.)

  • A. Used to designate the location of the application.properties file in a Spring Boot application.
  • B. Used to add a set of name/value pairs to the Spring Environment from an external source.
  • C. Used to easily look up and return a single property value from some external property file.
  • D. Used to designate the file directory of the application.properties file in a Spring Boot application.

Answer: B

Explanation:
This is true because the @PropertySource annotation provides a convenient and declarative mechanism for adding a PropertySource to Spring's Environment. A PropertySource is an abstraction for a source of name/value pairs that can be used by the Environment to resolve properties. The @PropertySource annotation can be used to load properties from an external file, such as a .properties or .yml file, and make them available to the application context.
https://docs.spring.io/spring-framework/reference/core/beans/environment.html#beans-using-propertysource


NEW QUESTION # 49
Which three statements are advantages of using Spring's Dependency Injection? (Choose three.)

  • A. Dependency injection facilitates loose coupling between components.
  • B. Dependency injection creates tight coupling between components.
  • C. Configuration can be externalized and centralized in a small set of files.
  • D. Dependency injection can make code easier to trace because it couples behavior with construction.
  • E. Dependency injection reduces the start-up time of an application.
  • F. Dependencies between application components can be managed external to the components.

Answer: A,C,F

Explanation:
C . Dependencies between application components can be managed external to the components.
This is true because dependency injection allows the application components to declare their dependencies without creating or obtaining them directly. Instead, the dependencies are provided by an external entity, such as the Spring container, which can read the configuration from XML files, annotations, or Java code1.
D . Configuration can be externalized and centralized in a small set of files.
This is true because dependency injection enables the separation of concerns between the application logic and the configuration. The configuration can be stored in a small number of files that can be easily changed without affecting the source code2.
F . Dependency injection facilitates loose coupling between components.
This is true because dependency injection reduces the direct dependencies between components, making them more reusable and testable. It also allows for easier substitution of different implementations of the same interface3.


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

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

Answer: D


NEW QUESTION # 51
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. The @Bean annotation should be removed.
  • B. @ConditionalOnBean(name= "dataSource") should be replaced with @ConditionalOnBean (DataSource.class) for greater flexibility.
  • C. A JdbcTemplate bean will be created when a bean named dataSource has already been created.
  • D. A JdbcTemplate bean will be created when the DataSource class is in the classpath but there is no DataSource bean.
  • E. @ConditionalOnBean(name= "dataSource") should be replaced with
    @ConditionalOnMissingBean (DataSource.class) for greater flexibility.

Answer: B,D


NEW QUESTION # 52
Which two statements are true regarding storing user details in Spring Security? (Choose two.)

  • A. The user details includes username and password but not authorities.
  • B. Passwords must be hashed and the default hashing algorithm is MD5.
  • C. With a custom UserDetailsService defined in the ApplicationContext, Spring Boot still creates the default user.
  • D. User details can be stored in custom storage and retrieve them by implementing the UserDetailsService interface.
  • E. User details can be stored in a database, in LDAP, or in-memory.

Answer: D,E


NEW QUESTION # 53
Which three types of objects can be returned form a JdbcTemplate query? (Choose three.)

  • A. User defined types
  • B. Generic MapS
  • C. XMLObject
  • D. Properties
  • E. JSONObject
  • F. Simple types (int, long, String, etc)

Answer: A,D,F


NEW QUESTION # 54
Which two options are application slices that can be tested with Spring Boot Testing? (Choose two.)

  • A. Client
  • B. Repository
  • C. Web
  • D. Container
  • E. Messaging

Answer: B,C

Explanation:
https://www.diffblue.com/blog/java/software%20development/testing/spring-boot-test-slices-overview-and-usage/


NEW QUESTION # 55
Which two statements are true about @Controller annotated classes? (Choose two.)

  • A. @Controller is interchangeable with @RestController with no extra code changes for the methods inside the class.
  • B. The classes are eligible for handling requests in Spring MVC.
  • C. The classes must be annotated together with @EnableMvcMappings to be discovered via component scanning.
  • D. The @Controller annotated classes can only render views.
  • E. The @Controller annotation is a stereotype annotation like @Component.

Answer: B,E

Explanation:
B . The classes are eligible for handling requests in Spring MVC.
This is true because the @Controller annotation marks a class as a web request handler, and it is typically used with the @RequestMapping annotation to map specific URLs to methods1. The @Controller annotation also allows the class to be recognized as a Spring-managed component through the classpath scanning2.
E . The @Controller annotation is a stereotype annotation like @Component.
This is true because the @Controller annotation is a specialization of the generic stereotype @Component annotation, which allows a class to be recognized as a Spring-managed component3. The @Controller annotation extends the use-case of @Component and marks the annotated class as a business or presentation layer4.


NEW QUESTION # 56
......

Updated Dec-2025 Pass 2V0-72.22 Exam - Real Practice Test Questions: https://www.pass4surequiz.com/2V0-72.22-exam-quiz.html

Dumps Moneyack Guarantee - 2V0-72.22 Dumps UpTo 90% Off: https://drive.google.com/open?id=1eblezRysJulGoEUMs1IioqIGyQBHk8lU