欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

学习SpringBoot零碎记录——配置应用URL名称

程序员文章站 2022-06-22 11:02:49
学习SpringBoot配置应用名称,结果发现坑 到网上找 到 https://blog.csdn.net/qq_40087415/article/details/82497668 server: port:8088 context-path:/springboot-demo 实际,在我的Sprin ......

学习springboot配置应用名称,结果发现坑

到网上找 到 

https://blog.csdn.net/qq_40087415/article/details/82497668

server:
  port:8088
  context-path:/springboot-demo

实际,在我的springboot 的 2.2.2.release 中,是编译不通过的;

而我后来实践发现:

yaml中配置应用名称

 

server:
  port: 8082
  servlet:
    context-path: /study

编译通过,日志如下

 

2020-01-02 22:23:28.851  info 5532 --- [           main] o.apache.catalina.core.standardservice   : starting service [tomcat]
2020-01-02 22:23:28.851  info 5532 --- [           main] org.apache.catalina.core.standardengine  : starting servlet engine: [apache tomcat/9.0.29]
2020-01-02 22:23:28.991  info 5532 --- [           main] o.a.c.c.c.[tomcat].[localhost].[/study]  : initializing spring embedded webapplicationcontext
2020-01-02 22:23:28.991  info 5532 --- [           main] o.s.web.context.contextloader            : root webapplicationcontext: initialization completed in 1596 ms
2020-01-02 22:23:29.334  info 5532 --- [           main] o.s.s.concurrent.threadpooltaskexecutor  : initializing executorservice 'applicationtaskexecutor'
2020-01-02 22:23:29.662  info 5532 --- [           main] o.s.b.w.embedded.tomcat.tomcatwebserver  : tomcat started on port(s): 8082 (http) with context path '/study'
2020-01-02 22:23:29.678  info 5532 --- [           main] com.gaole.study.studyapplication         : started studyapplication in 3.554 seconds (jvm running for 5.242)

所以估计是springboot版本导致的不一样