sprint boot 自动创建web应用(3)
2024-09-03 09:20:37
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.学习总结,后续完善!
最新文章
- C#多线程之线程同步篇3
- 使用Atlas实现MySQL读写分离
- C#中抽象类和接口
- mysql高级排序&;高级匹配查询示例
- ecshop2.72文件结构说明
- 向Spotify学习如何设计产品(转)
- i18next-页面层语言国际化js框架介绍
- (转) VS2012程序打包部署详解
- a标签的简单用法
- C/C++之Exercise
- cf479D Long Jumps
- oracle 12c 三学习 pdb 可插拔测试
- PAT (Advanced Level) 1049. Counting Ones (30)
- 晓莲说-何不原创:java 实现二维数组冒泡排序
- 【linux之bash】
- 再次精读《javascript高级程序设计第3版》学习笔记(1)
- Python类继承(转发)
- Object.MemberwiseClone
- Database Course Summary 001
- Fiddler 实现手机的抓包
热门文章
- TP框架 商城前台用户注册方法
- css 圆形脉冲动画
- sunny 内网穿透使用。
- 鸿蒙内核源码分析(静态链接篇) | 完整小项目看透静态链接过程 | 百篇博客分析OpenHarmony源码 | v54.01
- CF605E-Intergalaxy Trips【期望dp】
- 《手把手教你》系列技巧篇(二十八)-java+ selenium自动化测试-处理模态对话框弹窗(详解教程)
- Java-多态(下)
- sqlite3 c++使用以及提高速率(一万条每秒左右)
- SpringBoot-邮件任务
- Java:volatile笔记