zoukankan      html  css  js  c++  java
  • Spring Boot快速建立HelloWorld项目

    Spring Boot使我们更容易去创建基于Spring的独立和产品级的可以”即时运行“的应用和服务。支持约定大于配置,目的是尽可能快地构建和运行Spring应用。

    构建环境

    JDK 6+

    Maven

    创建项目

    1.使用Maven创建一个普通Maven应用即可。

    2.修改pom.xml文件

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

    3.创建java文件SampleController.java

    package hello;

    import org.springframework.boot.*;
    import org.springframework.boot.autoconfigure.*;
    import org.springframework.stereotype.*;
    import org.springframework.web.bind.annotation.*;

    @Controller
    @EnableAutoConfiguration
    public class SampleController {

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

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

    4.Run As Java Application

  • 相关阅读:
    Direct hosting of SMB over TCP/IP
    学习 Linux,302(混合环境): 概念
    脚本
    linux加入windows域
    Internet传输协议-TCP
    vCenter Single Sign On 5.1 best practices
    Zoning and LUN Masking
    Fiber Channel SAN Storage
    How to check WWN and Multipathing on Windows Server
    在Windows中监视IO性能
  • 原文地址:https://www.cnblogs.com/qingyuuu/p/5910044.html
Copyright © 2011-2022 走看看