IDE 运行

运行带有main方法类

用mvn运行Spring-boot项目

在父项目中运行

mvn clean
mvn install

在主项目中运行

mvn spring-boot:run

用JAR包运行项目

在pom中添加

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.2</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>

package -Dmaven.test.failture.ignore=true

运行jar包

java -jar guns-admin-1.0.0.jar

用WAR包运行项目

修改pom中的生成方式

<packaging>war</packaging>

package -Dmaven.test.failture.ignore=true

拷贝WAR到webapps下面。

/var/lib/tomcat8/webapps/
sudo cp guns-admin-1.0.0.war /var/lib/tomcat8/webapps/

将war文件改为ROOT.war

重启tomcat,就可以了!

service tomcat8 restart

这个时候直接用Tomcat的端口,就能访问了。

运行【guns】spring boot 的四种方式的更多相关文章

  1. 普通java类加入spring容器的四种方式

    今天在自己开发的工具类中使用了spring注入的方式调用了其他类,但是发生的报错,在整理了后今天小结一下. 首先简单介绍下spring容器,spring容器是整个spring框架的核心,通常我们说的s ...

  2. spring注入的四种方式

    配置文件spring.xml: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns=&qu ...

  3. Spring全家桶之spring boot(四)

    spring boot拦截器.过滤器.servlet和健康检查机制  spring boot拦截器 spring boot配置拦截器与原来大致相同,只是需要在拦截器的配置类上添加@Configurat ...

  4. Spring Boot 以 jar 包方式运行在后台

    spring-boot jar 包方式启动: 首先,为了防止和常用的 Tomcat 8080 端口冲突,将 Spring-boot 项目的端口号设置为 9090. 具体方法:在 application ...

  5. Spring事务管理的四种方式(以银行转账为例)

    Spring事务管理的四种方式(以银行转账为例) 一.事务的作用 将若干的数据库操作作为一个整体控制,一起成功或一起失败.   原子性:指事务是一个不可分割的工作单位,事务中的操作要么都发生,要么都不 ...

  6. 转:深入浅出spring IOC中四种依赖注入方式

    转:https://blog.csdn.net/u010800201/article/details/72674420 深入浅出spring IOC中四种依赖注入方式 PS:前三种是我转载的,第四种是 ...

  7. Spring Boot 项目几种启动方式

    Spring Boot 项目几种启动方式 1. 使用 main 启动 jar xxxx.jar 2. 使用 mvn 启动 mvn spring-boot:run 3. 使用 Spring Boot c ...

  8. spring引用hibernate映射文件的四种方式

    1.mappingResources 2.mappingLocations 3.mappingDirectoryLocations 4.mappingJarLocations 四种方式:https:/ ...

  9. Spring Boot入门(四):开发Web Api接口常用注解总结

    本系列博客记录自己学习Spring Boot的历程,如帮助到你,不胜荣幸,如有错误,欢迎指正! 在程序员的日常工作中,Web开发应该是占比很重的一部分,至少我工作以来,开发的系统基本都是Web端访问的 ...

随机推荐

  1. [UVa OJ] Longest Common Subsequence

    This is the classic LCS problem. Since it only requires you to print the maximum length, the code ca ...

  2. 160704、commons-beanutils.jar常用方法

    package com.test.beanutils; import java.lang.reflect.InvocationTargetException;import java.text.Pars ...

  3. SQL Server常用函数汇总

    1.day(date)    用途:获取日期是所在月的几号  参数:date是一个可以解析为 time.date.smalldatetime.datetime.datetime2 或 datetime ...

  4. Exchange Version and UpdateRollups

    Exchange Server 2010 Product name Build number Date KB Microsoft Exchange Server 2010 RTM 14.0.639.2 ...

  5. 替换DOM元素 parent.replaceChild(new, old)

    p.replaceChild(nodeNext, p.children[j]); p.replaceChild(nodePrev, p.children[j + 1]);

  6. cookies设置时间

    默认cookies失效时间是直到关闭浏览器,cookies失效,也可以指定cookies时间. Response.Cookies("user_name").Expires=Date ...

  7. mysql建立索引 删除索引

    建立索引 1.添加PRIMARY KEY(主键索引) mysql>ALTER TABLE `table_name` ADD PRIMARY KEY ( `column` ) 2.添加UNIQUE ...

  8. 信息安全意识教育日历——By 安全牛

    安全牛:企业即使投入再好的信息安全技术和产品,也难以解决内部威胁以及社会工程等攻击手段,无法做到全面有效地保护企业信息资产.而通过开展员工的信息安全意识培训教育工作,不仅能降低企业风险.满足合规要求, ...

  9. servlet 通过 FileItem 实现多文件上传

    [本文简介] 一个servlet 多文件上传的简单例子. [依赖包] commons-fileupload-1.3.1.jar commons-io-2.2.jar [依赖包下载] commons-f ...

  10. 你真的会用Gson吗?Gson使用指南

    你真的会用Gson吗?Gson使用指南(一) 你真的会用Gson吗?Gson使用指南(二) 你真的会用Gson吗?Gson使用指南(三) 你真的会用Gson吗?Gson使用指南(四)