1. springboot自动创建地址:https://start.spring.io/

2.选择web(springMVC)

3.点击创建

4.创建成功

5.解压,导入项目

6.新建成功

7.原因 : maven的插件版本的问题,造成与IDE的不兼容

解决办法 :在pom中加上 <maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>就可以了

<properties>
        <java.version>1.8</java.version>
        <spring-cloud.version>Greenwich.SR1</spring-cloud.version>
        <maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
    </properties>

8.项目右键-maven-updata project

9.启动项目

  .   ____          _            __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.2.0.RELEASE) 2019-11-03 12:51:06.730 INFO 7196 --- [ main] c.x.springboot.ControllerApplication : Starting ControllerApplication on PC-20190411SFOQ with PID 7196 (D:\Downloads\com.xiaobing.springboot_v1\target\classes started by Administrator in D:\Downloads\com.xiaobing.springboot_v1)
2019-11-03 12:51:06.752 INFO 7196 --- [ main] c.x.springboot.ControllerApplication : No active profile set, falling back to default profiles: default
2019-11-03 12:51:22.173 INFO 7196 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2019-11-03 12:51:23.416 INFO 7196 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2019-11-03 12:51:23.417 INFO 7196 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.27]
2019-11-03 12:51:24.883 INFO 7196 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2019-11-03 12:51:24.884 INFO 7196 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 17724 ms
2019-11-03 12:51:26.409 INFO 7196 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2019-11-03 12:51:30.032 INFO 7196 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2019-11-03 12:51:30.049 INFO 7196 --- [ main] c.x.springboot.ControllerApplication : Started ControllerApplication in 27.012 seconds (JVM running for 31.285)

10.web访问

11.新建class映射类

package com.xiaobing.springboot;

import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; @RestController
@SpringBootApplication
public class Example { @RequestMapping("/")
String home() {
return "Hello World!";
}
}

12.重新启动项目

  .   ____          _            __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.2.0.RELEASE) 2019-11-03 13:01:44.699 INFO 7192 --- [ main] c.x.springboot.ControllerApplication : Starting ControllerApplication on PC-20190411SFOQ with PID 7192 (D:\Downloads\com.xiaobing.springboot_v1\target\classes started by Administrator in D:\Downloads\com.xiaobing.springboot_v1)
2019-11-03 13:01:44.712 INFO 7192 --- [ main] c.x.springboot.ControllerApplication : No active profile set, falling back to default profiles: default
2019-11-03 13:01:48.641 INFO 7192 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2019-11-03 13:01:48.711 INFO 7192 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2019-11-03 13:01:48.712 INFO 7192 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.27]
2019-11-03 13:01:49.121 INFO 7192 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2019-11-03 13:01:49.122 INFO 7192 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 4166 ms
2019-11-03 13:01:49.694 INFO 7192 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2019-11-03 13:01:50.262 INFO 7192 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2019-11-03 13:01:50.272 INFO 7192 --- [ main] c.x.springboot.ControllerApplication : Started ControllerApplication in 6.845 seconds (JVM running for 8.017)

13.访问web项目

日志打印

2019-11-03 13:02:51.079  INFO 7192 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2019-11-03 13:02:51.080 INFO 7192 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2019-11-03 13:02:51.107 INFO 7192 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 26 ms

14.学习总结,后续完善!

