以一个例子说明
1、要调用的类使用@Component注解
@Component
2、添加一个本类类型的静态字段
public static MapperTest mapperTest;
3、创建一个初始化方法,贴上@PostConstruct 标签,用于注入bean
4、创建方法调用mapper或service接口
@PostConstruct
public void init(){
mapperTest = this;
mapperTest.sysTaskMapper = this.sysTaskMapper;
}
5、最后就可以直接在普通类中调用即可