• SpringBoot快速HelloWorld入门


    1、新建maven项目

    2、pom.xml 里添加SpringBoot所依赖的jar包

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

      保存后、自动下载这一系列的相关的jar包(太多的无法完全截图)

    3、在src/main/java 目录下新建package   com.st.controller   

    4、在 controller 中新建

    TestController.java
    package com.st.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.RestController;
    
    @RestController
    @EnableAutoConfiguration
    public class TestController {
    	@RequestMapping("/hello")   //访问地址http://localhost:8080/hello
    	public String hello(){
    		return "success";
    	}
    	
    	
    	public static void main(String[] args) {
    		//运行
    		SpringApplication.run(TestController.class, args);
    	}
    	
    }
    

      

  • 相关阅读:
    linux设置定时任务的方法(自己总结)
    SecureCRT上传和下载文件
    ajax上传文件类型
    分页业务逻辑
    $.load
    数组中多条对象去重方式
    jquery cookie
    鼠标滚轮事件(浏览器兼容性写法)
    用cookie保存用户的登录信息,规定保存的期限
    获取url参数值
  • 原文地址:https://www.cnblogs.com/QW-lzm/p/7667208.html
Copyright © 2020-2023  润新知