boot

spring boot 项目打包时报错 Execution default of goal org.springframework.boot:spring-boot-maven-plugin

ぐ巨炮叔叔 提交于 2020-03-09 00:15:52
报错信息: Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.5.4.RELEASE:repackage (default) on project chamc-dp-smart-form-common: Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.5.4.RELEASE:repackage failed: Unable to find main class 解决方法: <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <executions> <execution> <phase>none</phase> </execution> </executions> </plugin> </plugins> </build> 来源: CSDN 作者: theITcat 链接: https://blog.csdn.net/theITcat/article/details/104739224

Spring Boot快速入门指南

不打扰是莪最后的温柔 提交于 2020-03-08 22:30:15
Spring Boot是一个Java框架,允许开发Web服务。本文将向您展示开始使用Spring Boot并在IntelliJ IDE上创建第一个Web服务的所有步骤。 首先,您需要安装以下要求: Java 8 IntelliJ 之后,您可以按照以下步骤操作: 1.转到start.spring.io/生成一个spring项目 2.设置项目配置: o选择Maven项目 o给它起个名字(工件) o将Spring Web添加为依赖项(库) o将DevTools添加为依赖项 生成项目 3.下载并解压缩项目 4.打开项目 5.创建一个新服务(HelloService)以测试API Java 1 @RestController 2 public class HelloService { 3 @RequestMapping(value="/", method= RequestMethod.GET) public String hello(){ 4 return “hello”; 5 } 6 } 6.启动主程序:/src/main/java/package…/QuickstartApplication.java 最后,开发这么多年我也总结了一套学习Java的资料与面试题,如果你在技术上面想提升自己的话,可以关注我,私信发送领取资料或者在评论区留下自己的联系方式

Spring Boot mybatis-starter介绍

早过忘川 提交于 2020-03-08 22:18:28
1、mybatis-starter作用 自动检测工程中的DataSource 创建并注册SqlSessionFactory实例 创建并注册SqlSessionTemplate实例 自动扫描mappers 2、mybatis-starter使用 1) 引入mybatis-spring-boot-starter <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>2.1.1</version> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.48</version> </dependency>    2)application.properties 文件中增加数据库配置 spring.datasource.username=root spring.datasource.password=123456 spring.datasource.url=jdbc:mysql://localhost:3306/test spring

Spring Boot2 从入门到实战汇总

こ雲淡風輕ζ 提交于 2020-03-08 18:32:43
之前写过几篇spring boot入门到实战的博文,因为某些原因没能继续。 框架更新迭代很快,之前还是基于1.x,现在2.x都出来很久了。还是希望能从基于该框架项目开发的整体有一个比较系统的梳理,于是有了这个基于2.x的系列,汇总到这里,持续更新。 希望对初学者或技术研发人员带来参考,也欢迎一起交流、探讨。 Spring Boot2从入门到实战(一):Spring Boot简介 Spring Boot2从入门到实战(二):第一个Spring Boot应用 Spring Boot2从入门到实战(三):Spring Boot自定义属性 Spring Boot2从入门到实战(四):Spring Boot配置 Spring Boot2从入门到实战(五):写一个自己的starter Spring Boot2从入门到实战(六):整合Web项目常用功能 Spring Boot2从入门到实战(七):整合通用Mapper简化单表操作 Spring Boot2从入门到实战(八):集成AOPLog来记录接口访问日志 Spring Boot2从入门到实战(九):统一异常处理 Spring Boot2从入门到实战(十):异步处理 Spring Boot2从入门到实战(十一):注解结合JWT实现简单的接口鉴权 Spring Boot2从入门到实战(十二):LocalDateTime格式化处理 我的个人博客地址

spring boot单元测试

*爱你&永不变心* 提交于 2020-03-08 05:50:38
关键字:spring-boot-starter-test、@RunWith(SpringRunner.class) 、@SpringBootTest、MockMvc、@BeforeEach、@BeforeAll、@AfterAll、@AfterEach、@Disabled、@Test 前言 这次来介绍下Spring Boot中对单元测试的整合使用,本篇会通过以下4点来介绍,基本满足日常需求 Service层单元测试 Controller层单元测试 新断言assertThat使用 单元测试的回滚 正文 Spring Boot中引入单元测试很简单,依赖如下: 1 2 3 4 5 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> 本篇实例Spring Boot版本为1.5.9.RELEASE,引入spring-boot-starter-test后,有如下几个库: • JUnit — The de-facto standard for unit testing Java applications. • Spring Test & Spring Boot Test

