2V0-72.22 Updated Exam Dumps [2025] Practice Valid Exam Dumps Question [Q20-Q41]

Share

2V0-72.22 Updated Exam Dumps [2025] Practice Valid Exam Dumps Question

2V0-72.22 Sample with Accurate & Updated Questions

NEW QUESTION # 20
Which two statements are true regarding Spring Security? (Choose two.)

  • A. Access control can be configured at the method level.
  • B. Authentication data can be accessed using a variety of different mechanisms, including databases and LDAP.
  • C. A special Java Authentication and Authorization Service (JAAS) policy file needs to be configured.
  • D. In the authorization configuration, the usage of permitAll () allows bypassing Spring security completely.
  • E. It provides a strict implementation of the Java EE Security specification.

Answer: A,B

Explanation:
Spring Security is a framework that provides comprehensive security services for Java applications, such as authentication, authorization, encryption, session management, and more. One of its features is method security, which allows applying access control rules at the method level using annotations or XML configuration. Another feature is authentication, which is the process of verifying the identity of a user or a system. Spring Security supports various authentication mechanisms, such as username and password, tokens, certificates, etc., and can access authentication data from different sources, such as databases, LDAP directories, in-memory stores, etc.


NEW QUESTION # 21
Refer to the exhibit.

Which two statements are correct regarding the HelloAutoConfig auto-configuration class when it is specified in the META-INF/spring.factories file? (Choose two.)

  • A. This auto-configuration class is used only when the HelloService.class is on the classpath.
  • B. A HelloService bean will be created from the helloService() method only when there is no other HelloService bean in the ApplicationContext.
  • C. This auto-configuration class is used only when the HelloService.class is not on the classpath.
  • D. A HelloService bean will be created from the helloService() method even if the HelloService.class is not in the classpath.
  • E. A HelloService bean will be created from the helloService() method and will replace existing a HelloService bean in the ApplicationContext.

Answer: A,B


NEW QUESTION # 22
Which two statements about the @Autowired annotation are true? (Choose two.)

  • A. @Autowired fields are injected after any config methods are invoked.
  • B. If @Autowired is used on a class, field injection is automatically performed for all dependencies.
  • C. Multiple arguments can be injected into a single method using @Autowired.
  • D. By default, if a dependency cannot be satisfied with @Autowired, Spring throws a RuntimeException.
  • E. @Autowired can be used to inject references into BeanPostProcessor and

Answer: C,E

Explanation:
BeanFactoryPostProcessor.


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

  • A. The "fat" JAR contains compiled classes and dependencies that your code needs to run.
  • B. The "fat" JAR contains both the class files and the source files for your project.
  • C. The "fat" JAR is created by the Spring Boot Maven plugin or Gradle plugin.
  • D. The "fat" JAR can contain multiple embedded application servers.
  • E. The "fat" JAR requires an external Servlet container.

Answer: A,C


NEW QUESTION # 24
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 least specific rule first and the most specific last.
  • B. The URLs can be specified via configuration (using authorizeRequests () and request matchers), with the most specific rule first and the least specific last.
  • C. The URLs are specified in a special properties file, used by Spring Security.
  • D. Spring Security can obtain URLs from Spring MVC controllers, the Spring Security configuration just needs a reference to the controller to be protected.

Answer: B

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.


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

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

Answer: D

Explanation:
A web slice test is a type of test in Spring Boot that focuses on testing only the web layer of an application, without starting a full server or requiring a real database. To isolate the web layer from other dependencies, such as services or repositories, mocks can be used to simulate their behavior and return predefined responses. To create and inject a mock for an existing bean in the application context, the @MockBean annotation can be used on a field or a parameter in the test class. This annotation will replace any existing bean of the same type with a mock created by Mockito.


NEW QUESTION # 26
Which two statements are true about REST? (Choose two.)

  • A. REST is Interoperable.
  • B. REST is Relative.
  • C. REST is Stateful.
  • D. REST is a Protocol.
  • E. REST is Reliable.

Answer: A,D


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

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

Answer: A,D


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

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

Answer: A


NEW QUESTION # 29
If a class is annotated with @Component, what should be done to have Spring automatically detect the annotated class and load it as a bean? (Choose the best answer.)

  • A. Ensure a valid @Scope for the class is specified.
  • B. Ensure a valid @Bean for the class is specified.
  • C. Ensure a valid @ComponentScan annotation in the Java configuration is specified.
  • D. Ensure a valid bean name in the @Component annotation is specified.

Answer: C

Explanation:
The @Component annotation indicates that a class is a candidate for auto-detection by Spring and can be registered as a bean in the application context. However, to enable this feature, the Java configuration class must also have the @ComponentScan annotation, which tells Spring where to look for annotated components.


NEW QUESTION # 30
Which statements is true?

  • A. @AfterEach annotation must be used on a cleanup method when @BeforeEach is used.
  • B. @BeforeAll annotation can only be used on non-static methods.
  • C. Methods annotated with @BeforeAll will run only once before any tests in a class are executed.
  • D. Methods annotated with @AfterEach will run only once before any tests in a class are executed.

Answer: C


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

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

