美文网首页
SpringBoot(1) - 基础搭建

SpringBoot(1) - 基础搭建

作者: 挨板砖的码农 | 来源:发表于2017-08-22 18:11 被阅读0次

利用SpringBoot框架搭建最简版的Web应用
废话不多说,上干货。

pom.xml 引入

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.6.RELEASE</version>
    </parent>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
    </dependencies>

启动类

@SpringBootApplication
public class MainApplication {

    public static void main(String[] args) throws Exception {
        SpringApplication.run(MainApplication.class, args);
    }
}

测试Action

@RestController
@RequestMapping("simple")
public class SimpleAction {

    @RequestMapping("/index")
    @ResponseBody
    String index() {
        return "Hello World!";
    }
}

效果

image.png

搞定

相关文章

网友评论

      本文标题:SpringBoot(1) - 基础搭建

      本文链接:https://www.haomeiwen.com/subject/wgtiottx.html