1.SpringbootTest总是报 ‘XXXX’ that could not be found.
##
***************************
APPLICATION FAILED TO START
***************************
Description:
A component required a bean of type 'com.hjt.nosql.elasticsearch.repository.EsProductRepository' that could not be found.
Action:
Consider defining a bean of type 'com.hjt.nosql.elasticsearch.repository.EsProductRepository' in your configuration.
解决方案:
2.Caused by: java.lang.ClassNotFoundException: freemarker.template.Configuration
12:22:49.035 [main] DEBUG com.baomidou.mybatisplus.generator.AutoGenerator - ==========================准备生成文件...==========================
Exception in thread "main" java.lang.NoClassDefFoundError: freemarker/template/Configuration
at com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine.init(FreemarkerTemplateEngine.java:41)
at com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine.init(FreemarkerTemplateEngine.java:36)
at com.baomidou.mybatisplus.generator.AutoGenerator.execute(AutoGenerator.java:179)
at com.baomidou.mybatisplus.generator.FastAutoGenerator.execute(FastAutoGenerator.java:213)
at com.sch.generator.MybatisPlusGenerator.generator(MybatisPlusGenerator.java:60)
at com.sch.generator.MybatisPlusGenerator.main(MybatisPlusGenerator.java:27)
Caused by: java.lang.ClassNotFoundException: freemarker.template.Configuration
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
解决方案:引入依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-freemarker</artifactId>
</dependency>
3.logback爆红
解决方案:
<!-- SpringBoot Web -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<!--排除logback-->
<exclusions>
<exclusion>
<artifactId>spring-boot-starter-logging</artifactId>
<groupId>org.springframework.boot</groupId>
</exclusion>
</exclusions>
</dependency>