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、访问

最新文章

  1. j2ee log4j集中式日志解决方案logpool-v0.2
  2. java IO输入输出流中的各种字节流,字符流类
  3. angularjs中provider,factory,service的区别和用法
  4. 20个Linux服务器安全强化建议(三)
  5. UNIX 和 LINUX
  6. 跨服务器之间的session共享
  7. scikit-learn主要模块和基本使用方法
  8. sencha combobox下拉框不用jsonstore,直接使用字符串数组做数据源
  9. 修改jsp文件tomcat发布失败(Could not delete May be locked by another process)
  10. 【NOIP模拟题】【二分】【倍增】【链表】【树规】
  11. Spring-Junit4
  12. day20&lt;IO流&gt;
  13. Couchbase忘记登录密码怎么办
  14. 巧用border效果
  15. android-UI组件(四):AdapterView及其子类
  16. 【刷题】UOJ #374 【ZJOI2018】历史
  17. 从网站上扒网页,保存为file文件格式
  18. Spring Boot + Spring Cloud 实现权限管理系统 (集成 Shiro 框架)
  19. 9.12 开课第9天 (JS脚本语音:基础语法、语句)
  20. CentOS6.5本地yum源配置

热门文章

  1. 代码编辑器之sublime text插件
  2. Eclipse创建一个mybatis工程实现连接数据库查询
  3. 用windows自带的ftp.exe实现断点续传的方法
  4. JIRA 资源
  5. [Easyui - Grid]为easyui的datagrid、treegrid增加表头菜单,用于显示或隐藏列
  6. 《Java并发编程实战》笔记-Happens-Before规则
  7. 微服务之分布式跟踪系统(springboot+zipkin+mysql)
  8. Mina2 udp--zhengli
  9. 学习笔记之C / C++
  10. PHP中常用的数组函数总结