第一个springboot项目
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
package com.inmind;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication//表示默认启动项
|
||||
public class SpringbootWebQuickstartApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(SpringbootWebQuickstartApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,17 @@
|
||||
package com.inmind.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
//当前类是请求处理类
|
||||
@RestController
|
||||
public class HelloController {
|
||||
|
||||
//接收到请求资源路径为/hello,就由该方法处理请求
|
||||
@RequestMapping("/hello")
|
||||
public String hello(){
|
||||
String s = "hello world";
|
||||
System.out.println(s);
|
||||
return s;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user