Spring Framework

What is the purpose of the JpaRepository interface in Spring Data JPA?

What is the purpose of the JpaRepository interface in Spring Data JPA? A) To provide CRUD operations for entity classes B) To manage transactions in a Spring application C) To configure the database connection D) To map Java objects to database tables Answer: A) To provide CRUD operations for entity classes Explanation: The JpaRepository interface

What is the purpose of the JpaRepository interface in Spring Data JPA? Read More »

What is the purpose of the @CrossOrigin annotation in Spring MVC?

What is the purpose of the @CrossOrigin annotation in Spring MVC? A) To enable Cross-Origin Resource Sharing (CORS) on specific methods or classes B) To handle cross-site scripting (XSS) attacks C) To configure internationalization (i18n) in Spring MVC D) To bind HTTP request parameters to method arguments Answer: A) To enable Cross-Origin Resource Sharing (CORS)

What is the purpose of the @CrossOrigin annotation in Spring MVC? Read More »

What is the difference between @GetMapping and @PostMapping annotations in Spring MVC?

What is the difference between @GetMapping and @PostMapping annotations in Spring MVC? A) @GetMapping is used for HTTP GET requests, and @PostMapping is used for HTTP POST requests B) @GetMapping is used for database queries, and @PostMapping is used for data insertions C) @GetMapping is used to map URLs, and @PostMapping is used to handle

What is the difference between @GetMapping and @PostMapping annotations in Spring MVC? Read More »

What is the role of the @RequestMapping annotation in Spring MVC?

What is the role of the @RequestMapping annotation in Spring MVC? A) To map web requests to specific handler methods B) To define beans in the Spring context C) To configure database connections D) To initialize Spring Boot applications Answer: A) To map web requests to specific handler methods Explanation: The @RequestMapping annotation in Spring

What is the role of the @RequestMapping annotation in Spring MVC? Read More »

What is the purpose of @RestControllerAdvice in Spring Boot?

What is the purpose of @RestControllerAdvice in Spring Boot? A) To handle exceptions for REST controllers globally B) To configure REST endpoints C) To apply caching for REST controllers D) To configure security for REST endpoints Answer: A) To handle exceptions for REST controllers globally Explanation: The @RestControllerAdvice annotation in Spring Boot is used to

What is the purpose of @RestControllerAdvice in Spring Boot? Read More »

How do you integrate Spring Boot with a NoSQL database like MongoDB?

How do you integrate Spring Boot with a NoSQL database like MongoDB? A) By using the spring-boot-starter-data-mongodb dependency B) By manually configuring the MongoDB client in the application C) By using the spring-boot-starter-nosql dependency D) By using the @NoSql annotation Answer: A) By using the spring-boot-starter-data-mongodb dependency Explanation: To integrate Spring Boot with a NoSQL

How do you integrate Spring Boot with a NoSQL database like MongoDB? Read More »

How do you implement a custom error page in Spring Boot?

How do you implement a custom error page in Spring Boot? A) By creating an HTML file named error.html in the src/main/resources/templates directory B) By setting custom-error-page=true in application.properties C) By implementing ErrorController interface D) Both A and C Answer: D) Both A and C Explanation: In Spring Boot, you can implement a custom error

How do you implement a custom error page in Spring Boot? Read More »

How can you enable asynchronous processing in Spring Boot?

How can you enable asynchronous processing in Spring Boot? A) By using the @Async annotation B) By using the @EnableAsync annotation C) By setting spring.async.enabled=true in application.properties D) Both A and B Answer: D) Both A and B Explanation: In Spring Boot, you can enable asynchronous processing by using the @EnableAsync annotation in your configuration

How can you enable asynchronous processing in Spring Boot? Read More »

What is the purpose of @RestControllerAdvice in Spring Boot?

What is the purpose of @RestControllerAdvice in Spring Boot? A) To handle exceptions for REST controllers globally B) To configure REST endpoints C) To apply caching for REST controllers D) To configure security for REST endpoints Answer: A) To handle exceptions for REST controllers globally Explanation: The @RestControllerAdvice annotation in Spring Boot is used to

What is the purpose of @RestControllerAdvice in Spring Boot? Read More »

How do you integrate Spring Boot with a NoSQL database like MongoDB?

How do you integrate Spring Boot with a NoSQL database like MongoDB? A) By using the spring-boot-starter-data-mongodb dependency B) By manually configuring the MongoDB client in the application C) By using the spring-boot-starter-nosql dependency D) By using the @NoSql annotation Answer: A) By using the spring-boot-starter-data-mongodb dependency Explanation: To integrate Spring Boot with a NoSQL

How do you integrate Spring Boot with a NoSQL database like MongoDB? Read More »

How do you implement a custom error page in Spring Boot?

How do you implement a custom error page in Spring Boot? A) By creating an HTML file named error.html in the src/main/resources/templates directory B) By setting custom-error-page=true in application.properties C) By implementing ErrorController interface D) Both A and C Answer: D) Both A and C Explanation: In Spring Boot, you can implement a custom error

How do you implement a custom error page in Spring Boot? Read More »

Scroll to Top