Springboot搭建、外部tomcat、自动配置、run原理

Springboot:
简单来说,springboot有点类似maven的作用,整合了大量的框架,功能,使用起来非常方便快捷,减少了大量的配置文件

Springboot添加maven基本不需要版本号,它的祖父spring-boot-dependencies 基本上把所有常用模块的都添加进去了

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-dependencies</artifactId>
    <version>2.3.3.RELEASE</version>
  </parent>
<properties>
    <activemq.version>5.15.13</activemq.version>
    <antlr2.version>2.7.7</antlr2.version>
    <appengine-sdk.version>1.9.81</appengine-sdk.version>
    <artemis.version>2.12.0</artemis.version>
    <aspectj.version>1.9.6</aspectj.version>
    <assertj.version>3.16.1</assertj.version>
    <atomikos.version>4.0.6</atomikos.version>
    <awaitility.version>4.0.3</awaitility.version>
    <bitronix.version>2.1.4</bitronix.version>
    <build-helper-maven-plugin.version>3.1.0</build-helper-maven-plugin.version>
    <byte-buddy.version>1.10.14</byte-buddy.version>
    。。。。。。。。

搭建一个简单的Springboot-web项目:
springboot搭建有些基本的要求:
Spring Boot 2.3.0.RELEASE需要Java 8
Maven :3.3+
tomcat : 8.5.x+ Servlet 3.1+

WEB项目和普通项目有点区别,启动类旁边会多个ServletInitializer

1:使用 Spring Initializer快速创建项目;
2:项目下添加web,即main路径下创建webapp及WEB-INF,web.xml
在这里插入图片描述
3:修改pom文件,将jar包形式修改为war包,将嵌入式tomcat改为provided

<groupId>com.springboottest</groupId>
	<artifactId>demo</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>war</packaging>


<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-tomcat</artifactId>
			<scope>provided</scope>
</dependency>

4:创建两个简单的页面:
hello.jsp,first.jsp

1.hello.jsp
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/9/8 0008
  Time: 23:32
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<h1> hello.........</h1>

<a href="abc">abc</a>
</body>
</html>

2.first.jsp
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值