Answer: B,D,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 # 32
Which is the correct approach to register for a bean destruction callback?

  • A. Add the @Lazy annotation to the bean configuration.
  • B. Annotate the callback method with @PostDestroy.
  • C. Configure the bean instance to use prototype scope.
  • D. Annotate the callback method with @PreDestroy.

Answer: D


NEW QUESTION # 33
Which two statements are true regarding Spring and Spring Boot Testing? (Choose two.)

  • A. The spring-test dependency provides annotations such as @Mock and @MockBean.
  • B. @SpringBootTest or @SpringJUnitConfig can be used for creating an ApplicationContext.
  • C. Integration and slice testing are both supported.
  • D. Mockito spy is not supported in Spring Boot testing by default.
  • E. EasyMock is supported out of the box.

Answer: A,D


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

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

Answer: B


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

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

Answer: B,C


NEW QUESTION # 36
Which two statements about the @Autowired annotation are true? (Choose two.)

  • A. @Autowired can be used to inject references into BeanPostProcessor and
  • B. By default, if a dependency cannot be satisfied with @Autowired, Spring throws a RuntimeException.
  • C. @Autowired fields are injected after any config methods are invoked.
  • D. If @Autowired is used on a class, field injection is automatically performed for all dependencies.
  • E. Multiple arguments can be injected into a single method using @Autowired.

Answer: B,E

Explanation:
BeanFactoryPostProcessor.
Explanation:
https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/beans/factory/annotation/Autowired.html B . Multiple arguments can be injected into a single method using @Autowired.
This is true because the @Autowired annotation can be applied to methods with arbitrary names and multiple arguments, as shown in the example in Using @Autowired.
C . By default, if a dependency cannot be satisfied with @Autowired, Spring throws a RuntimeException.
This is true because the @Autowired annotation has a required attribute that is true by default, meaning that the dependency is mandatory. If Spring cannot find a matching bean to inject, it will throw a BeanCreationException, which is a subclass of RuntimeException. To avoid this exception, we can set the required attribute to false, which will allow Spring to skip the injection if no matching bean is found


NEW QUESTION # 37
Which two options are valid optional attributes for Spring's @Transactional annotation? (Choose two.)

  • A. writeOnly
  • B. isolation
  • C. propagation
  • D. nestedTransaction
  • E. readWrite

Answer: B,C

Explanation:
https://www.baeldung.com/transaction-configuration-with-jpa-and-spring
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/transaction/annotation/Transactional.html


NEW QUESTION # 38
Which three types can be used as @Controller method arguments? (Choose three.)

  • A. HttpSession
  • B. Principal
  • C. Request
  • D. Locale
  • E. Session
  • F. Language

Answer: A,C,D


NEW QUESTION # 39
Refer to the exhibit.

Which two statements are correct regarding the HelloAutoConfig auto-configuration class when it is specified in the META-INF/spring.factories file? (Choose two.)

  • A. This auto-configuration class is used only when the HelloService.class is on the classpath.
  • B. A HelloService bean will be created from the helloService() method only when there is no other HelloService bean in the ApplicationContext.
  • C. This auto-configuration class is used only when the HelloService.class is not on the classpath.
  • D. A HelloService bean will be created from the helloService() method even if the HelloService.class is not in the classpath.
  • E. A HelloService bean will be created from the helloService() method and will replace existing a HelloService bean in the ApplicationContext.

Answer: A,B

Explanation:
B . A HelloService bean will be created from the helloService() method only when there is no other HelloService bean in the ApplicationContext.
This is true because the @ConditionalOnMissingBean annotation on the helloService() method indicates that this method will only be invoked to create a HelloService bean if there is no existing HelloService bean in the application context. This is a common way to provide a default bean that can be overridden by the user's own bean definition.
D . This auto-configuration class is used only when the HelloService.class is on the classpath.
This is true because the @ConditionalOnClass annotation on the HelloAutoConfig class indicates that this class will only be loaded and processed by Spring Boot if the HelloService.class is present on the classpath. This is a common way to enable auto-configuration for a specific library or feature only when it is available.


NEW QUESTION # 40
Which two statements are true regarding a Spring Boot-based Spring MVC application? (Choose two.)

  • A. Jetty is the default servlet container.
  • B. Spring Boot starts up an embedded servlet container by default.
  • C. Spring MVC starts up an in-memory database by default.
  • D. The default port of the embedded servlet container is 8088.
  • E. The default embedded servlet container can be replaced with Undertow.

Answer: B,E

Explanation:
Spring Boot provides a convenient way to create Spring MVC applications with minimal configuration. By default, it uses Tomcat as the embedded servlet container, but it also supports other containers such as Jetty and Undertow. To use a different container, we just need to exclude the spring-boot-starter-tomcat dependency and include the corresponding starter for the desired container. For example, to use Undertow, we can add the following dependencies in our pom.xml:
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <exclusions> <exclusion> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-undertow</artifactId> </dependency>


NEW QUESTION # 41
......

Pass VMware 2V0-72.22 Premium Files Test Engine pdf - Free Dumps Collection: https://topexamcollection.pdfvce.com/VMware/2V0-72.22-exam-pdf-dumps.html