idea自带tomcat,搭建好环境后,直接运行demoApplication,然后在浏览器输入localhost:8080/hello
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
@RestController
@EnableAutoConfiguration
public class HelloSpringboot {
@RequestMapping("/hello")
public String say() {
System.out.println("Hello springboot");
return "hello,this is a springboot demo";
}
}