package com.example.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.lang.annotation.Retention;
@SpringBootApplication
@RestController
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
@GetMapping("/")
public String index() {
return "Hello World!";
}
@GetMapping("/hello")
public String hello() {
return "hello";
}
}
\src\main\resources\application.properties 文件内容默认为空,可以自己设置端口号等配置信息