Core Concept of Spring Boot
What is the primary purpose of using Spring Boot in Java development?
- To simplify the use of the Spring framework by reducing configuration and setup effort
- To replace Java completely with a new language
- To make manual dependency management more complex
- To force developers to always use XML configuration
- To run Java code without a runtime environment
Auto-Configuration Idea
Which feature in Spring Boot allows it to automatically configure application components based on classpath settings?
- Auto-configuration
- Manual configuration
- Static import
- Lazy initialization
- Manual bean registration
Starter Dependencies
What advantage do Spring Boot’s starter dependencies provide?
- They aggregate common dependencies, making build files cleaner and management easier
- They remove all dependencies from the project
- They require developers to update all versions manually
- They enforce the use of only one library in projects
- They increase the number of configuration files needed
Annotations in Spring Boot
Which annotation in Spring Boot combines configuration, component scanning, and auto-configuration?
- @SpringBootApplication
- @ComponentScanAnn
- @SpringConfiguration
- @AutoComponentScan
- @ConfigureAnnotation
EnableAutoConfiguration Usage
What is the function of the @EnableAutoConfiguration annotation in a Spring Boot project?
- It enables auto-configuration for the application
- It disables all configuration settings
- It only allows manual bean registration
- It encrypts configuration files
- It runs the application in debug mode by default
Application Properties File
Where should you define the property to change the default port of the embedded web server in Spring Boot?
- In the application.properties file
- Inside the main() method
- In pom.xml only
- Directly in JAVA_HOME
- In the Dockerfile
Spring Boot CLI
What is the main benefit of using the Spring Boot command-line interface (CLI)?
- It allows writing Spring Boot applications with Groovy, reducing boilerplate code
- It forces all applications to use only Java syntax
- It disables starter dependencies entirely
- It increases the need for XML configuration
- It’s only used for deploying to remote servers
Spring Boot Actuator
What is the purpose of the Spring Boot Actuator?
- To provide insights and metrics about a running application through endpoints and JMX
- To initiate applications on multiple servers simultaneously
- To replace the need for starter dependencies
- To compile Groovy files into Java code automatically
- To encrypt all classpath resources
Securing Actuator Endpoints
Why should Actuator endpoints be secured in a Spring Boot application?
- Because they expose sensitive operational information and management functions
- Because they automatically log user passwords
- Because they generate random usernames for all users
- Because they slow down the main application significantly
- Because they delete application logs automatically
Difference in Key Annotations
What is one main difference between @SpringBootApplication and @EnableAutoConfiguration?
- @SpringBootApplication also enables component scanning, while @EnableAutoConfiguration only enables auto-configuration
- @EnableAutoConfiguration is newer than @SpringBootApplication
- @SpringBootApplication disables auto-configuration by default
- @EnableAutoConfiguration runs the application, @SpringBootApplication does not
- @SpringBootApplication is only for test environments