@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 ...
随机推荐
- Python中__init__方法
注意1.__init__并不相当于C#中的构造函数,执行它的时候,实例已构造出来了. 1 2 3 4 5 class A(object): def __init__(self,name): ...
- VMware Workstation 11, 客户机Ubuntu14.04.1 LTS 64bit,宿主机Windows 8.1 64bit,剪贴板共享(copy and paste)失效问题
Ubuntu14.04是从12.04升级上来的,因为GUI性能的原因相继装了Xubunbu和Lubuntu的包(Lubuntu的桌面果然轻量级,但是请神容易送神难,卸载Xubuntu很麻烦,就先放下了 ...
- autoit使用WMIC获取硬件信息
效果图: 直接上源码了 #cs ---------------------------------------------------------------------------- AutoIt ...
- php命名空间和autoload
参考: 1.http://www.cnblogs.com/thinksasa/p/3423480.html PHP的命名空间 2.http://blog.jjonline.cn/phptech/15 ...
- Fuel快速安装OpenStack
1 介绍 1.1 关于 Mirantis Mirantis,一家很牛逼的openstack服务集成商,他是社区贡献排名前5名中唯一一个靠软件和服务吃饭的公司(其他分别是Red Hat, HP, IBM ...
- 木马轮播图代码Jq
效果图(将就一下) <!DOCTYPE html> <html lang="en"> <head> <meta charset=" ...
- 【SSM 6】Spring+SpringMVC+Mybatis框架搭建步骤
一.整体概览 首先看maven工程的创建 二.各层的文件配置 2.1,SSM父工程 <span style="font-family:KaiTi_GB2312;font-size:18 ...
- Opencv配置问题_Error LNK2019
终于配好opencv(Win7 64位+VS2013+opencv2.4.9),兴奋的写了第一个程序(当然是显示lena的玉照了): #include <opencv2\opencv.hpp&g ...
- NHibernate系列文章二十三:NHibernate查询之Criteria查询(附程序下载)
摘要 上一篇文章介绍了NHibernate HQL,他的缺点是不能够在编译时发现问题.如果数据库表结构有改动引起了实体关系映射的类有改动,要同时修改这些HQL字符串.这篇文章介绍NHibernate面 ...
- R12_专题知识总结提炼-AR模块
应收模块简介 应收模块是用来为企业提供应收款管理的模块. 当企业销售一笔商品或者发生其他影响收入和现金的业务的时候,需要在应收模块记账. 本文档以R12为例,11i可参考,只针对简单业务情况考虑,将应 ...