@EnableAutoConfiguration
1. spring文档
解释一:
Enable auto-configuration of the Spring Application Context, attempting to guess and configure beans that you are likely to need. Auto-configuration classes are usually applied based on your classpath and what beans you have defined. For example, If you have tomcat-embedded.jar on your classpath you are likely to want a TomcatEmbeddedServletContainerFactory (unless you have defined your own EmbeddedServletContainerFactory bean).
For example, it will be used when scanning for @Entity classes. It is generally recommended that you place @EnableAutoConfiguration in a root package so that all sub-packages and classes can be searched.
解释二:
@EnableAutoConfiguration annotation auto-configures the beans that are present in the classpath. This simplifies the developers work by guessing the required beans from the classpath and configure it to run the application. This annotation is part of the spring boot project.
根据依赖、类路径、自定义的bean,猜测会用到的bean,从而自动配置。
一般在根包定义中使用。
@ComponentScan("com.example")
@Configuration
@EnableAutoConfiguration
public class BaseProviderApplication {
public static void main(String[] args) {
SpringApplication.run(BaseProviderApplication.class, args);
}
}
@EnableAutoConfiguration的更多相关文章
- SpringBoot的注解:@SpringBootApplication注解 vs @EnableAutoConfiguration+@ComponentScan+@Configuration
spring Boot开发者经常使用@Configuration,@EnableAutoConfiguration,@ComponentScan注解他们的main类, 由于这些注解如此频繁地一块使用( ...
- @EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
@EnableAutoConfiguration 作用:Spring Boot会自动根据你jar包的依赖来自动配置项目. 例如当你项目下面有HSQLDB的依赖时,Spring Boot会创建默认的内存 ...
- EnableAutoConfiguration注解的工作原理(org.springframework.boot.autoconfigure.EnableAutoConfiguration=core.bean.MyConfig)
EnableAutoConfiguration注解的工作原理(org.springframework.boot.autoconfigure.EnableAutoConfiguration=core.b ...
- @EnableAutoConfiguration和@SpringbootApplication注解
一.@EnableAutoConfiguration 这个注释告诉SpringBoot“猜”你将如何想配置Spring,基于你已经添加jar依赖项.如果spring-boot-starter-web已 ...
- springboot EnableAutoConfiguration
http://blog.javachen.com/2016/02/19/spring-boot-auto-configuration.html 自动配置 在启动类上使用@EnableAutoConfi ...
- @EnableAutoConfiguration注解原理
前言 Spring Boot中引入了自动配置,让开发者利用起来更加的简便.快捷.比如内嵌的tomcat端口默认配置是8080,这些都属于Spring Boot自动配置的范畴,当然其自动配置相当多. s ...
- springBoot @EnableAutoConfiguration深入分析
1.新建一个项目中需要提供配置类 2.在META-INF/spring.factorties在文件中配置 org.springframework.boot.autoconfigure.EnableAu ...
- spring-boot启动注解@EnableAutoConfiguration
springboot很多依赖插件是只要有依赖,就会读取相关配置,如果读取不到,就会使用默认的,可能会报错,但是又在项目中不好排除就可以使用 @EnableAutoConfiguration 注解.启动 ...
- SpringBoot自动化配置之三:深入SpringBoot:自定义EnableAutoConfiguration
前言 上面几篇文章介绍了SpringFramework的一些原理,这里开始介绍一下SpringBoot,并通过自定义一些功能来介绍SpringBoot的原理.SpringBoot在SpringFram ...
随机推荐
- Django 后台管理设置(admin.py)
上面是两种后台效果图,第一张是默认情况下Django的后台,第二张是稍作修改后的情况,下面记录下作了哪些修改: 代码: class ArticleAdmin(admin.ModelAdmin): li ...
- 通过WMI接口监控服务器性能
WMI 是微软操作系统的一个内置的组件,通过使用WMI我们可以获取服务器硬件信息.收集服务器性能数据.操作Windows服务,甚至可以远程关机或是重启服务器. 一.在C#编程中使用WMI 要想在C#程 ...
- IOS 中openGL使用教程3(openGL ES 入门篇 | 纹理贴图(texture)使用)
在这篇文章中,我们将学习如何在openGL中使用纹理贴图. penGL中纹理可以分为1D,2D和3D纹理,我们在绑定纹理对象的时候需要指定纹理的种类.由于本文将以一张图片为例,因此我们为我们的纹理对象 ...
- 【整理】动态加载Web Services
WebClient client = new WebClient(); String url = "http://localhost/MESAPIWebService/MESAPI.asmx ...
- 思考力——提升企业竞争力的核心因素
如果你对项目管理.系统架构有兴趣,请加微信订阅号"softjg",加入这个PM.架构师的大家庭 · 思考力就是竞争力:在这个科技飞跃进步的时代,很多事物是我们未曾经历也难以预料的. ...
- LR12.53—第5课:创建负载测试场景
在前面的课程中,您使用VuGen将验证您的Vuser脚本.在本课中,您将评估多个Vuser的负载下您的系统.您将模拟十个旅行代理同时使用航班预订系统的行动,以及这些用户的负载下观察系统的行为.设计和运 ...
- 轻松获取LAMP或LNMP环境编译参数
查看web服务的编译参数 1. 查看nginx的编译参数: /apps/nginx/sbin/nginx -V 范例: [root@VM- ~]# /apps/nginx/sbin/nginx -V ...
- try-catch-finally 引发的奇怪问题
今天,发现我们的一个Windows Service无法正常停止,无奈之下只能杀了进程. 为了找到原因,我在本地进行调试,发现程序里用到了多线程,而代码正是卡在了workThread.Abort()语句 ...
- swift 键盘属性与事件
1.键盘的类型 textField1.keyboardType = UIKeyboardType.default //系统默认的虚拟键盘 textField1.keyboardType = UIKey ...
- css secrets----multiple borders
原始文档: https://www.zybuluo.com/freeethy/note/193574 box-shadow solution 只能实现solid border box-shadow表现 ...