sprint boot 自动创建web应用(3)的更多相关文章

  1. eclipse 自动创建web.xml

    eclipse 自动创建web.xml 以前每次创建web项目的时候,总是从其他的项目中拷贝一个web.xml文件到新项目,然后改吧改吧就可以了,但是这终究是一件麻烦的事,要是能够通过软件自动创建,那 ...

  2. 快速创建SpringBoot2.x应用之工具类自动创建web应用、SpringBoot2.x的依赖默认Maven版本

    快速创建SpringBoot2.x应用之工具类自动创建web应用简介:使用构建工具自动生成项目基本架构 1.工具自动创建:http://start.spring.io/ 2.访问地址:http://l ...

  3. 自动创建web.xml

    摘自:http://blog.csdn.net/weiral/article/details/51366485 今天在学习JSP时先创建了一个web项目,后来在用到web.xml文件时,才发现项目创建 ...

  4. 用Spring Boot去创建web service

    1. 环境 JDK1.8 JavaSE1.8 web容器是 webSphere IDE是Eclipse 2. 创建一个空的 Maven Project 3. 打开pom.xml 配置相应的packag ...

  5. spring boot之创建web项目并访问jsp页面

    1,创建spring boot的web项目 刚创建好的项目路径如下: 2,pom中要有下面的依赖 <dependency> <groupId>org.springframewo ...

  6. 解决Eclipse中新创建的Maven项目不自动创建web.xml文件

    1. 通过J2EE tools 2.项目右键-properties-project facets-勾选dynamic web moudle

  7. 用idea简单创建web项目——两种方式

    最近同学让我教她们用idea创建web项目,于是我用两种方式创建web项目,并整理截图给她们看,一种是用maven创建,一种是不用maven创建,适合菜鸟哈哈~ 方法一:不用maven 1.解压tom ...

  8. Sprint Boot入门(1):创建第一个Spring Boot应用

    搭建工程 注:建议使用eclipse的STS插件创建Spring项目,而不是下面的Gradle项目,否则会导致有一些Spring文件不存在. new Gradle Project,如下 点next,如 ...

  9. IDEA02 利用Maven创建Web项目、为Web应用添加Spring框架支持、bean的创建于获取、利用注解配置Bean、自动装配Bean、MVC配置

    1 环境版本说明 Jdk : 1.8 Maven : 3.5 IDEA : 专业版 2017.2 2 环境准备 2.1 Maven安装及其配置 2.2 Tomcat安装及其配置 3 详细步骤 3.1 ...

随机推荐

  1. 3. Go并发编程--数据竞争

    目录 1.前言 2.数据竞争 2.1 示例一 2.1.1 测试 2.1.2 data race 检测 2.1.3 data race 配置 2.2 循环中使用goroutine引用临时变量 2.3 引 ...

  2. Pycharm 使用问题一览

    1. I'm not sure if it is the problem of Pycharm or any other IDE. 需要从本地文件中导入文件,但总是出现波浪线,按ctril点进去发现是 ...

  3. Python测试框架对比----unittest, pytest, nose, robot framework对比

    什么是框架? 框架(Framework)是整个或部分系统的可重用设计, 框架是用来解决代码的组织及运行控制问题的. 在我们编写自动化脚本的时候,经常需要读取配置文件,读取数据文件,发送请求,记录日志, ...

  4. django setting.py配置文件解读-02

    定义项目目录常量 import os # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR ...

  5. centos虚拟机中挂新硬盘

    配置一台centos7,主硬盘20G装系统:副硬盘20G作为数据盘(格式:XFS)挂载到根目录:/vdir/ ,XFS是高性能文件系统. 外层vm硬盘添加好后,执行下面 1.fdisk -l //查看 ...

  6. 深入浅出WPF-08.Event( 事件)01

    事件(Event) 首先我们来继续说一下UI组件树,因为WPF事件 的路由环境就是组件树.WPF中的树有两种,一种是逻辑树(Logical Tree),一种是可视元素树(Visual Tree).逻辑 ...

  7. 深入浅出WPF-04.x名称空间详解

    x名称空间详解 几个需要特别说明的名称空间: x:Class 用来标记XAML和后台代码之间的合并关系.x:Class根节点的类型必须和x:Class值指向的类型保持一致.x:Class的值指向的类型 ...

  8. Redis基础数据结构-基于2.8

    SDS SDS是Redis中String的底层数据结构,数据结构如下,SDS保留了传统的C字符串表达方式即数组的最后一个元素是'/0'结尾.此外还添加了两个字段len和free,其中len表示字符串长 ...

  9. Django整理(一) - 项目和应用创建及运行

    一.项目组织结构     · 一个Project包含有多个App     · 一个App就是一个Python包,就代表一个功能模块,比如: 用户模块,商品模块等 .各个功能模块间可以保持相对的独立 . ...

  10. 面试官一口气问了MySQL事务、锁和MVCC,我

    面试官:你是怎么理解InnoDB引擎中的事务的? 候选者:在我的理解下,事务可以使「一组操作」要么全部成功,要么全部失败 候选者:事务其目的是为了「保证数据最终的一致性」. 候选者:举个例子,我给你发 ...