标签:实现 image blog public highlight host demo control r.java
入门实例 - HelloWorld
File > New > Spring Starter Project
项目创建完成:
这样就完成了项目的创建,下面我们创建一个 HelloController.java
package com.example.demo; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/hello") public class HelloController { static { System.out.println("HelloController was on line!"); } @RequestMapping("/SpringBoot") public String hello() { return "hello Spring Boot"; } }
在浏览器输入 http://localhost:8080/bootdemo/hello/SpringBoot
输出 hello Spring Boot
实现成功!
标签:实现 image blog public highlight host demo control r.java
原文地址:http://www.cnblogs.com/YaphetsDiao/p/7903668.html