Welcome to Set 3 of our 100 Spring Boot MCQ Questions and Answers series, where we continue to unravel the complexities of Spring Boot. Having built a solid foundation with the basics and intermediate topics covered in the first two sets, this third instalment elevates your learning journey into advanced Spring Boot features and annotations.
Complete Spring Boot MCQ Questions and Answers series:
Spring Boot MCQ Questions and Answers | Set 1
Spring Boot MCQ Questions and Answers | Set 2
Spring Boot MCQ Questions and Answers | Set 3
Spring Boot MCQ Questions and Answers | Set 4
Spring Boot MCQ Questions and Answers | Set 5
Spring Boot MCQ Questions and Answers | Set 6
Spring Boot MCQ Questions and Answers | Set 7
Spring Boot MCQ Questions and Answers | Set 8
Spring Boot MCQ Questions and Answers | Set 9
Spring Boot MCQ Questions and Answers | Set 10
21. What is the purpose of the @ConfigurationProperties annotation in Spring Boot?
Answer:
Explanation:
The @ConfigurationProperties annotation in Spring Boot is used to bind external configuration properties (typically from application.properties or application.yml) to a bean, allowing type-safe configuration.
22. Which dependency is used to include Spring Security in a Spring Boot project?
Answer:
Explanation:
The spring-boot-starter-security starter includes dependencies required for using Spring Security in a Spring Boot application, providing authentication and authorization capabilities.
23. How does Spring Boot support database migrations?
Answer:
Explanation:
Spring Boot supports database migrations by integrating with migration tools like Flyway and Liquibase, facilitating version control for your database schema.
24. What is the default scope of a Spring bean in Spring Boot?
Answer:
Explanation:
In Spring Boot, the default scope of a Spring bean is 'Singleton'. This means that only one instance of the bean is created and shared across the entire application.
25. What is the purpose of the @Service annotation in Spring Boot?
Answer:
Explanation:
The @Service annotation in Spring Boot marks a class as a service provider, indicating that it holds business logic. This stereotype annotation also makes the class eligible for auto-detection and auto-configuration.
26. What is the role of the spring-boot-starter-actuator dependency?
Answer:
Explanation:
The spring-boot-starter-actuator starter adds actuator support, which includes production-ready features like health checks, metrics, and environment information useful for monitoring and managing the application.
27. How can you specify the profile-specific configuration in Spring Boot?
Answer:
Explanation:
Profile-specific configurations in Spring Boot can be managed by naming the properties files with the profile name, such as application-dev.properties for the 'dev' profile and application-prod.properties for the 'prod' profile.
28. In Spring Boot, what is the purpose of the @Scheduled annotation?
Answer:
Explanation:
The @Scheduled annotation in Spring Boot is used to define methods that should be executed at a fixed interval or cron expression, enabling the creation of scheduled tasks.
29. How does Spring Boot simplify database access?
Answer:
Explanation:
Spring Boot simplifies database access by automatically configuring DataSource and JdbcTemplate based on the database and driver dependencies in the classpath.
30. What is the role of the @RequestBody annotation in a Spring Boot controller?
Answer:
Explanation:
The @RequestBody annotation in Spring Boot is used in controller methods to bind the HTTP request body to a method parameter. It is typically used with POST and PUT HTTP methods.
Complete Spring Boot MCQ Questions and Answers Series:
Spring Boot MCQ Questions and Answers | Set 1
Spring Boot MCQ Questions and Answers | Set 2
Spring Boot MCQ Questions and Answers | Set 3
Spring Boot MCQ Questions and Answers | Set 4
Spring Boot MCQ Questions and Answers | Set 5
Spring Boot MCQ Questions and Answers | Set 6
Spring Boot MCQ Questions and Answers | Set 7
Spring Boot MCQ Questions and Answers | Set 8
Spring Boot MCQ Questions and Answers | Set 9
Spring Boot MCQ Questions and Answers | Set 10
❮ Previous Set Next Set ❯
Comments
Post a Comment
Leave Comment