1.创建maven 项目 quickstart类型

2.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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <groupId>com.test</groupId>
<artifactId>springboot</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging> <name>springboot</name>
<url>http://maven.apache.org</url> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<!-- Inherit defaults from Spring Boot -->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>0.5.0.BUILD-SNAPSHOT</version>
</parent>
<!-- Add typical dependencies for a web application -->
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<!-- <exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions> -->
</dependency>
<!-- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency> -->
</dependencies>
<!-- Package as an executable JAR -->
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<!-- Allow access to Spring milestones and snapshots -->
<!-- (you don't need this if you are using anything after 0.5.0.RELEASE) -->
<repositories>
<repository>
<id>spring-snapshots</id>
<url>http://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<url>http://repo.spring.io/milestone</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<url>http://repo.spring.io/snapshot</url>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<url>http://repo.spring.io/milestone</url>
</pluginRepository>
</pluginRepositories> </project>

3.application.properties

4.启动类

package com.test.springboot;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.test.SpringApplicationConfiguration; /**
* Hello world!
*
*/
@SpringApplicationConfiguration
@EnableConfigurationProperties({UserController.class})
@EnableAutoConfiguration
public class App
{
public static void main( String[] args )
{
SpringApplication.run(App.class, args);
}
}

5.控制器

package com.test.springboot;

import java.util.Properties;
import java.util.Set; import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; @RestController
public class UserController { @Value("${com.dudu.name}")
private String name;
@Value("${com.dudu.want}")
private String want; @RequestMapping("/")
public String hexo(){
Properties props = System.getProperties();
Set<Object> set = props.keySet();
StringBuilder strb = new StringBuilder(); for(Object obj:set){
strb.append(obj+":\t"+props.get(obj)+"<br/>");
}
return strb.toString();
}
}

6.启动

SpringBoot初步的更多相关文章

  1. springBoot(1)---springboot初步理解

    springboot初步理解 在没有用SpringBoot之前,我们用spring和springMVC框架,但是你要做很多比如: (1)配置web.xml,加载spring和spring mvc 2) ...

  2. Spring-Boot - 初步搭建

    official document:http://projects.spring.io/spring-boot/ 项目代码: https://github.com/chenxing12/springb ...

  3. SpringBoot初步介绍及安装

    SpringBoot的四个核心: 自动配置: 起步依赖: 命令行界面: Actuator: SpringBoot的web起步依赖:org.springframework.boot:spring-boo ...

  4. 小梵同学 GO!

    刘德翠 1. Vue.js实战读书笔记(1) 2.Vue.js实战读书笔记--计算属性 3. Vue.js实战读书笔记--v-bind及class与style绑定 4. Vue.js实战读书笔记--内 ...

  5. Springboot与ActiveMQ、Solr、Redis中分布式事物的初步探索

    Springboot与ActiveMQ.Solr.Redis中分布式事物的初步探索 解决的场景:事物中的异步问题,当要求数据库与solr服务器的最终一致时. 程序条件: 利用消息队列,当数据库添加成功 ...

  6. SpringSecurity在Springboot下使用的初步体验

    SpringSecurity曾经在十年前非常火热,只要是做权限系统,当时几乎非用它不可,记得是在XML文件里一堆的配置.曾几何时,Shiro冒了出来,以其简洁和轻量的风格慢慢地捕获了众多码农的心,从此 ...

  7. SpringBoot项目的创建流程(初步)

    小伙伴们在学习的过程中大概也发现了这两个框架需要我们手动配置的地方非常多,不过做JavaEE开发的小伙伴们肯定也听说过“约定大于配置”这样一句话,就是说系统,类库,框架应该假定合理的默认值,而非要求提 ...

  8. 二、初步认识springBoot的pom.xml

    1.  大体结构 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www. ...

  9. SpringBoot(十四):SpringCloud初步认识

    SpringCloud是一个基于SpringBoot实现的云应用开发工具,它为开发人员提供了一些工具来快速构建分布式系统中的一些常见模式(例如配置管理.服务发现.断路器.智能路由.微代理.控制总线.一 ...

随机推荐

  1. Linux系统bash shell之历史命令

    1.相关变量: HISTSIZE: 定义命令历史记录的条数 HISTFILE: 定义命令储存的文件,一般是 ~/.bash_history HISTFILESIZE: 定义了历史文件记录历史的条数 H ...

  2. 如何在Windows下用cpu模式跑通py-faster-rcnn 的demo.py

    关键字:Windows.cpu模式.Python.faster-rcnn.demo.py 声明:本篇blog暂时未经二次实践验证,主要以本人第一次配置过程的经验写成.计划在7月底回家去电脑城借台机子试 ...

  3. SPFA【模板】单源最短路径

    题目传送 https://www.luogu.org/problem/show?pid=3371没啥解释,SPFA纯模版qaq//Gang #include<iostream> #incl ...

  4. Google 视频编码格式 VP9 究竟厉害在哪里

    近期 Google 已经开始研究 VP10 了,VP10 是一个由 WebM 和 Motroska 包含的开放.免费视频编解码器.Google 也已利用 VP10 来处理 YouTube 4K 视频. ...

  5. IDEA上传项目至git

    今天来分享一下从idea上传项目至coding的过程. 本文基于windows系统. idea提供了很方便的控制git的界面化操作,除了安装git和一些必要的配置之外,用到命令行的地方会非常少. 1: ...

  6. Codeforces 830C On the Bench

    题意:给你n个数,问有多少种排列方式使得任意两个相邻的数的乘积都不是完全平方数 我好弱,被组合和数论吊着打... 首先我们可以把每个数中固有的完全平方数给分离出来,那么答案其实就只与处理后的序列相关. ...

  7. Model中内部类meta详解

    Django 模型类的Meta是一个内部类,它用于定义一些Django模型类的行为特性. 以下对此作一总结: Model 元数据就是 "不是一个字段的任何数据" -- 比如排序选项 ...

  8. 发红包android

    立即春节,写个应景的控件         思路分析 1.红包沿着不同的轨迹由上往下运动 2.当手指捕获到一个红包,红包停止原先的运动,能够随着手指的滑动做跟手操作 3.当手指动作停止后,红包放大 4. ...

  9. 《程序设计方法》【PDF】下载

    内容简介 <程序设计方法>主要以方法为主导,结合C语言,把程序设计方法学研究中若干成熟的理论和方法用通俗易懂的语言描述出来.<程序设计方法>还选取趣味性强.技巧性高.能够启发学 ...

  10. jspsmart(保存文件)+poi(读取excel文件)操作excel文件

    写在前面: 项目环境:jdk1.4+weblogic 需求:能上传excel2003+2007 由于项目不仅需要上传excel2003,还要上传excel2007,故我们抛弃了jxl(只能上传exce ...