Junior — Middle
Can you list the main annotations used in Spring Boot for configuration and component management?
sobes.tech AI
Answer from AI
Main annotations in Spring Boot for configuration and component management:
@SpringBootApplication— combines@Configuration,@EnableAutoConfiguration, and@ComponentScan, used to run the application.@Component— a basic annotation for components managed by Spring.@Service— a specialized component for the service layer.@Repository— for data access components, supports exception handling.@Controllerand@RestController— for web controllers,@RestControllerautomatically adds@ResponseBody.@Configuration— a class with methods that create beans.@Bean— a method within@Configurationthat creates a bean.@Autowired— for automatic dependency injection.@Value— for injecting values from configuration.@EnableAutoConfiguration— enables Spring Boot's auto-configuration.
These annotations help structure the application and manage the lifecycle of components.