首先讲一下SpringBootApplication注解
源码定义为

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
@SpringBootConfiguration
@EnableAutoConfiguration
@ComponentScan(excludeFilters = {
@Filter(type = FilterType.CUSTOM, classes = TypeExcludeFilter.class),
@Filter(type = FilterType.CUSTOM, classes = AutoConfigurationExcludeFilter.class) })
public @interface SpringBootApplication {

所以这一个注解就相当于配置了EnableAutoConfiguration
如果在自己的项目里 SpringBootApplication 和 EnableAutoConfiguration 都配置了 就会有问题。这个是我最开始的理解
但是试了一下 把SpringBootApplication去掉 然后改成如下的形式 还是不行

// @SpringBootApplication
@EnableTransactionManagement // 开启注解式事务 , DataSourceTransactionManagerAutoConfiguration.class
@EnableAutoConfiguration(exclude = { DataSourceAutoConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class, HibernateJpaAutoConfiguration.class })
@EnableAspectJAutoProxy(proxyTargetClass = true, exposeProxy = true)
@Configuration
@ComponentScan(includeFilters={}, excludeFilters = { @Filter(type = FilterType.CUSTOM, classes = TypeExcludeFilter.class),
@Filter(type = FilterType.CUSTOM, classes = AutoConfigurationExcludeFilter.class)})
// @ComponentScan
// @Configuration //这是一个配置类,与@Service、@Component的效果类似。spring会扫描到这个类,@Bean才会生效,将ThreadPoolBean这个返回值类注册到spring上下文环境中
// @EnableConfigurationProperties(MyWebServerConfigurationProperties.class) //通过这个注解, 将MyWebServerConfigurationProperties这个类的配置到上下文环境中,本类中使用的@Autowired注解注入才能生效
public class XxxApplication extends BaseApplication {

网上查资料 最终的解决办法如下

spring:
application:
name: coffee
autoconfigure.exclude: org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration, org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration

具体原因还没找到,先记录一下 ,以后在查找原因

spring boot EnableAutoConfiguration exclude 无效的更多相关文章

  1. Spring Boot @EnableAutoConfiguration和 @Configuration的区别

    Spring Boot @EnableAutoConfiguration和 @Configuration的区别 在Spring Boot中,我们会使用@SpringBootApplication来开启 ...

  2. Spring Boot @EnableAutoConfiguration解析

    刚做后端开发的时候,最早接触的是基础的spring,为了引用二方包提供bean,还需要在xml中增加对应的包<context:component-scan base-package=" ...

  3. Spring boot MultipartResolver

    [参考文章]:Required MultipartFile parameter 'file' is not present [参考文章]:Springboot2.0中WebMvcConfigurerA ...

  4. spring boot到底帮我们做了那些事?

    一.前言     上一篇介绍了注解,也是为这一篇做铺垫,传统的都是通过配置文件来启动spring,那spring boot到底是做了什么能让我们快速开发昵? 二.启动原理     看下程序启动的入口, ...

  5. spring boot 自动配置原理

    1).spring boot启动的时候加载主配置类,开启了自动配置功能@EnableAutoConfiguration,先看一下启动类的main方法 public ConfigurableApplic ...

  6. Spring Boot系列——Spring Boot如何启动

    Spring Boot启动过程 ​上篇<Spring Boot系列--5分钟构建一个应用>介绍了如何快速创建一个Spring Boot项目并运行.虽然步骤少流程简单,为开发者省去了很多重复 ...

  7. Spring Boot之实现自动配置

    GITHUB地址:https://github.com/zhangboqing/springboot-learning 一.Spring Boot自动配置原理 自动配置功能是由@SpringBootA ...

  8. Spring Boot 概念知识

    转 http://rapharino.com/coder/Spring-Boot-Induction/ Spring Boot Induction 发表于 2016-10-29   |   分类于 c ...

  9. 008-Spring Boot @EnableAutoConfiguration深入分析、内部如何使用EnableAutoConfiguration

    一.EnableAutoConfiguration 1.EnableAutoConfiguration原理 springboot程序入口使用注解@SpringBootApplication,Sprin ...

随机推荐

  1. Android Studio总结

    课程背景 相信大家对Android Studio已经不陌生了,Android Studio是Google于2013 I/O大会针对Android开发推出的新的开发工具,目前很多开源项目都已经在采用,G ...

  2. angularjs中设置select的选中项

    最近用angularjs比较多,里面有很多自己的方法,都不咋会用,这篇只是个笔记,防止自己忘记 <select style="width:100%" ng-model=&qu ...

  3. 洛谷P4549 裴蜀定理 / Min

    原题链接 题目描述 给出n个数(A1...An)现求一组整数序列(X1...Xn)使得S=A1X1+...AnXn>0,且S的值最小 输入输出格式 输入格式: 第一行给出数字N,代表有N个数 下 ...

  4. stm32的flash操作注意事项

    从STM32编程手册中,可以知道:在进行写或擦除操作时,不能进行代码或数据的读取操作. 比如:你在写Flash期间有接收串口数据,很有可能会丢串口数据. 因为比较耗时,所以,在写数据时,CPU不会执行 ...

  5. JDOJ 1133 分段公司利润

    JDOJ 1133: 分段公司利润 JDOJ传送门 Description 企业发放的奖金根据利润提成.利润低于或等于100000元的,奖金可提10%; 利润高于100000元,低于200000元(1 ...

  6. 基于react开发package.json的配置

    项目依赖 react网页开发的3件套: react, react-dom, react-router-dom, redux, react-reduxreact的UI组件库: antd(pc端), an ...

  7. selenium--设置浏览器的位置和高度宽度

    前戏 web自动化的时候,如果你只有一个显示器,这时如果启动了谷歌浏览器,占据了整个显示器,那你肯定是没办法干其他的事情了.当然,你也可以使用phantomjs无头浏览器,那浏览器的兼容性你又不能不测 ...

  8. Elasticsearch状态API接口排障总结

    ES的Restful API,共四类API: 1. 检查集群.节点.索引等健康与否,以及获取其相应状态. 2. 管理集群.节点.索引及元数据 3. 执行CRUB操作(即:增删查改) 4. 执行高级操作 ...

  9. shell equal

    #!/bin/shzero=0 status=1 let status=0 if [[ $status -eq $zero ]];then echo "bu >= 3.6"e ...

  10. c++隐式转换(implicit conversion)

    1.缘由 最近在使用nlohmann的json,发现有些地方不是特别好用,所以就想自己修改一下(目的是为了增加类似jsoncpp中可以//增加注释的功能),在看源码的时候看到了一个迷惑的地方,就是解析 ...