当前位置: 移动技术网 > IT编程>开发语言>Java > 学习SpringBoot零碎记录——配置应用URL名称

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

2020年01月03日  | 移动技术网IT编程  | 我要评论

学习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版本导致的不一样

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网