Spring Framework

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 »

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 »

Which of the following files is used to configure application properties in a Spring Boot project?

Which of the following files is used to configure application properties in a Spring Boot project? A) config.xml B) application.properties C) config.yml D) settings.xml Answer: B) application.properties Explanation: The application.properties file is used to configure application properties in a Spring Boot project. This file allows developers to specify various configuration settings, such as server ports,

Which of the following files is used to configure application properties in a Spring Boot project? Read More »

What does the @Autowired annotation do in Spring Boot?

What does the @Autowired annotation do in Spring Boot? A) Manually inject dependencies into fields, constructors, or setters B) Automatically inject dependencies into fields, constructors, or setters C) Automatically create a new instance of a class D) Mark a bean as lazy-initialized Answer: B) Automatically inject dependencies into fields, constructors, or setters Explanation: The @Autowired

What does the @Autowired annotation do in Spring Boot? Read More »

Which of the following annotations is used to enable JPA repositories in Spring Boot?

Which of the following annotations is used to enable JPA repositories in Spring Boot? A) @EnableJpaRepositories B) @EnableAutoConfiguration C) @EnableTransactionManagement D) @EnableJpaAuditing Answer: A) @EnableJpaRepositories Explanation: The @EnableJpaRepositories annotation is used in Spring Boot to enable the scanning of JPA repositories, which are interfaces that extend the JpaRepository interface to provide CRUD operations and custom

Which of the following annotations is used to enable JPA repositories in Spring Boot? Read More »

How can you disable the embedded server in Spring Boot?

How can you disable the embedded server in Spring Boot? A) Remove the server dependency from the classpath B) Set the server port to 0 in the application.properties C) Set the server port to -1 in the application.properties D) Use @SpringBootApplication without @EnableAutoConfiguration Answer: A) Remove the server dependency from the classpath Explanation: To disable

How can you disable the embedded server in Spring Boot? Read More »

Which annotation is used to create a RESTful web service in Spring Boot?

Which annotation is used to create a RESTful web service in Spring Boot? A) @Controller B) @Service C) @RestController D) @Component Answer: C) @RestController Explanation: The @RestController annotation in Spring Boot is used to create RESTful web services. It is a specialized version of the @Controller annotation, combining @Controller and @ResponseBody annotations. This combination simplifies

Which annotation is used to create a RESTful web service in Spring Boot? Read More »

Which of the following is NOT a feature of Spring Boot?

Which of the following is NOT a feature of Spring Boot? A) Embedded server support B) Opinionated starter dependencies C) Automatic configuration D) Integrated Java compiler Answer: D) Integrated Java compiler Explanation: Spring Boot provides many features that simplify the development and deployment of Spring-based applications, including embedded server support (like Tomcat, Jetty, or Undertow),

Which of the following is NOT a feature of Spring Boot? Read More »

What is the primary purpose of the @SpringBootApplication annotation?

What is the primary purpose of the @SpringBootApplication annotation? A) To enable JPA repositories B) To scan for components in the project C) To mark the main class of a Spring Boot application and enable auto-configuration D) To configure a Spring Boot application for use with an external server Answer: C) To mark the main

What is the primary purpose of the @SpringBootApplication annotation? Read More »

What is Spring Boot?

What is Spring Boot? A) A command-line tool for managing Spring projects B) A framework that simplifies the development of Spring applications by providing default configurations C) A tool for building Android applications D) A database management system Answer: B) A framework that simplifies the development of Spring applications by providing default configurations Explanation: Spring

What is Spring Boot? Read More »

Spring Cloud MCQ

Welcome to the Spring Cloud Quiz! Whether you’re a beginner just starting out with Spring Cloud or looking for a quick refresher, this quiz is designed to test your fundamental knowledge of Spring Cloud. Let’s get started! Spring Cloud provides various tools or modules for developers to build common design patterns ( (e.g., configuration management, service discovery, circuit

Spring Cloud MCQ Read More »

Spring Boot MCQ

Spring Boot has dramatically simplified how developers create and run Spring applications. It allows for bootstrapping a Spring application without the traditional configuration setup. But how well do you understand its basics? Here’s a beginner-level quiz focused on the fundamental concepts of Spring Boot. Note that each question is followed by the correct answer and

Spring Boot MCQ Read More »

Scroll to Top