https://www.cnblogs.com/fishpro/p/spring-boot-study-helloworld.html
spring boot小白照着上面的教程搭hello,一切都很顺利,直到....运行时出现了:
看上去像是正常退出,但其实无法访问路径就是不对的,查了查,有2种解决方法。
第一种是在pom.xml里加web jar包,但我已经有web了
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency>另一种是加tomcat,试了试,可以访问路径,但参考以下这篇文章,web jar包里应该已经内嵌tomcat才对?
https://blog.csdn.net/quentinschuman/article/details/103435886
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> <scope>provided</scope> </dependency>anyway,至少能成功了。参考的文档:https://www.jianshu.com/p/3628e1002a55
之后又在/resources/application配置文件修改端口号不生效:(target中的application.properties里没配上)
解决方法:运行maven clean
遇到错误:
[ERROR] [ERROR] Some problems were encountered while processing the POMs: [ERROR] 'dependencyManagement.dependencies.dependency.groupId' for org.spri ngframework.boot:spring-boot-starter-amqp:jar with value 'org.spri ngframework.boot' does not match a valid id pattern. @ org.springframework.boot:spring-boot-dependencies:2.3.4.RELEASE, C:\Users\jiayuezh\.m2\repository\org\springframework\boot\spring-boot-dependencies\2.3.4.RELEASE\spring-boot-dependencies-2.3.4.RELEASE.pom, line 2189, column 18清理Maven的org 下 apache 文件夹,让Maven重新下载jar包,再进行clean
参考文档:https://www.jianshu.com/p/3628e1002a55
clean完再用postman:curl --location --request GET 'http://localhost:6666/hi/say',就能成功获取
但这个时候,就不像刚刚端口没生效时能用chrome访问了(port:8080),只能用IE,很奇怪。
后来还发生了改动代码不生效,必须mvn clean install才生效,解决方法:
https://blog.csdn.net/qq_31806155/article/details/106467317?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.add_param_isCf&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.add_param_isCf