• Spring boot教程


    1.首先是新建Maven工程
    2.引入Pom依赖
    3.新建一个Controller
    4.运行Main方法
    5.浏览器访问

    pom.xml

    
    <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/maven-v4_0_0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <groupId>com.rsc.spring</groupId>
      <artifactId>boot</artifactId>
      <packaging>war</packaging>
      <version>1.0-SNAPSHOT</version>
      <name>boot Maven Webapp</name>
      <url>http://maven.apache.org</url>
    
      <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.version>1.7</java.version>
      </properties>
    
      <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.2.5.RELEASE</version>
      </parent>
    
      <dependencies>
        <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>3.8.1</version>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
          <groupId>com.fasterxml.jackson.core</groupId>
          <artifactId>jackson-databind</artifactId>
        </dependency>
        <dependency>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-starter-test</artifactId>
          <scope>test</scope>
        </dependency>
    
      </dependencies>
      <build>
        <plugins>
          <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
          </plugin>
    
          <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.2</version>
            <configuration>
              <source>1.7</source>
              <target>1.7</target>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </project>
    

    BaseController

    package com.rsc.spring.controller;
    
    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
    import org.springframework.web.bind.annotation.RequestMapping;
    import org.springframework.web.bind.annotation.ResponseBody;
    import org.springframework.web.bind.annotation.RestController;
    
    /**
     * Created by 58 on 2015/8/18.
     */
    @RestController
    @EnableAutoConfiguration
    public class BaceController {
    
        @RequestMapping("home")
        @ResponseBody
        public String home(){
            return "hello world My love boot";
        }
    
        public static void main(String[] args) {
            SpringApplication.run(BaceController.class,args);
        }
    
    
    }
    
    
  • 相关阅读:
    6th week blog3
    6th week blog2(颜色)
    6th week blog1(CSS单位)
    布局—一侧固定宽度,一侧自适应
    布局—两侧固定,中间自适应
    九宫格
    选项卡
    缓冲运动框架
    封装一些常用的js工具函数-不定时更新(希望大家积极留言,反馈bug^_^)
    在一定[min,max]区间,生成n个不重复的随机数的封装函数
  • 原文地址:https://www.cnblogs.com/ae6623/p/4740808.html
Copyright © 2020-2023  润新知