@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 ...
随机推荐
- SQL语句Where中使用别名作为判断条件
当我们使用某个表达式作为输出的一列时,我们无法再Where条件中直接使用该列作判断条件. 例如下面的SQL语句: select id, (c1 + c2) as s from t1 where ...
- MYSQL中UNIX时间戳与日期的转换
select FROM_UNIXTIME(1464973385.641,'%Y-%m-%d %H:%i:%s'); select UNIX_TIMESTAMP('2016-06-04 01:03:05 ...
- 《从零开始做一个MEAN全栈项目》(3)
欢迎关注本人的微信公众号"前端小填填",专注前端技术的基础和项目开发的学习. 上一篇文章给大家讲了一下本项目的开发计划,这一章将会开始着手搭建一个MEAN项目.千里之行,始于足下, ...
- Vagrant+virtualBox+pycham+python环境的安装及配置
概要: 通过Vagrant,virtualBox安装配置,把virtualBox虚拟机的linux项目映射windows本地项目中,在windows的pycharm工具中开发用python语言开发项目 ...
- iOS中的round ceil floorf表示的含义
round:如果参数是小数,则求本身的四舍五入. ceil:如果参数是小数,则求最小的整数但不小于本身. floor:如果参数是小数,则求最大的整数但不大于本身.
- openstack changePassword
http://niusmallnan.github.io/_build/html/ 在创建虚拟机时候,通常我们需要让用户填写虚机系统的初始化密码,因为很多人并不习惯使用秘钥方式ssh登录, 设置其用户 ...
- js工厂方式和构造函数
工厂方式 //工厂方式 : 封装函数 function createPerson(name){ //1.原料 var obj = new Object(); //2.加工 obj.name = nam ...
- eclipse 查看变量或方法在什么地方被调用的快捷键
选中方法名,点鼠标右键,菜单里有个”打开调用层次结构 ( Open Call Hierarchy )“,选中或者按下快捷键Ctrl+Alt+H,就在下面栏目里能看到调用的树形结构了. 或者: 1.双击 ...
- sasscore22
1.setting 如果不需要支持ie6,7,请在引入setting文件之前,设置$lte7:false;. $lte7: true !default 表示的是是否兼容it6/7 2.css3 是一 ...
- PHP判断请求是否是ajax请求
首先看一下框架里面是怎样判断的.ThinkPHP:define('IS_AJAX', ((isset($_SERVER['HTTP_X_REQUESTED_WITH']) && str ...