最近回顾一下 SpringBoot,我就想简单的运行一下能出来一个东西就行,谁知道不管怎么样都不行,打死都不出来,一直报一个错
这是运行结果:
_..._
.' '. _
/ .-""-\ _/ \
.-| /:. | | |
| \ |:. /.-'-./
| .-'-;:__.' =/
.'= *=|NASA _.='
/ _. | ;
;-.-'| \ |
/ | \ _\ _\
\__/'._;. ==' ==\
\ \ |
/ / /
/-._/-._/
lsy \ `\ \
`-._/._/
2021-11-30 19:28:42.480 INFO 29772 --- [ main] c.l.s.SpringbootMybatisApplication : Starting SpringbootMybatisApplication using Java 1.8.0_161 on Hibernation with PID 29772 (F:\IDEA文件存储\springboot-mybatis\target\classes started by Administrator in F:\IDEA文件存储\springboot-mybatis)
2021-11-30 19:28:42.484 INFO 29772 --- [ main] c.l.s.SpringbootMybatisApplication : No active profile set, falling back to default profiles: default
2021-11-30 19:28:43.883 INFO 29772 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2021-11-30 19:28:43.892 INFO 29772 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2021-11-30 19:28:43.892 INFO 29772 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.55]
2021-11-30 19:28:44.241 INFO 29772 --- [ main] org.apache.jasper.servlet.TldScanner : At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
2021-11-30 19:28:44.249 INFO 29772 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2021-11-30 19:28:44.249 INFO 29772 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1700 ms
Logging initialized using 'class org.apache.ibatis.logging.stdout.StdOutImpl' adapter.
Parsed mapper file: 'file [F:\IDEA文件存储\springboot-mybatis\target\classes\mapper\UserMapper.xml]'
2021-11-30 19:28:44.820 INFO 29772 --- [ main] pertySourcedRequestMappingHandlerMapping : Mapped URL path [/v2/api-docs] onto method [springfox.documentation.swagger2.web.Swagger2Controller#getDocumentation(String, HttpServletRequest)]
2021-11-30 19:28:44.931 INFO 29772 --- [ main] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page template: index
2021-11-30 19:28:44.980 WARN 29772 --- [ main] ion$DefaultTemplateResolverConfiguration : Cannot find template location: classpath:/templates/ (please add some templates or check your Thymeleaf configuration)
2021-11-30 19:28:44.997 WARN 29772 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration': Requested bean is currently in creation: Is there an unresolvable circular reference?
2021-11-30 19:28:45.002 INFO 29772 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2021-11-30 19:28:45.013 INFO 29772 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-11-30 19:28:45.029 ERROR 29772 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
The dependencies of some of the beans in the application context form a cycle:
┌──->──┐
| com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration
└──<-──┘
Action:
Relying upon circular references is discouraged and they are prohibited by default. Update your application to remove the dependency cycle between beans. As a last resort, it may be possible to break the cycle automatically by setting spring.main.allow-circular-references to true.
Process finished with exit code 1
我开始检查代码:
我在想是不是pom文件冲突什么的,打开看了一下,没啥毛病:
<dependencies>
<!--模板引擎thymeleaf-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<!--web的支持 底层还是springmvc-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!--mybatis框架的支持-->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.4</version>
</dependency>
<!--java连接mysql的版本-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.13</version>
</dependency>
<!--lombok-->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<!--单元测试-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!--引入接口文档Swagger-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.7.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.7.0</version>
</dependency>
<!--分页插件-->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.5</version>
</dependency>
<!-- 添加servlet依赖模块 -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
<!-- 添加jstl标签库依赖模块 -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<!--添加tomcat依赖模块.-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</dependency>
<!-- 使用jsp引擎,springboot内置tomcat没有此依赖 -->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
后面一些jsp的应该不会有冲突…
yml文件也没问题…
#项目名称
spring:
application:
name: t119springboot-mybatis
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/mybatis?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8
username: root
password: root
mvc:
view:
prefix: /WEB-INF/jsp/
suffix: .jsp
#项目端口
server:
port: 8080
#配置mybatis的内容
mybatis:
mapper-locations: mapper/*Mapper.xml
type-aliases-package: com.changan.entity
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
实在想不出来了打开之前的项目看了一下,能运行…代码cv一下放这个又不行了…
我也不知道我怎么想到的,我感觉这玩意有点问题,会不会是版本太高了…
我把版本改成
<version>2.4.5</version>
谁知道呢,还真行…无了个语
这是运行结果
_..._
.' '. _
/ .-""-\ _/ \
.-| /:. | | |
| \ |:. /.-'-./
| .-'-;:__.' =/
.'= *=|NASA _.='
/ _. | ;
;-.-'| \ |
/ | \ _\ _\
\__/'._;. ==' ==\
\ \ |
/ / /
/-._/-._/
lsy \ `\ \
`-._/._/
2021-11-30 19:47:10.992 INFO 30540 --- [ main] c.l.s.SpringbootMybatisApplication : Starting SpringbootMybatisApplication using Java 1.8.0_161 on Hibernation with PID 30540 (F:\IDEA文件存储\springboot-mybatis\target\classes started by Administrator in F:\IDEA文件存储\springboot-mybatis)
2021-11-30 19:47:10.996 INFO 30540 --- [ main] c.l.s.SpringbootMybatisApplication : No active profile set, falling back to default profiles: default
2021-11-30 19:47:12.370 INFO 30540 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2021-11-30 19:47:12.380 INFO 30540 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2021-11-30 19:47:12.380 INFO 30540 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.45]
2021-11-30 19:47:12.667 INFO 30540 --- [ main] org.apache.jasper.servlet.TldScanner : At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
2021-11-30 19:47:12.675 INFO 30540 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2021-11-30 19:47:12.675 INFO 30540 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1622 ms
Logging initialized using 'class org.apache.ibatis.logging.stdout.StdOutImpl' adapter.
Parsed mapper file: 'file [F:\IDEA文件存储\springboot-mybatis\target\classes\mapper\UserMapper.xml]'
2021-11-30 19:47:13.331 INFO 30540 --- [ main] pertySourcedRequestMappingHandlerMapping : Mapped URL path [/v2/api-docs] onto method [springfox.documentation.swagger2.web.Swagger2Controller#getDocumentation(String, HttpServletRequest)]
2021-11-30 19:47:13.406 INFO 30540 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2021-11-30 19:47:13.452 INFO 30540 --- [ main] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page template: index
2021-11-30 19:47:13.504 WARN 30540 --- [ main] ion$DefaultTemplateResolverConfiguration : Cannot find template location: classpath:/templates/ (please add some templates or check your Thymeleaf configuration)
2021-11-30 19:47:13.613 INFO 30540 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2021-11-30 19:47:13.614 INFO 30540 --- [ main] d.s.w.p.DocumentationPluginsBootstrapper : Context refreshed
2021-11-30 19:47:13.630 INFO 30540 --- [ main] d.s.w.p.DocumentationPluginsBootstrapper : Found 1 custom documentation plugin(s)
2021-11-30 19:47:13.680 INFO 30540 --- [ main] s.d.s.w.s.ApiListingReferenceScanner : Scanning for api listing references
2021-11-30 19:47:13.845 INFO 30540 --- [ main] c.l.s.SpringbootMybatisApplication : Started SpringbootMybatisApplication in 3.356 seconds (JVM running for 6.162)
这就很尴尬了