spring boot-hello world

1.创建maven工程,导入依赖<parent>  <groupId>org.springframework.boot</groupId>  <artifactId>spring-boot-starter-parent</artifactId>  <version>1.5.10.RELEASE</version></parent><dependencies>  <dependency>    <groupId>org.springframework.boot</groupId>    <artifactId>spring-boot-starter-web</artifactId>  </dependency></dependencies>2.创建项目启动类
@SpringBootApplicationpublic class Application {    public static void main(String[] args) {        SpringApplication.run(Application.class, args);    }}3.创建controller
@RestControllerpublic class HelloController {    @GetMapping(value = "/hello")    public String hello(String name){        return "hello " + name;    }}4.运行第2步中的main方法启动项目,浏览器访问:http://localhost:8080/hello?name=world


即使是不成熟的尝试,也胜于胎死腹中的策略。

spring boot-hello world

相关文章:

你感兴趣的文章:

标签云: