SpringBoot为了简化代码,提供了包扫描的机制,为包路径下的接口创建代理对象,之后交给spring容器管理,可以在任意位置依赖注入
@MapperScan("com.jt.mapper")
public class SpringBootRun {
public static void main(String[] args) {
SpringApplication.run(SpringBootRun.class,args);
}
}
本文介绍了SpringBoot如何通过@MapperScan注解实现接口的包扫描和代理对象创建,这些对象随后被加入到Spring容器中,允许在应用的任何地方进行依赖注入,以此达到代码的简化和模块化。
SpringBoot为了简化代码,提供了包扫描的机制,为包路径下的接口创建代理对象,之后交给spring容器管理,可以在任意位置依赖注入
@MapperScan("com.jt.mapper")
public class SpringBootRun {
public static void main(String[] args) {
SpringApplication.run(SpringBootRun.class,args);
}
}
您可能感兴趣的与本文相关的镜像
Stable-Diffusion-3.5
Stable Diffusion 3.5 (SD 3.5) 是由 Stability AI 推出的新一代文本到图像生成模型,相比 3.0 版本,它提升了图像质量、运行速度和硬件效率
4669
9224
624

被折叠的 条评论
为什么被折叠?