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

springBoot基本配置的更多相关文章
- SpringBoot常用配置简介
SpringBoot常用配置简介 1. SpringBoot中几个常用的配置的简单介绍 一个简单的Spring.factories # Bootstrap components org.springf ...
- 在SpringBoot中配置aop
前言 aop作为spring的一个强大的功能经常被使用,aop的应用场景有很多,但是实际的应用还是需要根据实际的业务来进行实现.这里就以打印日志作为例子,在SpringBoot中配置aop 已经加入我 ...
- SpringBoot cache-control 配置静态资源缓存 (以及其中的思考经历)
昨天在部署项目时遇到一个问题,因为服务要部署到外网使用,中间经过了较多的网络传输限制,而且要加载arcgis等较大的文件,所以在部署后,发现页面loading需要很长时间,而且刷新也要重新从服务器下载 ...
- 补习系列(10)-springboot 之配置读取
目录 简介 一.配置样例 二.如何注入配置 1. 缺省配置文件 2. 使用注解 3. 启动参数 还有.. 三.如何读取配置 @Value 注解 Environment 接口 @Configuratio ...
- springboot +redis配置
springboot +redis配置 pom依赖 <dependency> <groupId>org.springframework.boot</groupId> ...
- SpringBoot之配置
回顾 SpringBoot之基础 配置文件 ① 两种全局配置文件(文件名是固定的) 配置文件放在src/main/resources目录或者类路径/config下 application.proper ...
- SpringBoot+Mybatis配置Pagehelper分页插件实现自动分页
SpringBoot+Mybatis配置Pagehelper分页插件实现自动分页 **SpringBoot+Mybatis使用Pagehelper分页插件自动分页,非常好用,不用在自己去计算和组装了. ...
- SpringBoot自动配置源码调试
之前对SpringBoot的自动配置原理进行了较为详细的介绍(https://www.cnblogs.com/stm32stm32/p/10560933.html),接下来就对自动配置进行源码调试,探 ...
- SpringBoot实战之SpringBoot自动配置原理
SpringBoot 自动配置主要通过 @EnableAutoConfiguration, @Conditional, @EnableConfigurationProperties 或者 @Confi ...
- SpringBoot 国际化配置,SpringBoot Locale 国际化
SpringBoot 国际化配置,SpringBoot Locale 国际化 ================================ ©Copyright 蕃薯耀 2018年3月27日 ht ...
随机推荐
- Nuke中新建线程的方法
最近维护合成部门的nuke工具包,发现不少工具的使用方法都很个人化,没有说明文档.这也导致artist在使用工具的时候比较感性,调整参数的时候缺少前后逻辑,长此以往,artist会产生这种意识:只要最 ...
- 《JavaScript设计模式与开发》笔记 7.单例模式
废话一箩筐就这个原来 var instance; return function asdf(name){ if(!this.instance){ this.instance = new asdf(na ...
- VSFTP再配置 我里个去马蛋网上这么多烂文章,走了好多弯路
1.CentOS 进行yum 安装 vsftpd 2.vi /etc/vsftpd/vsftpd.conf 进行配置 3.创建FTP 用户 # useradd –d /var/www -g ftp ...
- 分析Ajax请求并抓取今日头条街拍美图
项目说明 本项目以今日头条为例,通过分析Ajax请求来抓取网页数据. 有些网页请求得到的HTML代码里面并没有我们在浏览器中看到的内容.这是因为这些信息是通过Ajax加载并且通过JavaScript渲 ...
- VC禁止或允许拖拽改变窗口尺寸
创建窗口时用WS_THICKFRAME控制 BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { if( !CMDIFrameWndEx:: ...
- 两招解决异常_Cannot find any information on property 'XXX' in a bean of type 'XXX'的问题
第一招 在进行Java Web项目开发的时候,我碰到过下面这个异常: Cannot find any information on property 'XXX' in a bean of type ' ...
- 53题看透java线程
1) 什么是线程? 线程是操作系统能够进行运算调度的最小单位,它被包含在进程之中,是进程中的实际运作单位.程序员可以通过它进行多处理器编程,你可以使用多线程对运算密集型任务提速.比如,如果一个线程完成 ...
- Java第08次实验提纲(多线程)
PTA与参考资料 题集:多线程 多线程实验参考文件 ThreadReading 实验-基础部分 基础题目MyThread类.PrintTask(讲解线程Thread与任务Runnable相分离的概念) ...
- 【Guava 】Collections – Join and Split
Convert Collections to String Using Joiner Convert List into String Using Joiner @Test public void w ...
- HDOJ 2008 数值统计
#include<iostream> using namespace std; int main() { int n; ) { , y = , z = ; double t; ;i < ...