SpringBoot类文件具有错误的版本 61.0, 应为 55.0
2023-12-13 23:19:40
4.SpringBoot入门案例
每一个从你生命中路过的人,都在教你成长,感恩的心,感谢一程陪伴,感谢曾经有你
spring learn
https://spring.io/projects/spring-boot#learn
Developing Your First Spring Boot Application
与之前开发最大的不同就是在于引入的依赖
启动 springboot项目出错
原因是:jdk 版本(jdk11.0.11) 与 springboot 版本(2.4.2) 不匹配
之前:D:\repository\org\springframework\boot\spring-boot\3.1.1
现在:D:\repository\org\springframework\boot\spring-boot\2.4.2
本地maven仓库:
E:\workspace\springbootdemo\springbootdemo1\src\main\java\com\aifeng\controller\HelloController.java:3:47
java: 无法访问org.springframework.web.bind.annotation.RequestMapping
错误的类文件: /D:/repository/org/springframework/spring-web/6.0.10/spring-web-6.0.10.jar!/org/springframework/web/bind/annotation/RequestMapping.class
类文件具有错误的版本 61.0, 应为 55.0
请删除该文件或确保该文件位于正确的类路径子目录中。
引入匹配的springboot版本依赖 :
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.aifeng</groupId>
<artifactId>springbootdemo1</artifactId>
<version>1.0-SNAPSHOT</version>
<!--查看D盘本地仓库中引入的springBoot的版本 - 引入 3.1.1
D:\repository\org\springframework\boot\spring-boot\3.1.1
- - - - -
说明:
- - - - -
- 1.所有的springboot项目都会直接或者间接的继承spring-boot-starter-parent
- 2.
-->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.2</version>
</parent>
<!--
- starter : 一系列依赖, 是一个集合
- 引入SpringWeb、 SpringMVC 相关的依赖
-->
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<!--可以将project打包为一个可以执行的jar-->
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
springboot 正常启动
"C:\Program Files\Java\jdk-11.0.11\bin\java.exe" -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true "-Dmanagement.endpoints.jmx.exposure.include=*" "-javaagent:D:\down_tools\idea20230103\idea2023\IntelliJ IDEA 2023.1.3\lib\idea_rt.jar=56465:D:\down_tools\idea20230103\idea2023\IntelliJ IDEA 2023.1.3\bin" -Dfile.encoding=UTF-8 -classpath E:\workspace\springbootdemo\springbootdemo1\target\classes;D:\repository\org\springframework\boot\spring-boot-starter-web\2.4.2\spring-boot-starter-web-2.4.2.jar;D:\repository\org\springframework\boot\spring-boot-starter\2.4.2\spring-boot-starter-2.4.2.jar;D:\repository\org\springframework\boot\spring-boot\2.4.2\spring-boot-2.4.2.jar;D:\repository\org\springframework\boot\spring-boot-autoconfigure\2.4.2\spring-boot-autoconfigure-2.4.2.jar;D:\repository\org\springframework\boot\spring-boot-starter-logging\2.4.2\spring-boot-starter-logging-2.4.2.jar;D:\repository\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;D:\repository\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;D:\repository\org\slf4j\slf4j-api\1.7.30\slf4j-api-1.7.30.jar;D:\repository\org\apache\logging\log4j\log4j-to-slf4j\2.13.3\log4j-to-slf4j-2.13.3.jar;D:\repository\org\apache\logging\log4j\log4j-api\2.13.3\log4j-api-2.13.3.jar;D:\repository\org\slf4j\jul-to-slf4j\1.7.30\jul-to-slf4j-1.7.30.jar;D:\repository\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;D:\repository\org\springframework\spring-core\5.3.3\spring-core-5.3.3.jar;D:\repository\org\springframework\spring-jcl\5.3.3\spring-jcl-5.3.3.jar;D:\repository\org\yaml\snakeyaml\1.27\snakeyaml-1.27.jar;D:\repository\org\springframework\boot\spring-boot-starter-json\2.4.2\spring-boot-starter-json-2.4.2.jar;D:\repository\com\fasterxml\jackson\core\jackson-databind\2.11.4\jackson-databind-2.11.4.jar;D:\repository\com\fasterxml\jackson\core\jackson-annotations\2.11.4\jackson-annotations-2.11.4.jar;D:\repository\com\fasterxml\jackson\core\jackson-core\2.11.4\jackson-core-2.11.4.jar;D:\repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.11.4\jackson-datatype-jdk8-2.11.4.jar;D:\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.11.4\jackson-datatype-jsr310-2.11.4.jar;D:\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.11.4\jackson-module-parameter-names-2.11.4.jar;D:\repository\org\springframework\boot\spring-boot-starter-tomcat\2.4.2\spring-boot-starter-tomcat-2.4.2.jar;D:\repository\org\apache\tomcat\embed\tomcat-embed-core\9.0.41\tomcat-embed-core-9.0.41.jar;D:\repository\org\glassfish\jakarta.el\3.0.3\jakarta.el-3.0.3.jar;D:\repository\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.41\tomcat-embed-websocket-9.0.41.jar;D:\repository\org\springframework\spring-web\5.3.3\spring-web-5.3.3.jar;D:\repository\org\springframework\spring-beans\5.3.3\spring-beans-5.3.3.jar;D:\repository\org\springframework\spring-webmvc\5.3.3\spring-webmvc-5.3.3.jar;D:\repository\org\springframework\spring-aop\5.3.3\spring-aop-5.3.3.jar;D:\repository\org\springframework\spring-context\5.3.3\spring-context-5.3.3.jar;D:\repository\org\springframework\spring-expression\5.3.3\spring-expression-5.3.3.jar com.aifeng.SpringBootDemoDemo1Application
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.4.2)
2023-12-13 21:50:45.420 INFO 20892 --- [ main] c.aifeng.SpringBootDemoDemo1Application : Starting SpringBootDemoDemo1Application using Java 11.0.11 on DESKTOP-39CMD4K with PID 20892 (E:\workspace\springbootdemo\springbootdemo1\target\classes started by 86182 in E:\workspace\springbootdemo)
2023-12-13 21:50:45.422 INFO 20892 --- [ main] c.aifeng.SpringBootDemoDemo1Application : No active profile set, falling back to default profiles: default
2023-12-13 21:50:45.900 INFO 20892 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2023-12-13 21:50:45.905 INFO 20892 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2023-12-13 21:50:45.905 INFO 20892 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.41]
2023-12-13 21:50:45.906 INFO 20892 --- [ main] o.a.catalina.core.AprLifecycleListener : Loaded Apache Tomcat Native library [1.2.24] using APR version [1.7.0].
2023-12-13 21:50:45.906 INFO 20892 --- [ main] o.a.catalina.core.AprLifecycleListener : APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
2023-12-13 21:50:45.906 INFO 20892 --- [ main] o.a.catalina.core.AprLifecycleListener : APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true]
2023-12-13 21:50:45.908 INFO 20892 --- [ main] o.a.catalina.core.AprLifecycleListener : OpenSSL successfully initialized [OpenSSL 1.1.1g 21 Apr 2020]
2023-12-13 21:50:45.945 INFO 20892 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2023-12-13 21:50:45.945 INFO 20892 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 482 ms
2023-12-13 21:50:46.033 INFO 20892 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2023-12-13 21:50:46.122 INFO 20892 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2023-12-13 21:50:46.130 INFO 20892 --- [ main] c.aifeng.SpringBootDemoDemo1Application : Started SpringBootDemoDemo1Application in 0.93 seconds (JVM running for 1.599)
正常启动
5.快速构建SpringBoot项目
Application in 0.93 seconds (JVM running for 1.599)
**正常启动**
[外链图片转存中...(img-RIokSvbU-1702477357923)]
##### 5.快速构建SpringBoot项目
文章来源:https://blog.csdn.net/fengzige1993/article/details/134983697
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。 如若内容造成侵权/违法违规/事实不符,请联系我的编程经验分享网邮箱:veading@qq.com进行投诉反馈,一经查实,立即删除!
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。 如若内容造成侵权/违法违规/事实不符,请联系我的编程经验分享网邮箱:veading@qq.com进行投诉反馈,一经查实,立即删除!