在 Spring 框架中,@Component、@Service、@Repository 都是用于标注 Bean 的注解,其中 @Component 是通用组件,@Service 用于业务层逻辑,@Repository 用于持久层,并额外支持异常转换。基本用法很简单,如在业务类上标注:@Servicepublic class UserService { // 业务方法}Spring 会自动扫描并注册为 Bean,可直接注入到其他组件中使用。