springBoot学习之路之自动配置细节篇

我们在创建一个springboot项目的时候会让springboot替我们自动配置许多的自动配置。那么我们怎么知道一个springboot项目启动了那些?一般情况下自动配置需要在一定条件下才能生效。此时我们可以在我们的application.properties 里面配置

#开启springboot的debug
debug=true
配置这个注解可以在控制台看到匹配与不匹配的属性配置

匹配属性如下:
Positive matches:

AopAutoConfiguration matched:
- @ConditionalOnProperty (spring.aop.auto=true) matched (OnPropertyCondition)

AopAutoConfiguration.ClassProxyingConfiguration matched:
- @ConditionalOnMissingClass did not find unwanted class ‘org.aspectj.weaver.Advice’ (OnClassCondition)
- @ConditionalOnProperty (spring.aop.proxy-target-class=true) matched (OnPropertyCondition)

DispatcherServletAutoConfiguration matched:
- @ConditionalOnClass found required class ‘org.springframework.web.servlet.DispatcherServlet’ (OnClassCondition)
- found ‘session’ scope (OnWebApplicationCondition)
不匹配如下:
Negative matches:

ActiveMQAutoConfiguration:
Did not match:
- @ConditionalOnClass did not find required class ‘javax.jms.ConnectionFactory’ (OnClassCondition)

AopAutoConfiguration.AspectJAutoProxyingConfiguration:
Did not match:
- @ConditionalOnClass did not find required class ‘org.aspectj.weaver.Advice’ (OnClassCondition)

ArtemisAutoConfiguration:
Did not match:
- @ConditionalOnClass did not find required class ‘javax.jms.ConnectionFactory’ (OnClassCondition)
- 这样我们就可以看到我们启动和启用不成功的配置,以此得到springboot自动配置启用报告。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值