SpringBoot项目设置热部署

爱⌒轻易说出口 提交于 2020-03-07 07:23:30
记录一个SpringBoot 设置热部署(修改项目之后,项目自动重启)实例 POM.XML 文件 <!-- 配置springBoot项目的热部署启动 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> </dependency> SpringBoot启动类的代码: package com.xiaowu; import java.io.IOException; import org.apache.commons.httpclient.HttpException; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; /** *

macbook 安装 ubuntu

半世苍凉 提交于 2020-03-07 07:07:47
Installing Windows on your Mac is easy with Boot Camp , but Boot Camp won’t help you install Linux. You’ll have to get your hands a bit dirtier to install and dual-boot a Linux distribution like Ubuntu. If you just want to try Linux on your Mac, you can boot from a live CD or USB drive. Insert the live Linux media, restart your Mac, press and hold the Option key, and select the Linux media on the Startup Manager screen. We installed Ubuntu 14.04 LTS to test this process. Install rEFInd RELATED: How to Install Windows on a Mac With Boot Camp rEFInd is a boot manager that will allow you to

《云计算》-网络服务部署-rsync远程同步部署-rsync+SSH 加密操作

雨燕双飞 提交于 2020-03-07 02:58:48
1 案例1:rsync基本用法 1.1 问题 本例要求掌握远程同步的基本操作,使用rsync命令完成下列任务: 将目录 /boot 同步到目录 /todir 下 将目录 /boot 下的文档同步到目录 /todir 下 在目录 /boot 下新增文件 a.txt,删除 /todir 下的子目录 grub2,再次同步使 /todir 与 /boot 一致 验证 -a、-n、-v、--delete 选项的含义 1.2 方案 本地同步操作: rsync [选项...] 本地目录1 本地目录2 rsync [选项...] 本地目录1/ 本地目录2 rsync同步工具的常用选项: -n:测试同步过程,不做实际修改 --delete:删除目标文件夹内多余的文档 -a:归档模式,相当于-rlptgoD -v:显示详细操作信息 -z:传输过程中启用压缩/解压 1.3 步骤 实现此案例需要按照如下步骤进行。 步骤一:rsync同步基本操作 1)将目录 /boot 同步到目录 /todir 下 [root@svr7 ~]# ls -l /todir //同步前 ls: 无法访问/todir: 没有那个文件或目录 [root@svr7 ~]# rsync -a /boot /todir //将目录1作为目录2的子目录 [root@svr7 ~]# ls -l /todir //检查同步结果 总用量 4

springboot项目+jpa+mybatis

余生长醉 提交于 2020-03-07 02:19:09
springboot项目,自动化配置spring相关功能,一键启动。现搭建一个简单的具有数据存取功能的项目,使用的是jpa和hibernate。整个项目分为boot-web,boot-service,boot-dao,boot-base四个模块 (1)boot-web部分 这个部分主要是控制层部分,项目的启动文件,项目的配置 1)控制层部分 TestController package boot . bootweb ; import boot . bootdao . entity . Role ; import boot . bootdao . entity . User ; import boot . bootservice . RoleService ; import boot . bootservice . UserService ; import org . springframework . beans . factory . annotation . Autowired ; import org . springframework . http . ResponseEntity ; import org . springframework . stereotype . Controller ; import org . springframework . web .

springboot-日志配置

孤者浪人 提交于 2020-03-06 18:14:41
springboot默认日志系统 Spring Boot默认使用LogBack日志系统,如果要使用LogBack,原则上是需要添加dependency依赖: < groupId > org . springframework . boot < / groupId > < artifactId > spring - boot - starter - logging < / artifactId > < / pre > 但是因为新建的Spring Boot项目一般都会引用spring-boot-starter或者spring-boot-starter-web,而这两个起步依赖中都已经包含了对于spring-boot-starter-logging的依赖,所以,无需额外添加依赖。 如何在项目中打印日志 在类上添加: import org . slf4j . Logger ; import org . slf4j . LoggerFactory ; private static final Logger log = LoggerFactory . getLogger ( 当前类名 . class ) ; 如何将日志信息存储到文件 在application.properties文件或者application.yml文件添加如下配置: logging.path=/Users/jackie