Spring Boot Flashcards
How is Spring Boot different from legacy Spring applications? What does it mean that it is “opinionated”?
-Spring boot is an extension of legacy Spring applications, which eliminated boilerplate configurations needed to setting up a Spring application
-Software designed pattern that decides or guides development to be constructed a certain way
What does “convention over configuration” mean?
Software design paradigm used by frameworks that is intended to reduce the amount of decisions a developer needs to do without losing flexibility.
What annotation would you use for Spring Boot apps? What does it do behind the scenes?
@SpringBootApplication: Equivalent of using @Configuration, @EnableAutoConfiguration, @ComponentScan with default attributes
@Configuration: allows to register extra beans in the context or import additional configuration classes
@EnableAutoConfiguration: enable Spring Boot’s auto-configure mechanism
@ComponentScan: enable @Component scan on the package where the application is loaded
How does Boot’s autoconfiguration work?
Attempts to automatically configure your Spring app based on the jar dependencies which you have added
What is the advantage of having an embedded Tomcat server?
Makes it easier to distribute web apps using services like Docker
What is the significance of the Spring Boot starter POM?
Set of convenient dependency descriptors that you can include without the need of hunting specific dependencies.
What is the Spring Boot actuator? What information can it give you?
-Spring Boot actuator: a module that provides all of Spring Boot’s production-ready features
-Auditevents: Exposes audit events info for current app
-Beans: Displays complete list of all Spring beans in app
-Caches: Exposes available caches
-Conditions: Shows conditions that were evaluated on config and auto-config classes and reasons why they did or did not match
-Configprops: Displays list of all @ConfigurationProperties
-Env: Exposes properties form Spring’s
-ConfigurableEnvironment
Flyway: Shows any flyway database migrations that have been applied
-Health: Show app health info
-Httptrace: Displays http trace info
-Info: Displays arbitrary app info
-Integrationgraph: Shows Spring Integration graph
-Loggers: Shows and modifies the config of loggers in the app
-Liquibase: Shows any Liquidbase db migrations that have been applied
-Metrics: Shows ‘metrics’ info of current application
-Mappings: Displays a collated list of all @RequestMapping paths
-Scheduledtasks: Displays the scheduled task in your application
-Sessions: Allows retrieval and deletion of user sessions from a Spring Session-backed session store.
-Shutdown: Lets app gracefully shut down
-Startup: Shows the startup steps
-Threaddump: Performs a thread dump
What files would you use to configure Spring Boot applications?
Application.properties/application.yaml/application.yml
Beans.xml
What is the benefit of using Spring Boot profiles?
Allows devs to place related properties and the values into an apps properties files, and allowing deployment scripts to refer to them with a single environment variable reference at runtime.