81 Q&As in UPDATED 2V0-72.22 Exam Questions Certification Test Engine to PDF
Get The Important Preparation Guide With 2V0-72.22 Dumps
To appear for the VMware 2V0-72.22 exam, candidates need to have a basic understanding of Java and Java-based frameworks. Additionally, they should have hands-on experience working with VMware Spring, including developing and managing applications using VMware Spring. 2V0-72.22 exam is designed for IT professionals who have at least two years of experience working in the IT industry and have a strong desire to build a career in application development.
NEW QUESTION # 11
Refer to the exhibit.
How can a Spring Bean be created from this LegacySingleton class?
- A. Call LegacySingleton.getInstance() from within a @Bean method and return the instance.
- B. It is not possible without modifying the LegacySingleton class, the constructor must be public.
- C. Return an instance of LegacySingleton using the new keyword from a @Bean method.
- D. Modify the LegacySingleton class by adding the @Autowired annotation to the instance variable.
Answer: A
NEW QUESTION # 12
What two options are auto-configured Spring Boot Actuator HealthIndicators? (Choose two.)
- A. DataSourceHealthIndicator
- B. GoogleCloudDataStoreHealthIndicator
- C. OktaHealthIndicator
- D. DynamoDBHealthIndicator
- E. RabbitHealthIndicator
Answer: A,E
NEW QUESTION # 13
Refer to the exhibit.
How can a response status code be set for No Content (204)? (Choose the best answer.)
- A. Annotate the update() handler method with @ResponseEntity(204).
- B. Annotate the update() handler method with @ResponseStatus(HttpStatus.NO_CONTENT).
- C. The update() handler method cannot return a void type, it must return a ResponseEntity type.
- D. Annotate the update() handler method with @PutMapping("/store/orders/{id"}", HttpStatus.NO_CONTENT).
Answer: A
NEW QUESTION # 14
Which two statements are true about Spring Boot and Spring Data JPA? (Choose two.)
- A. Embedded Databases (H2, HSQLDB, Derby) are not re-created during the startup.
- B. Scanning of JPA Entities can not be customized, the whole classpath is scanned.
- C. Any kind of Hibernate property can be passed to Spring Data JPA like spring.jpa.properties.xxx.
- D. @EntityScan and spring.jpa.* properties can be used to customize Spring Data JPA.
- E. Spring Data JPA is the only implementation for relational databases.
Answer: C,D
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 # 15
Which two statements are true about Spring AOP? (Choose two.)
- A. Spring AOP does not use AspectJ's pointcut expression language.
- B. The @After advice type is invoked regardless of whether a method successfully returned or an exception was thrown.
- C. There are in total 4 types of advice, @Before, @After, @AfterReturning and @AfterThrowing.
- D. Examples of cross-cutting concerns include security, caching, transaction.
- E. In Spring AOP, a join point represents a method execution or property access.
Answer: B,D
NEW QUESTION # 16
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
@ConditionalOnMissingBean (DataSource.class) for greater flexibility. - B. @ConditionalOnBean(name= "dataSource") should be replaced with @ConditionalOnBean (DataSource.class) for greater flexibility.
- C. The @Bean annotation should be removed.
- D. A JdbcTemplate bean will be created when a bean named dataSource has already been created.
- E. A JdbcTemplate bean will be created when the DataSource class is in the classpath but there is no DataSource bean.
Answer: B,E
NEW QUESTION # 17
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 # 18
According to REST principles, which is the recommended way to update the order resource identified by 1234?
- A. Send a POST request to /orders/edit?id=1234.
- B. Send a PUT request to /orders/edit?id=1234.
- C. Send a POST request to /orders/1234.
- D. Send a PUT request to /orders/1234.
Answer: D
NEW QUESTION # 19
Which two statements are true about @Controller annotated classes? (Choose two.)
- A. The classes are eligible for handling requests in Spring MVC.
- B. The @Controller annotation is a stereotype annotation like @Component.
- C. @Controller is interchangeable with @RestController with no extra code changes for the methods inside the class.
- D. The classes must be annotated together with @EnableMvcMappings to be discovered via component scanning.
- E. The @Controller annotated classes can only render views.
Answer: A,B
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 # 20
Refer to the exhibit.
Which two methods will be implemented at runtime if declared in a Spring Data JPA Repository? (Choose two.)
- A. public Customer findByEmail(String email);
- B. public Customer getsingle(Long id);
- C. public Customer findFirstOrderDateMax();
- D. public Customer findFirstByOrderDateBetween(Date d1, Date d2);
- E. public Customer findCustomerByName(String name);
Answer: A,D
NEW QUESTION # 21
Which two statements are true regarding @DataJpaTest? (Choose two.)
- A. It auto-configures a TestEntityManager bean.
- B. It can be used for testing JdbcTemplate.
- C. If an embedded database is on the classpath, it will be used to configure a DataSource by default.
- D. It can be used for testing both JPA components and NoSQL components.
- E. TestEntityManager provides all methods that are provided by EntityManager and more.
Answer: A,C
NEW QUESTION # 22
What is a Spring Boot starter dependency? (Choose the best answer.)
- A. A specific POM which you must build to control Spring Boot's opinionated runtime.
- B. A setting for specifying which code you want Spring Boot to generate for you.
- 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.
NEW QUESTION # 23
Which statement describes the @AfterReturning advice type? (Choose the best answer.)
- A. The advice has complete control over the method invocation; it could even prevent the method from being called at all.
- B. The @AfterReturning advice allows behavior to be added after a method returns even if it throws an exception.
- C. Typically used to prevent any exception, thrown by the advised method, from propagating up the call-stack.
- D. The advice is invoked only if the method returns successfully but not if it throws an exception.
Answer: D
Explanation:
https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/aop/AfterReturningAdvice.html
NEW QUESTION # 24
Which two statements are true about @Controller annotated classes? (Choose two.)
- A. The classes are eligible for handling requests in Spring MVC.
- B. The @Controller annotation is a stereotype annotation like @Component.
- C. @Controller is interchangeable with @RestController with no extra code changes for the methods inside the class.
- D. The classes must be annotated together with @EnableMvcMappings to be discovered via component scanning.
- E. The @Controller annotated classes can only render views.
Answer: A,B
NEW QUESTION # 25
Which two statements are true regarding a Spring Boot "fat" JAR? (Choose two.)
- A. The "fat" JAR is created by the Spring Boot Maven plugin or Gradle plugin.
- B. The "fat" JAR can contain multiple embedded application servers.
- C. The "fat" JAR contains compiled classes and dependencies that your code needs to run.
- D. The "fat" JAR contains both the class files and the source files for your project.
- E. The "fat" JAR requires an external Servlet container.
Answer: A,C
NEW QUESTION # 26
Which two options are valid optional attributes for Spring's @Transactional annotation? (Choose two.)
- A. propagation
- B. isolation
- C. readWrite
- D. writeOnly
- E. nestedTransaction
Answer: A,B
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 # 27
Refer to the exhibit.
It is a Java code fragment from a Spring application. Which statement is true with regard to the above example? (Choose the best answer.)
- A. This syntax is invalid because the bean id must be specified as a method parameter.
- B. It will return a bean called ClientService regardless of its id or name.
- C. It will return a bean of the type ClientService regardless of its id or name.
- D. This syntax is invalid because the result of the getBean() method call should be cast to ClientService.
Answer: C
Explanation:
https://www.baeldung.com/spring-getbean#3-retrieving-bean-by-type
NEW QUESTION # 28
......
Prepare With Top Rated High-quality 2V0-72.22 Dumps For Success in Exam: https://www.2pass4sure.com/VCP-AM-Develop-2022/2V0-72.22-actual-exam-braindumps.html
Get Totally Free Updates on 2V0-72.22 Dumps PDF Questions: https://drive.google.com/open?id=1lfC3350nXPqat-0alK9yiLYAybJYFNH7