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.启动

最新文章

  1. 【强烈推荐】数据库迁移利器:Migrator.Net
  2. 最牛B的编码套路 - 呦呦鹿鸣 - 博客频道 - CSDN.NET
  3. uva10167 Birthday Cake
  4. 【codevs3945】 完美拓印
  5. poj 题目分类(1)
  6. Oracle锁表(转载)
  7. tab栏切换的特殊效果(类似网易的登陆栏效果)
  8. EL表达式与JSTL(C)标签
  9. 理解js中的闭包
  10. 一个Java对象到底占用多大内存
  11. lintcode:Length of Last Word 最后一个单词的长度
  12. Eclipse反编译工具Jad及插件
  13. Android Push Notifications using Google Cloud Messaging (GCM), PHP and MySQL
  14. python初识1
  15. css基础内容之background
  16. sass学习笔记--摘录
  17. django源码分析 请求流程
  18. FreeSWITCH 增删模组
  19. linux改权限
  20. Runnable、Callable、Executor、Future、FutureTask关系解读

热门文章

  1. 学习笔记:UITabBarController使用详解
  2. 关于java&#39; web杂谈(其实是课后作业1)1 网站系统开发需要掌握的技术
  3. 浅谈IM(InstantMessaging) 即时通讯/实时传讯
  4. uva11636-Hello World!
  5. jQuery开发自定义插件 $.extend()与$.fn.extend()
  6. C# 通过反射初探ORM框架的实现原理
  7. 进程互斥(锁)------------------&gt;一个坑
  8. Express4.x API (四):Router (译)
  9. js通用方法检測浏览器是否已安装指定插件(IE与非IE通用)
  10. uva--10700