2019.6.8错误记录:SpringBoot用了@SpringBootApplication却扫不到包 & Type javax.xml.bind.JAXBContext not present

SpringBoot用了@SpringBootApplication却扫不到包

以为用了@SpringBootApplication就可以不写扫包了,没想到@SpringBootApplication只默认扫描该类包

就该早点看源码,还倒腾了好久

解决方法:

如果App类不跟Controller类一起,还是的加扫包

要么加:@ComponentScan("com.ymk.api.controller")

要么:@SpringBootApplication(scanBasePackages = "com.ymk.api.controller")

Type javax.xml.bind.JAXBContext not present

JDK版本太高了,高版本JDK默认不装配JAXB

解决方法:

原文:https://blog.csdn.net/alger_magic/article/details/83041811 

手动加包

SpringBoot 1.5





    javax.xml.bind
    jaxb-api
    2.2.11


    com.sun.xml.bind
    jaxb-core
    2.2.11


    com.sun.xml.bind
    jaxb-impl
    2.2.11


    javax.activation
    activation
    1.1.1

SpringBoot 2.0

		
		
		   javax.xml.bind
		    jaxb-api
		
		
		    com.sun.xml.bind
		    jaxb-impl
		    2.3.0
		
		
		    org.glassfish.jaxb
		    jaxb-runtime
		    2.3.0
		 
		
		    javax.activation
		    activation
		    1.1.1
		
		

 

你可能感兴趣的:(错误日志)