Chinaunix首页 | 论坛 | 博客
  • 博客访问: 614343
  • 博文数量: 298
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 3077
  • 用 户 组: 普通用户
  • 注册时间: 2019-06-17 10:57
文章分类

全部博文(298)

文章存档

2022年(96)

2021年(201)

2019年(1)

我的朋友

分类: Java

2021-08-09 12:02:37

 1. pom

点击(此处)折叠或打开

  1. <groupId>org.fh</groupId>
  2.     <artifactId>xxxx</artifactId>
  3.     <version>0.0.1-SNAPSHOT</version>
  4.     <packaging>war</packaging><!-- 以war运行是改成war -->

点击(此处)折叠或打开

  1. <dependency>
  2.             <groupId>org.springframework.boot</groupId>
  3.             <artifactId>spring-boot-starter-web</artifactId>
  4.             <!-- 移除嵌入式tomcat插件 war包方式部署时,解开注释fhadmin.cn -->
  5.         
  6.          <exclusions>
  7.          <exclusion>
  8.          <groupId>org.springframework.boot</groupId>
  9.          <artifactId>spring-boot-starter-tomcat</artifactId>
  10.          </exclusion>
  11.          </exclusions>
  12.         
  13.         </dependency>

点击(此处)折叠或打开

  1. <build>
  2.         <finalName>fhadmin</finalName>
  3.         <plugins>
  4.             <plugin>
  5.                 <groupId>org.springframework.boot</groupId>
  6.                 <artifactId>spring-boot-maven-plugin</artifactId>
  7.                 <version>1.4.2.RELEASE</version><!-- springboot项目打jar包运行 插件版本只能是1.4.2.RELEASE fhadmin.cn-->
  8.                 <configuration>
  9.                 <mainClass>org.fh.FHmainApplication</mainClass><!--入口类-->
  10.                 </configuration>
  11.             </plugin>
  12.         </plugins>
  13.         <resources>
  14.             <resource>
  15.                 <directory>${basedir}/src/main/webapp</directory>
  16.                 <targetPath>META-INF/resources</targetPath>
  17.                 <includes>
  18.                     <include>**/**</include>
  19.                 </includes>
  20.             </resource>
  21.             <resource>
  22.                 <directory>src/main/resources</directory>
  23.                 <filtering>false</filtering>
  24.                 <includes>
  25.                     <include>**/**</include>
  26.                 </includes>
  27.             </resource>
  28.         </resources>
  29.     </build>


2. 在和启动类评级上添加类

点击(此处)折叠或打开

  1. package org.fh;

  2. import org.springframework.boot.builder.SpringApplicationBuilder;
  3. import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;

  4. /**
  5.  * 说明:项目以war包方式运行时用到
  6.  * 作者:FH Admin
  7.  * from fhadmin.cn
  8.  */
  9. public class SpringBootStartApplication extends SpringBootServletInitializer {
  10.  
  11.     @Override
  12.     protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
  13.         return builder.sources(FHmainApplication.class); //这里要指向原先用main方法执行的FHmainApplication启动类
  14.     }
  15. }



阅读(1151) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~