springboot的配置都在一个叫application.yml或是application.properties里面,如图

在这里面可以配置我们想要的配置参数,基于springboot的web项目,我们可以配置运行时http监听的端口以及应用的contextpath
server:
port: 8888 #设定http监听端口
context-path: /demo #设定应用的context-path
运行web应用,就会监听8888端口
我们这样访问项目:http://localhost:8888/demo/hello

网友评论