入手springBoot,搭建第一个springBoot项目。

看官方文档还是有点别扭。

https://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#getting-started

================================================================================================================

1.创建一个新的maven项目

maven项目的创建:http://www.cnblogs.com/sxdcgaq8080/p/5586644.html

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.sxd.springBootExample</groupId>
<artifactId>firstSpringBootExample</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<version>3.0</version>
</configuration>
</plugin>
</plugins>
</build> <!-- 引入parent项目,其实就是一个项目jar,版本自己在http://mvnrepository.com/search?q=spring-boot-starter-parent 选择即可 -->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.7.RELEASE</version>
</parent> <!-- 要跑起来一个web项目,就引入这一个jar即可,版本不用写,parent中已经声明了的 -->
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies> </project>

3.创建一个java文件,一个Controller,一个springBoot的主入口

@RequestMapping("/")
访问的地址:localhost:8080/ 即可。
如果想带上项目名,请在这里自行配置上即可。
package com.sxd.main;

import org.springframework.boot.*;
import org.springframework.boot.autoconfigure.*;
import org.springframework.web.bind.annotation.*; @RestController
@EnableAutoConfiguration
public class Example { @RequestMapping("/")
String home() {
return "Hello World!";
} public static void main(String[] args) throws Exception {
SpringApplication.run(Example.class, args);
} }

4.启动就好

现在不用把项目放入tomcat中,springBoot中嵌入了tomcat

5.查看效果

浏览器上访问:

【spring Boot】1.创建第一个springBoot项目的更多相关文章

  1. 使用idea创建第一个springboot项目

    版权声明:版权归作者所有,转载请注明出处. https://blog.csdn.net/qq_34205356/article/details/81098354 前言:如今springboot越来越火 ...

  2. 创建第一个springboot项目、用springboot实现页面跳转、@Controller和@RestController的区别

    文章目录 一.第一个spring boot项目 二.spring boot跳转到指定页面 三.怎样将后台的信息传递到前台 四. @Controller和@RestController的区别? 一.第一 ...

  3. Spring Boot 学习(一) 快速搭建SpringBoot 项目

    快速搭建一个 Spring Boot 项目 部分参考于<深入实践Spring Boot>.<Spring实战 第四版>与程序猿DD的有关博客. 参考(嘟嘟独立博客):http: ...

  4. SpringBoot学习1:创建第一个SpringBoot项目

    一.新建项目 二.打开项目的pom文件,在里面添加maven依赖 <!--springboot项目依赖的父项目--> <parent> <groupId>org.s ...

  5. SpringBoot: 1.创建第一个SpringBoot项目(转)

      一.新建项目 二.打开项目的pom文件,在里面添加maven依赖 1 <!--springboot项目依赖的父项目--> 2 <parent> 3 <groupId& ...

  6. 使用eclipse创建第一个SpringBoot项目

    1.new->maven->maven project,   勾选 Create a simple project,  下一个页面中填入group id(项目组织唯一标识, 如org.ap ...

  7. 到spring官网创建第一个springboot工程

    登录到spring的官网,直接生成一个,然后倒入本地工程就可以了. https://start.spring.io/ 点击创建的时候. 就等于下载了这个工程. 下载后,倒入到我们的maven工程可以直 ...

  8. 创建第一个springboot项目,maven project

  9. 快速构建一个springboot项目(一)

     前言: springcloud是新一代的微服务框架而springboot作为springcloud的基础,很有必要对springboot深入学习一下. springboot能做什么? (1)spri ...

随机推荐

  1. table纵横都需要下拉框

    table 溢出,下拉框显示不全 <div class="table-scrollable"style="height: 500px; overflow-y: vi ...

  2. PHP面向对象单例模式(懒汉式)

    知识点: 一.三私一公: ①.私有静态属性,又来储存生成的唯一对象 ②.私有构造函数 ③.私有克隆函数,防止克隆——clone ④.公共静态方法,用来访问静态属性储存的对象,如果没有对象,则生成此单例 ...

  3. Solidity陷阱:以太坊的随机数生成

    title: Solidity陷阱:以太坊的随机数生成 Solidity是一种相当新的语言,因为没有代码是完美的,它包含与代码相关的问题以及你希望用它完成的任务.本文将指导你使用随机数作为以太坊智能合 ...

  4. Linux命令之rhn_check

    NAME rhn_check - check for queued actions on RHN and execute them SYNOPSIS /usr/sbin/rhn_check [-v] ...

  5. 用基于类的通用视图处理表单(Class-based generic views)

    处理表单通常包含3步: 初始化GET(空白的后者预填充的表单) POST非法数据(通常重新显示带有错误信息的表单) POST合法数据(提交数据并重定向) 为了将你从这些烦人的重复步骤中解救出来,Dja ...

  6. [02]a tag只为成button用时候设置href的办法

    a tag为成button使用,把JavaScript动作处理时,有如下四种停止Event效果. <a href="#"> <a href="javas ...

  7. this bind apply call

    this 是当前函数运行时所属的对象bind 是指定一个函数运行时的上下文,也就是说把这个函数的this指向绑定到相应对象上,默认的暴露在全局御中的函数this指向widow对象, 严格模式下全局的t ...

  8. sublime text常用快捷键及多行列模式批量操作教程

    列模式 苹果:OS X -鼠标左键+Option -或者鼠标中键 -增加选择:Command,减少选择:Command+Shift 2 Windows: -鼠标右键+Shift -或者鼠标中键 -增加 ...

  9. 百度之星初赛(A)——T6

    度度熊的01世界 Problem Description 度度熊是一个喜欢计算机的孩子,在计算机的世界中,所有事物实际上都只由0和1组成. 现在给你一个n*m的图像,你需要分辨他究竟是0,还是1,或者 ...

  10. luogu 2709 小B的询问 莫队

    题目链接 Description 小B有一个序列,包含\(N\)个\(1-K\)之间的整数.他一共有\(M\)个询问,每个询问给定一个区间\([L..R]\),求\(\sum_{i=1}^{K}c_i ...