(1)运行如下项目,可看出页面输出的内容是“hello spring Boot”
package com.example.demo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class chapter01 implements Cloneable { //标记接口
@GetMapping("/hello")
public String hello(){
return "hello spring Boot";
}
}
(2)因为咱们是刚学java框架技术嘛,肯定是有很多问题的,至于怎么运行项目呢,找到项目主类,右击,具体步骤请看以下图解:
在网页中输入地址,可得页面输出内容:
(3)由于浏览器默认端口是8080,那么我们可以在配置文件修改默认的端口号,如将端口号修改为8443,路径改为/spring-boot,此方法根据个人爱好
server.servlet.context-path=/spring-boot
server.port=8443