正文springboot 项目普通类中调用mapper或service接口IP云V管理员/2022-09-03/5 阅读 09/03小程序:扫一扫查出行【扫一扫了解最新限行尾号】复制小程序 1、该类使用@Component注解2、添加一个本类类型的静态字段3、创建一个初始化方法,贴上@PostConstruct 标签,用于注入bean4、创建方法调用mapper或service接口5、最后直接在普通类中调用即可例如: