1、使用Eclipse 建立Maven项目(webapp OR quickstart)

2、配置Maven,如下:

  <parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.5.RELEASE</version>
<relativePath/>
</parent> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
</properties> <dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies> <build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

3、建立启动Application

 package demo.web.application;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan; @SpringBootApplication
@ComponentScan(basePackages={"demo.web.*"})
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
} }

4、编辑Controller

 package demo.web.controller;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; @RestController
@EnableAutoConfiguration
public class HelloController { @RequestMapping("/")
String home() {
System.out.println("ee");
return "Hello World!";
} @RequestMapping("/hello/{myName}")
String index(@PathVariable String myName) {
return "Hello "+myName+"!!!";
} }

5、通过application.properties对项目进行配置

server.port=9000  

项目文件布局如下:

启动Application程序,即可访问网站。

最新文章

  1. IDEA设置代码大小以及菜单栏大小
  2. 《DSP using MATLAB》示例Example5.7
  3. service XXX does not support chkconfig
  4. Android常用控件
  5. do some projects in macine learning using python
  6. 传智168期JavaEE就业班 day04-dom
  7. mysql server has gone away 与max_allowed_packed
  8. poj3020
  9. Consistent Hashing原理与实现
  10. TabHost 两种使用方法 直接让一个Activity 继承TabActivity 和 利用findViwById()方法取得TagHost组件
  11. 与Scheme共舞
  12. Python 2.7 学习笔记 基本语法和函数定义
  13. oracle报表开发方案
  14. Zabbix实战-简易教程--通过公众平台企业号发送短信
  15. RTMPdump(libRTMP) 源代码分析 9: 接收消息(Message)(接收视音频数据)
  16. 新系统添加sshkey/pexpect基本使用
  17. C# 解析html中筛选class的问题
  18. Net 4.5 WebSocket 在 Windows 7, Windows 8 and Server 2012上的比较以及问题
  19. 关于Mysql表InnoDB下插入速度慢的解决方案
  20. JavaSE 类继承中函数重写

热门文章

  1. jsp之${CTX}理解
  2. sharepoint第三方程序认证尝试失败记录
  3. codevs——1517 求一次函数解析式
  4. 洛谷—— P2047 社交网络
  5. HashMap源码分析2:扩容
  6. 24、Java并发性和多线程-信号量
  7. go语言中log包的使用
  8. php訪问控制
  9. 微信公众号H5用户授权
  10. LeetCode 819. Most Common Word (最常见的单词)