我们在创建一个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自动配置启用报告。