springboot启动类注解说明
作者:互联网
@MapperScan({"com.test.**.mapper", "com.test.**.dao"})
@EnableAsync
@EnableDiscoveryClient
@EnableEurekaClient
@EnableFeignClients
@EnableTransactionManagement
@EnableScheduling
@EnableCaching
@ComponentScan(value = {"com.test"})
@EnableHystrix
@EnableHystrixDashboard
@SpringBootApplication
------------------------------------------------------------
@MapperScan({"com.test.**.mapper", "com.test.**.dao"})
开启映射文件的扫描,对应的映射文件@Mapper可加可不加。
@Mapper注解加在映射接口上,会对应生成代理对象。但是每个都写很繁琐。@MapperScan应运而生,通过路径自动扫描,根据包下的类生成对应代理对象,实现与数据库的交互。
@EnableAsync
开启支持异步执行,既开启多线程。只有标注这个注释,@Async注解才能够生效。
@EnableDiscoveryClient
将服务注册到注册中心
@EnableEurekaClient
将服务注册到Eureka注册中心
@EnableFeignClients
@EnableTransactionManagement
@EnableScheduling
@EnableCaching
@ComponentScan(value = {"com.test"})
@EnableHystrix
@EnableHystrixDashboard
@SpringBootApplication
@EnableScheduling
@EnableCaching
@ComponentScan(value = {"com.test"})
@EnableHystrix
@EnableHystrixDashboard
@SpringBootApplication
Coder享 发布了41 篇原创文章 · 获赞 2 · 访问量 4148 私信 关注
标签:springboot,映射,启动,MapperScan,注册,test,注解,com 来源: https://blog.csdn.net/weixin_43421537/article/details/104049266