Skip to main content

Posts

Spring boot annotation

  A Spring Boot application consists of several key annotations that configure components, enable auto-configuration, and manage dependency injection. Below is a comprehensive list of Spring Boot annotations categorized by their purpose. 1. Core Annotations (Bootstrapping & Configuration) Annotation Description @SpringBootApplication Main entry point for a Spring Boot application. Combines @Configuration, @EnableAutoConfiguration, and @ComponentScan. @Configuration Marks a class as a Spring configuration class (equivalent to XML config). @ComponentScan Enables scanning for components (@Component, @Service, @Repository, etc.) in the package and sub-packages. @EnableAutoConfiguration Automatically configures Spring beans based on dependencies. (Part of @SpringBootApplication). Example import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication publ...