第一个spring boot应用程序

半世苍凉 提交于 2019-12-12 06:10:31

在虚拟机上已经配置好tomcat MySQL容器,用sqllog连接MySQL,导入项目的sql文件,在IDEA上进行spring boot的演示。

创建一个Controller来演示Spring Boot

package com.funtl.hello.spring.boot.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {    
@GetMapping(value = "/")    
public String hello() {        
return "Hello Spring Boot.";    
}
}

启动 HelloSpringBootApplication 的main方法
浏览器访问 http://localhost:8080 即可得到返回内容

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!