VMware certification · Exam 2V0-72.22

2V0-72.22 Mock Exam Page 3

Professional Develop VMware Spring

Free 2V0-72.22 mock exam questions 21–23, each with the answer and an explanation.

20 questions · 33 minutes · free, no sign-up

Free 2V0-72.22 questions

21–23 of 23 free
Question 21 Choose 1
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.)
Show answerHide answer

Correct answer: B Ensure a valid @ComponentScan annotation in the Java configuration is specified.

Explanation

Explanation:

Component Scanning (Option B): The @Component annotation is a stereotype marker indicating that a class is a candidate for auto-detection. However, Spring will not scan the classpath or instantiate the bean on its own. A configuration class must explicitly declare the @ComponentScan annotation (or use @SpringBootApplication, which implicitly includes it) and specify the base packages to search. This instructs the IoC container to scan the defined packages, locate the @Component classes, and automatically register them as beans.

Why the Other Options Are Incorrect

A is incorrect: Specifying an explicit bean name inside @Component("myBean") is optional. If left blank, Spring's BeanNameGenerator automatically derives a valid default name using the uncapitalized non-qualified class name.

C is incorrect: Explicitly declaring a @Scope is unnecessary. If omitted, Spring automatically assigns the default singleton scope to the auto-detected bean.

D is incorrect: The @Bean annotation is used inside @Configuration classes for explicit, manual bean registration. Combining @Component on a class with a separate @Bean factory method for that same class is redundant and incorrect for auto-detection.

References

Spring Framework Core Documentation: Section 1.10: Classpath Scanning and Managed Components – States that classpath scanning requires @ComponentScan alongside stereotype annotations like @Component to discover and register beans.

Spring Framework Core Documentation: Section 1.10.3: Automatically Detecting Classes and Registering Bean Definitions – Details how @ComponentScan triggers the parsing of components within specified packages.
Question 22 Choose 2
Which two statements are true regarding storing user details in Spring Security? (Choose two.)
Show answerHide answer

Correct answer: C, D User details can be stored in custom storage and retrieve them by implementing the UserDetailsService interface.User details can be stored in a database, in LDAP, or in-memory.

Explanation

Explanation:

Custom Storage (Option C):
Spring Security allows complete decoupling from any specific storage medium. By creating a custom class that implements the UserDetailsService interface and overriding its single loadUserByUsername(String username) method, developers can retrieve user authentication details from any proprietary system, external API, or non-relational database.

Built-In Providers (Option D):
Out of the box, Spring Security provides native implementations for common credential stores. These include InMemoryUserDetailsManager (for testing/simple apps), JdbcDaoImpl (for relational databases using SQL queries), and LDAP-backed storage engines.

Why the Other Options Are Incorrect

A is incorrect: Spring Boot's auto-configuration acts as a fallback. If it detects any custom bean that implements UserDetailsService or AuthenticationManager within the ApplicationContext, it backs off and will not generate the default, random auto-generated security password on startup.

B is incorrect: Modern versions of Spring Security mandate secure cryptographic hashing using a PasswordEncoder bean (such as BCryptPasswordEncoder). Insecure algorithms like MD5 are deprecated and not used by default.

E is incorrect: The standard UserDetails object contracts heavily require security authorities (roles/permissions). The interface includes the getAuthorities() method, and omitting them during user creation will fail runtime authorization checks.

References

Spring Security Reference Documentation: Section: Architecture - UserDetailsService – Explains how custom database or repository Lookups are implemented via UserDetailsService.

Spring Security Reference Documentation: Section: Authentication - Password Storage – Discusses the delegation of secure password hashing mechanisms (like BCrypt and Argon2) and the deprecation of legacy MD5 hashes.
Question 23 Choose 2
Which two statements are true regarding a Spring Boot "fat" JAR? (Choose two.)
Show answerHide answer

Correct answer: C, E The "fat" JAR contains compiled classes and dependencies that your code needs to run.The "fat" JAR is created by the Spring Boot Maven plugin or Gradle plugin.

Explanation

Explanation:

Self-Contained Dependencies (Option C): A Spring Boot "fat" JAR (also known as an executable JAR) packages your application's compiled .class files along with all of its third-party library dependencies (nested inside the BOOT-INF/lib/ directory). This creates an autonomous, self-contained unit of deployment.

Build Plugins (Option E):
Standard Java tools do not natively support nesting library JARs inside another JAR. The specialized Spring Boot Maven Plugin or Spring Boot Gradle Plugin intercepts the normal build process to repackage the application, injecting Spring Boot's custom class loader required to read nested dependencies.

Why the Other Options Are Incorrect

A is incorrect: The executable "fat" JAR only contains compiled bytecode (.class files) and packaged resources. It does not contain the original Java source files (.java), as they are not needed for production execution.

B is incorrect: One of the main advantages of a "fat" JAR is that it does not require an external Servlet container (like standalone Tomcat or WildFly). It embeds the server runtime (Tomcat by default) directly inside the artifact.

D is incorrect:A standard Spring Boot executable archive is engineered to bootstrap and run exactly one embedded application server instance per execution lifecycle, not multiple.

References

Spring Boot Reference Guide: Section: Executable JARs – Explains the executable layout format, how nested dependencies are structured inside BOOT-INF/lib/, and how the archive launches.

Spring Boot Build Tool Plugins: Section: Spring Boot Maven/Gradle Plugin Documentation – Details how the repackage goal converts a standard archive into an executable "fat" JAR.

That's the last free question

You've seen the free 30% (23 of 79 questions). Full access unlocks every question and full-length 2V0-72.22 mock exams (65 questions, 105 minutes), a different mock on every attempt.

Unlock full mock exam
Full mock exam

Sit the 2V0-72.22 exam before exam day

Full-length mocks with the same number of questions and the same time limit as the real 2V0-72.22 exam. Every attempt draws a new set of questions from the full bank, so you can keep going until you pass comfortably.

Get full 2V0-72.22 mock exam
  • 65questions per mock
  • 105 mintime limit
  • 79questions in the bank
  • Newmock on every attempt