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

2、配置Maven,如下:

  1. <parent>
  2. <groupId>org.springframework.boot</groupId>
  3. <artifactId>spring-boot-starter-parent</artifactId>
  4. <version>1.2.5.RELEASE</version>
  5. <relativePath/>
  6. </parent>
  7.  
  8. <properties>
  9. <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  10. <java.version>1.8</java.version>
  11. </properties>
  12.  
  13. <dependencies>
  14. <dependency>
  15. <groupId>org.springframework.boot</groupId>
  16. <artifactId>spring-boot-starter-web</artifactId>
  17. </dependency>
  18. </dependencies>
  19.  
  20. <build>
  21. <plugins>
  22. <plugin>
  23. <groupId>org.springframework.boot</groupId>
  24. <artifactId>spring-boot-maven-plugin</artifactId>
  25. </plugin>
  26. </plugins>
  27. </build>

3、建立启动Application

  1. package demo.web.application;
  2. import org.springframework.boot.SpringApplication;
  3. import org.springframework.boot.autoconfigure.SpringBootApplication;
  4. import org.springframework.context.annotation.ComponentScan;
  5.  
  6. @SpringBootApplication
  7. @ComponentScan(basePackages={"demo.web.*"})
  8. public class Application {
  9. public static void main(String[] args) {
  10. SpringApplication.run(Application.class, args);
  11. }
  12.  
  13. }

4、编辑Controller

  1. package demo.web.controller;
  2. import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
  3. import org.springframework.web.bind.annotation.PathVariable;
  4. import org.springframework.web.bind.annotation.RequestMapping;
  5. import org.springframework.web.bind.annotation.RestController;
  6.  
  7. @RestController
  8. @EnableAutoConfiguration
  9. public class HelloController {
  10.  
  11. @RequestMapping("/")
  12. String home() {
  13. System.out.println("ee");
  14. return "Hello World!";
  15. }
  16.  
  17. @RequestMapping("/hello/{myName}")
  18. String index(@PathVariable String myName) {
  19. return "Hello "+myName+"!!!";
  20. }
  21.  
  22. }

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

  1. server.port=9000

项目文件布局如下:

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

SpringBoot 搭建的更多相关文章

  1. Springboot搭建SSM+JSP的web项目

    Springboot搭建SSM+JSP的web项目 一:创建项目结构: 项目结构分为三个部分: 1 后端项目开发文件: 包: Util         工具包 Mapper      db层 Serv ...

  2. 基于SpringBoot搭建应用开发框架(二) —— 登录认证

    零.前言 本文基于<基于SpringBoot搭建应用开发框架(一)——基础架构>,通过该文,熟悉了SpringBoot的用法,完成了应用框架底层的搭建. 在开始本文之前,底层这块已经有了很 ...

  3. springBoot 搭建web项目(前后端分离,附项目源代码地址)

    springBoot 搭建web项目(前后端分离,附项目源代码地址)   概述 该项目包含springBoot-example-ui 和 springBoot-example,分别为前端与后端,前后端 ...

  4. SpringBoot 试手(简易的SpringBoot搭建步骤)

    SpringBoot 也算AI吧,它根据您架构中引用的依赖,自动化地按默认方案帮您完成了Spring那些复杂繁琐的配置工作.为了让您不会看低此 AI 水平,还特地喊出了“约定大于配置”的口号.从这个角 ...

  5. SpringBoot 搭建简单聊天室

    SpringBoot 搭建简单聊天室(queue 点对点) 1.引用 SpringBoot 搭建 WebSocket 链接 https://www.cnblogs.com/yi1036943655/p ...

  6. springboot搭建一个简单的websocket的实时推送应用

    说一下实用springboot搭建一个简单的websocket 的实时推送应用 websocket是什么 WebSocket是一种在单个TCP连接上进行全双工通信的协议 我们以前用的http协议只能单 ...

  7. Springboot搭建Eureka并设置Eureka登录账号密码

    Springboot搭建Eureka并设置Eureka登录账号密码 一.创建一个springboot项目 1.可以使用Spring Initializr,用浏览器打开http://start.spri ...

  8. 使用SpringBoot搭建Web项目

    序言 从简入深的使用SpringBoot搭建一个Web项目,同时也包括一些小的问题.第一篇博文是以较为简单的方式完成一个可以连接数据库的Springboot web程序.之前自己学习的时候看网上的教程 ...

  9. SpringBoot 搭建基于 MinIO 的高性能存储服务

    1.什么是MinIO MinIO是根据GNU Affero通用公共许可证v3.0发布的高性能对象存储.它与Amazon S3云存储服务兼容.使用MinIO构建用于机器学习,分析和应用程序数据工作负载的 ...

  10. 用SpringBoot搭建简单电商项目 01

    前几节呢,我们已经简单介绍了SpringBoot框架的使用,从这一节开始,我们尝试着使用SpringBoot框架来一步一步搭建一个简单电商项目.当然了,这不是真正的电商项目,你可以看成是一个CRUD案 ...

随机推荐

  1. Eclipse不编译解决方案

    原文链接:http://blog.csdn.net/huahuagongzi99999/article/details/7719882    转来自己用 这两天Eclipse 不编译了,无论怎么更改保 ...

  2. SQL Server 2012内部原理及故障排除

    http://blog.csdn.net/burgess_liu/article/details/37900027

  3. ms sql SERVER 下载

    企业版DVD SQL Server 2005 Enterprise Edition(支持超大型企业) 32 位DVD: ed2k://|file|cs_sql_2005_ent_x86_dvd.iso ...

  4. PWA 基础学习

    1.PWA 是什么? PWA 是 Progressive Web App 的缩写,从字面翻译过来就是 渐进式 Web App. 渐进式翻译过来就是慢慢的,不是一蹴而就的.这里的指的是 Wab App ...

  5. Android: 阻止ScrollView随着数据加载自动滚动

    当ScrollView中有类似GridView的控件时,当数据加载后ScrollView会自动滚动.要阻止这种事情发生,我们需要做的是在ScrollView的下层容器中添加android:descen ...

  6. shell apt install 按tab键自动补全

    insert if [ -f /etc/bash_completion ]; then . /etc/bash_completion fi to ~/.bashrc

  7. Vim tips——Working with external commands

    A common sequence of events when editing files is to make a change and then need to test by executin ...

  8. 《Linux Device Drivers》第八章 分配内存——note

    本章主要介绍Linux内核的内存管理. kmalloc函数的内幕 不正确所获取的内存空间清零 分配的区域在物理内存中也是连续的 flags參数 <linux/slab.h> <lin ...

  9. 【C语言】编写函数实现库函数atof

    //编写函数实现库函数atof #include <stdio.h> #include <assert.h> #include <ctype.h> #include ...

  10. mac 浏览器解决跨域问题

    Chrome:命令行执行如下命令open -a Google\ Chrome --args --disable-web-security出现如下提示,说明已经开启: Safari: open -a ' ...