zoukankan      html  css  js  c++  java
  • springboot 项目 注意事项

    SpringBoot出现下列错误。

    Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package
    Destroy method on bean with name 'org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory' threw an exception


    或者

    Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package
    Destroy method on bean with name 'org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory' threw an exception


    或者
    ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@4b9e255: startup date [Wed Jul 26 13:37:27 CST 2017]; root of context hierarchy


    主要是由于application.java文件没有放在main/java文件夹的原因,因为application.Java 文件不能直接放在main/java文件夹下,必须要建一个包把他放进去
    SpringBoot在写启动类的时候如果不使用@ComponentScan指明对象扫描范围,默认指扫描当前启动类所在的包里的对象,如果当前启动类没有包,则在启动时会报错:
    Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package错误。


    @SpringBootApplication
    @ComponentScan(basePackageClasses=MytestApplication.class)
    public class MytestApplication {


    public static void main(String[] args){
    SpringApplication.run(MytestApplication.class, args);
    }
    }

    @ComponentScan(basePackageClasses=要扫描类.class所在位置的包)-意思是要扫描哪个类所在的包
    ---------------------
    作者:King-Long
    来源:CSDN
    原文:https://blog.csdn.net/u011095110/article/details/76144416

  • 相关阅读:
    YbtOJ#573后缀表达【二分图匹配】
    CF605EIntergalaxy Trips【期望dp】
    YbtOJ#482爬上山顶【凸壳,链表】
    AT4996[AGC034F]RNG and XOR【FWT,生成函数】
    YbtOJ#903染色方案【拉格朗日插值,NTT,分治】
    YbtOJ#832鸽子饲养【凸包,Floyd】
    YbtOJ#463序列划分【二分答案,线段树,dp】
    CF618FDouble Knapsack【结论】
    P3214[HNOI2011]卡农【dp】
    YbtOJ#526折纸游戏【二分,hash】
  • 原文地址:https://www.cnblogs.com/zengpeng/p/10043600.html
Copyright © 2011-2022 走看看