@Component、@Service、@Repository

@Component

用于把当前类对象存入spring容器中 属性:value用于指定bean的id。当我们不写时,它的默认值是当前类名,且首字母改小写。 注意:当只有一个属性值的时候默认可以不写 value=

@Service

一个service业务层类

@Repository

捕获特定于平台的异常,并将它们作为Spring的未检查异常重新抛出

posted @ 2022-04-22 14:30  zmy98  阅读(29)  评论(0)    收藏  举报