zoukankan      html  css  js  c++  java
  • springBoot基本配置

    Spring Boot 基本配置

    1、新建maven jar工程 使用依赖

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    
    <modelVersion>4.0.0</modelVersion>
    
    <groupId>com.pinyougou</groupId>
    
    <artifactId>springbootdemo-helloworld</artifactId>
    
    <version>0.0.1-SNAPSHOT</version>
    
    <!--spring boot 项目必须继承spring boot 父工程 -->
    
    <parent>
    
    <artifactId>spring-boot-starter-parent</artifactId>
    
    <groupId>org.springframework.boot</groupId>
    
    <version>1.5.6.RELEASE</version>
    
    </parent>
    
    <dependencies>
    
    <!--使用spring boot 开发web项目的基础依赖 -->
    
    <dependency>
    
    <groupId>org.springframework.boot</groupId>
    
    <artifactId>spring-boot-starter-web</artifactId>
    
    </dependency>
    
    </dependencies>
    
    </project>

    2、新建启动类

    package com.springboot;
    
     
    
    import org.springframework.boot.SpringApplication;
    
    import org.springframework.boot.autoconfigure.SpringBootApplication;
    
     
    
    @SpringBootApplication
    
    public class Application {
    
     
    
    public static void main(String[] args) {
    
    SpringApplication.run(Application.class, args);
    
    }
    
    }

    3、启动效果

     

    4、访问

     

    5、添加controller

    package com.springboot.controller;
    
     
    
    import org.springframework.web.bind.annotation.RequestMapping;
    
    import org.springframework.web.bind.annotation.RestController;
    
     
    
    @RestController
    
    public class HelloController {
    
     
    
    @RequestMapping("/hello")
    
    public String hello() {
    
    return "spring boot is so easy to learn!";
    
    }
    
    }

    6、重新启动

     

    7、访问

      

  • 相关阅读:
    linux内核编译
    字符设备驱动ioctl实现用户层内核层通信
    Linux内核完全剖析基于0.12内核
    KVM分析报告
    kvm的vmcall
    kvm源代码分析
    KVM基本概念
    linux系统调用
    UML的9种图例解析(转)
    SurfaceView的基本使用(转)
  • 原文地址:https://www.cnblogs.com/alexzhang92/p/10405493.html
Copyright © 2011-2022 走看看