Stereotype Annotation
About
List of Stereotype Annotations in Spring
Annotation
Purpose
@Component – The Base Stereotype Annotation
@Component – The Base Stereotype Annotation@Component
public class EmailService {
public void sendEmail(String message) {
System.out.println("Email sent: " + message);
}
}@Service – Business Logic Layer
@Service – Business Logic LayerExample
@Repository – Data Access Layer
@Repository – Data Access LayerExample
@Controller – MVC Controller Layer
@Controller – MVC Controller LayerExample
@RestController – REST API Layer
@RestController – REST API LayerWhy Use Stereotype Annotations?
How Stereotype Annotations Enable Component Scanning?
Custom Stereotype Annotations
Last updated