1.创建一个helloworld主程序类
/** * @SpringBootApplication 用来标注一个主程序类,这是一个SpringBoot应用 */ @SpringBootApplication public class SpringBootHellowordConfigApplication { public static void main(String[] args) { //Spring应用启动 SpringApplication.run(SpringBootHellowordConfigApplication.class,args); } } 2.写一个controller
@Controller public class HelloController { @ResponseBody @RequestMapping("/hello") public String helloController(){ return "hello controller"; } } 3.运行主配置类,后查看端口号
4.浏览器运行: 即可