Demo概述
使用SpringBoot和MyBatis,对Oracle数据的增、删、改、查、批处理、及调用存储过程,都做了示例代码及SQL的配置示例,对于各种参数传递方法,出入参类型等,也都做了示例或备注。
本Demo使用数据库为Scott/Tiger用户自带的EMP员工表,进行操作,所以数据库建表等SQL不再贴出,只给出了分页查询的存储过程SQL。
项目结构截图如下:
要点讲解
呃,好吧,现在发现没什么可以讲解了。
好歹自己也是搞了近一个星期,配置SQL时候也是遇到各种问题,现在竟然发现也没什么难点、注意点需要着重讲解了。可能是已经把关键点都添加了注释吧。
- 那就就你们看代码吧,要点都有注释,着重看dbMapper.xml、DataMapper.java以及SQLTest.java文件。
- 定义了Employee类,对应数据库scott.emp表结构。
- 测试函数SQLTest.run()使用@Autowired注解,这样在项目启动时候,就自动加载运行了。
- 多数人都会踏的坑:单句SQL后面不能有分号(语句块则需要),不然ORA-00911异常,再强调下。
编译运行
如何运行
- 项目右键->Run As -> Maven Clean;
- Run As -> Maven Install;
- Spring Boot App;
- 查看Console输出结果。
运行截图
简单查询
先查一下,工号大于7788的员工,一共7条数据。
插入后查询
插入工号为7979的员工信息,JOB取值为JOB(批插会更新),COMM取值为235.65(更新操作会更新)。插入后,查询出工号大于7788的员工,一共8条数据。
更新后查询
更新工号为7979的员工奖金数为555.25,之后查询,除了奖金数其他未变动。
批量查询
查询部门号为20和30的员工信息。得到12条数据。
批插后查询
批量插入3条数据,其中工号7979的员工信息为更新操作,其他插入的数据为新增操作。即新增了12+2条数据。
删除后查询
删除7979号员工信息,再查工号大于7788的员工信息,得到9条,即原8+7980号和7981号员工的条数据,已经删除的数据没有查到。
批删后查询
批量查询得到12条数据(包括新增的7979),删掉7979后,再批删掉7980和7981后,得到11条,没错。
存储过程分页查询
每页5条,查询第3页的数据。得到一共14条数据,分了3页,并返回了第3页的数据,4条,没错。
两个存储过程结果一致。
源码福利
先奉上项目源码下载地址:请点击我~~~然后每个文件代码贴一下。
Application.java
package com.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
//Spring Boot 应用的标识
@ComponentScan(basePackages = {"com.demo"})
@SpringBootApplication
public class Application {
public static void main(String[] args) {
// 启动嵌入式的 Tomcat 并初始化 Spring 环境及其各 Spring 组件
SpringApplication.run(Application.class, args);
}
}
DataMapper.java
package com.demo;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
//映射Sql,定义接口
public interface DataMapper {
//查询。@Param对应参数属性注解,There is no getter for property named 'xx' in 'class java.lang.Integer
List<Employee> test_query(@Param("EMPNO")Integer EMPNO);
//插入
void test_insert(Employee employee);
//更新
void test_update(@Param("EMPNO")Integer EMPNO, @Param("COMM")double COMM);
//删除
void test_delete(Integer EMPNO);
//批量插入
void test_multi_insert(List<Employee> results);
//批量查询
List<Employee> test_multi_query(int[] DEPTNOArr);
//批量删除
void test_multi_delete(List<Integer> EMPNOList);
//存储过程
void test_exe_procedure1(Map<String, Object> params);
void test_exe_procedure2(Map<String, Object> params);
}
DataSourceConfig.java
package com.demo;
import javax.sql.DataSource;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.SqlSessionTemplate;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
@Configuration
//指定扫描的mapper接口所在的包
@MapperScan(basePackages = "com.demo", sqlSessionFactoryRef = "DBDataSqlSessionFactory")
public class DataSourceConfig {
@Bean(name = "DBDataSource")
@ConfigurationProperties(prefix="spring.datasource") //告诉自动加载配置的属性
public DataSource dataSource() {
return DataSourceBuilder.create().build();
}
@Bean(name = "DBDataSqlSessionFactory")
public SqlSessionFactory sqlSessionFactory(@Qualifier("DBDataSource") DataSource dataSource)
throws Exception {
SqlSessionFactoryBean bean = new SqlSessionFactoryBean();
bean.setDataSource(dataSource);
bean.setMapperLocations(
new PathMatchingResourcePatternResolver().getResources("classpath:mybatis/dbMapper.xml"));
return bean.getObject();
}
@Bean(name = "DBDataTransactionManager")
public DataSourceTransactionManager transactionManager(@Qualifier("DBDataSource") DataSource dataSource) {
return new DataSourceTransactionManager(dataSource);
}
@Bean(name = "DBDataSqlSessionTemplate")
public SqlSessionTemplate sqlSessionTemplate(
@Qualifier("DBDataSqlSessionFactory") SqlSessionFactory sqlSessionFactory) throws Exception {
return new SqlSessionTemplate(sqlSessionFactory);
}
}
Employee.java
package com.demo;
import java.util.Date;
import java.util.List;
//使用数据库系统自带的数据表,对应scott.emp表
public class Employee {
private Integer EMPNO; //员工号
private String ENAME; //员工名
private String JOB; //工种
private Integer MGR; //上级
private Date HIREDATE;//入职日期
private double SAL; //工资
private double COMM; //奖金
private Integer DEPTNO; //部门号
public String toString()
{
String info = String.format("EMPNO[%d], ENAME[%s], JOB[%s], MGR[%d], HIREDATE[%tF], SAL[%.2f], COMM[%.2f], DEPTNO[%d]", EMPNO, ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO);
return info;
}
public static void Print(List<Employee> empList)
{
int count = empList.size();
String format = String.format("Employee[%%%dd]: %%s", String.valueOf(count).length());
String info = String.format("%5s, %7s, %10s, %4s, %10s, %7s, %7s, %s","EMPNO", "ENAME","JOB","MGR","HIREDATE","SAL","COMM","DEPTNO");
System.out.println(String.format(format, count,info));
for(int i=0;i<count;i++){
Employee emp = empList.get(i);
info = String.format("%5d, %7s, %10s, %4d, %tF, %7.2f, %7.2f, %d", emp.EMPNO, emp.ENAME,emp.JOB,emp.MGR,emp.HIREDATE,emp.SAL,emp.COMM,emp.DEPTNO);
System.out.println(String.format(format, i,info));
}
return;
}
public Integer getEMPNO() {
return EMPNO;
}
public void setEMPNO(Integer eMPNO) {
EMPNO = eMPNO;
}
public String getENAME() {
return ENAME;
}
public void setENAME(String eNAME) {
ENAME = eNAME;
}
public String getJOB() {
return JOB;
}
public void setJOB(String jOB) {
JOB = jOB;
}
public Integer getMGR() {
return MGR;
}
public void setMGR(Integer mGR) {
MGR = mGR;
}
public Date getHIREDATE() {
return HIREDATE;
}
public void setHIREDATE(Date hIREDATE) {
HIREDATE = hIREDATE;
}
public double getSAL() {
return SAL;
}
public void setSAL(double sAL) {
SAL = sAL;
}
public double getCOMM() {
return COMM;
}
public void setCOMM(double cOMM) {
COMM = cOMM;
}
public Integer getDEPTNO() {
return DEPTNO;
}
public void setDEPTNO(Integer dEPTNO) {
DEPTNO = dEPTNO;
}
}
SQLTest.java
package com.demo;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.demo.DataMapper;
@Component
public class SQLTest {
@Autowired
DataMapper dataMapper;
//自动载入,程序启动时候就运行啦。。。。
@Autowired
public void run() {
test_query();
test_insert();
test_query();
test_update();
test_query();
test_multi_query();
test_multi_insert();
test_multi_query();
test_delete();
test_query();
test_multi_delete();
test_multi_query();
test_exe_procedure(true);
test_exe_procedure(false);
}
private void test_query()
{
System.out.println("test_query...");
Integer EMPNO =7788;
List<Employee> empList =dataMapper.test_query(EMPNO);
Employee.Print(empList);
return;
}
private void test_insert()
{
System.out.println("test_insert...");
Employee emp = new Employee();
emp.setEMPNO(7979);
emp.setENAME("ENAME");
emp.setJOB("JOB");
emp.setMGR(7566);
emp.setHIREDATE(new Date());
emp.setSAL(8799.76);
emp.setCOMM(235.65);
emp.setDEPTNO(20);
dataMapper.test_insert(emp);
}
private void test_update()
{
System.out.println("test_update...");
dataMapper.test_update(7979, 555.25);
}
private void test_delete()
{
System.out.println("test_delete...");
dataMapper.test_delete(7979);
}
private void test_multi_insert()
{
System.out.println("test_multi_insert...");
Employee emp1 = new Employee();
emp1.setEMPNO(7980);
emp1.setENAME("ENAME1");
emp1.setJOB("JOB1");
emp1.setMGR(7566);
emp1.setHIREDATE(new Date());
emp1.setSAL(8799.76);
emp1.setCOMM(235.65);
emp1.setDEPTNO(30);
Employee emp2 = new Employee();
emp2.setEMPNO(7981);
emp2.setENAME("ENAME2");
emp2.setJOB("JOB2");
emp2.setMGR(7566);
emp2.setHIREDATE(new Date());
emp2.setSAL(8799.76);
emp2.setCOMM(235.65);
emp2.setDEPTNO(30);
Employee emp3 = new Employee();
emp3.setEMPNO(7979);
emp3.setENAME("ENAME");
emp3.setJOB("JOB2");
emp3.setMGR(7566);
emp3.setHIREDATE(new Date());
emp3.setSAL(8799.76);
emp3.setCOMM(235.65);
emp3.setDEPTNO(20);
List<Employee> empList = new ArrayList<Employee>();
empList.add(emp1);
empList.add(emp2);
empList.add(emp3);
dataMapper.test_multi_insert(empList);
}
private void test_multi_query()
{
System.out.println("test_multi_query...");
int[] DEPTNOArr = { 20, 30 };
List<Employee> empList = dataMapper.test_multi_query(DEPTNOArr);
Employee.Print(empList);
return;
}
private void test_multi_delete()
{
System.out.println("test_multi_delete...");
List<Integer> EMPNOList = new ArrayList<Integer>();
EMPNOList.add(7980);
EMPNOList.add(7981);
dataMapper.test_multi_delete(EMPNOList);
return;
}
private void test_exe_procedure(boolean bTestProcedure1)
{
int in_PAGE = 3;
int in_ROWS =5;
int inout_TOTAL_RECORDS=0;
int inout_TOTAL_PAGES = 0;
HashMap<String,Object> mm=new HashMap<String,Object>();
mm.put("in_PAGE", in_PAGE);
mm.put("in_ROWS", in_ROWS);
mm.put("inout_TOTAL_RECORDS", inout_TOTAL_RECORDS);
mm.put("inout_TOTAL_PAGES", inout_TOTAL_PAGES);
mm.put("out_SYSCURSOR", new ArrayList<Employee>());
if(bTestProcedure1)
{
System.out.println("test_exe_procedure1...");
dataMapper.test_exe_procedure1(mm);
}
else
{
System.out.println("test_exe_procedure2...");
mm.put("in_SQL", "select t.EMPNO, t.ENAME, t.JOB, t.MGR, t.HIREDATE, t.SAL, t.COMM, t.DEPTNO from scott.emp t");
dataMapper.test_exe_procedure2(mm);
}
System.out.println("Get in_PAGE: "+ mm.get("in_PAGE"));
System.out.println("Get in_ROWS: "+ mm.get("in_ROWS"));
System.out.println("Get inout_TOTAL_RECORDS: "+ mm.get("inout_TOTAL_RECORDS"));
System.out.println("Get inout_TOTAL_PAGES: "+ mm.get("inout_TOTAL_PAGES"));
List<Employee> empList = (List<Employee>)mm.get("out_SYSCURSOR");
Employee.Print(empList);
return;
}
}
db.sql
CREATE OR REPLACE procedure P_TEST_PAGING_QUERY
(
p_pagesql in varchar2, --sql
p_curPage in out Number , --当前页
p_pageSize in out Number , --每页显示记录的条数
p_totalRecords out Number, --总记录数
p_totalPages out Number , -- 总页数
pageResultSet out SYS_REFCURSOR -- 输出结果集游标
)
as
v_sql varchar2(2000):=''; --sql语句
v_startRecord Number; --开始显示的记录数
v_endRecord Number; --结束显示的记录条数
begin
--记录总记录条数
v_sql:='select count(*) FROM (' || p_pagesql || ')';
execute IMMEDIATE v_sql INTO p_totalRecords;
IF MOD(p_totalRecords,p_pageSize)=0 THEN
--得到整数则直接取得到的页码数否在原来的基础上增加一个页码
p_totalPages:=p_totalRecords/p_pageSize;
ELSE
p_totalPages:=p_totalRecords/p_pageSize+1;
END IF;
--验证页号
IF p_curPage<1 THEN
p_curPage:=1;
END IF;
--如果取的当前页大于总页数则取最大页数的数据
IF p_curPage>p_totalPages THEN
p_curPage:=p_totalPages;
END IF;
--实现分页查询
v_startRecord :=(p_curPage - 1) * p_pageSize + 1;
v_endRecord :=p_curPage * p_pageSize;
v_sql := 'select * from (SELECT t.*, ROWNUM RN from (' || p_pagesql || ') t where rownum<=' || v_endRecord || ' ) where RN>=' ||v_startRecord;
p_totalPages:=floor(p_totalPages); --去整数总页
OPEN pageResultSet FOR v_sql;
exception
when others then
CLOSE pageResultSet;
end P_TEST_PAGING_QUERY;
/
dbMapper.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<!-- 映射文件,映射到对应的SQL接口 -->
<mapper namespace="com.demo.DataMapper">
<!--返回的结果集,用于关联实体类属性和数据库字段 -->
<!--如果实体类属性和数据库属性名保持一致,就不需要javaType和jdbcType(必须大写)属性 -->
<resultMap id="Employee_resultMap" type="com.demo.Employee">
<result column="EMPNO" property="EMPNO" javaType="java.lang.Integer" jdbcType="INTEGER" />
<result column="ENAME" property="ENAME" javaType="java.lang.String" jdbcType="VARCHAR" />
<result column="JOB" property="JOB" javaType="java.lang.String" jdbcType="VARCHAR" />
<result column="MGR" property="MGR" javaType="java.lang.Integer" jdbcType="INTEGER" />
<result column="HIREDATE" property="HIREDATE" javaType="java.util.Date" jdbcType="DATE"/>
<result column="SAL" property="SAL" javaType="java.lang.Double" jdbcType="DOUBLE" />
<result column="COMM" property="COMM" javaType="java.lang.Double" jdbcType="DOUBLE" />
<result column="DEPTNO" property="DEPTNO" javaType="java.lang.Integer" jdbcType="INTEGER" />
</resultMap>
<!-- 查询数据 -->
<!-- 入参定义:在接口定义中使用@Param注解(单参/多参都可使用) -->
<!-- 语句末尾不能有分号:ORA-00911: invalid character -->
<select id="test_query" resultMap="Employee_resultMap">
select t.EMPNO, t.ENAME, t.JOB, t.MGR, t.HIREDATE, t.SAL, t.COMM, t.DEPTNO from scott.emp t where 1=1
<if test="EMPNO != null">
and t.EMPNO >= #{EMPNO}
</if>
order by t.EMPNO
</select>
<!-- 插入数据 -->
<!-- 入参定义:实体类,会自动解析属性到对应的值-->
<insert id="test_insert" parameterType="com.demo.Employee">
insert into scott.emp (EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO)
values (#{EMPNO}, #{ENAME}, #{JOB}, #{MGR}, #{HIREDATE}, #{SAL}, #{COMM}, #{DEPTNO})
</insert>
<!-- 更新数据 -->
<!-- 入参定义:在接口定义中使用@Param注解(多参情况,只能使用这种形式) -->
<update id="test_update">
UPDATE scott.emp SET COMM = #{COMM}
WHERE EMPNO = #{EMPNO}
</update>
<!-- 删除数据 -->
<!-- 入参定义:parameterType指定输入参数(单参情况,亦可@Param注解) -->
<delete id="test_delete" parameterType="java.lang.Integer">
DELETE FROM scott.emp t WHERE t.EMPNO =#{EMPNO}
</delete>
<!-- 批量查询 -->
<!-- 入参定义:使用[]数组array -->
<select id="test_multi_query" parameterType="int[]" resultMap="Employee_resultMap">
select t.EMPNO, t.ENAME, t.JOB, t.MGR, t.HIREDATE, t.SAL, t.COMM, t.DEPTNO from scott.emp t where t.DEPTNO in
<!-- arr:array中的具体值 -->
<foreach collection="array" item="arr" index="no" open="(" separator="," close=")">
#{arr}
</foreach>
</select>
<!-- 批量插入 -->
<!-- 入参定义:使用List集合对象 -->
<insert id="test_multi_insert" parameterType="java.util.List">
merge into scott.emp r
<!-- insert 和update中所有的数据都需要从using中获取 -->
using(
<!-- item:list中的具体对象 -->
<foreach collection="list" index="index" item="item" open="" close="" separator="union">
select
#{item.EMPNO,jdbcType=INTEGER} as EMPNO,
#{item.ENAME,jdbcType=VARCHAR} as ENAME,
#{item.JOB,jdbcType=VARCHAR} as JOB,
#{item.MGR,jdbcType=INTEGER} as MGR,
#{item.HIREDATE,jdbcType=DATE} as HIREDATE,
#{item.SAL,jdbcType=DOUBLE} as SAL,
#{item.COMM,jdbcType=DOUBLE} as COMM,
#{item.DEPTNO,jdbcType=INTEGER} as DEPTNO
from dual
</foreach>
) tmp
<!-- on后面的括弧不能省 -->
on ( tmp.EMPNO = r.EMPNO)
when matched THEN
update set
<!-- ORA-38104: 在on条件中的列是不可以更新的 -->
<!-- r.EMPNO = tmp.EMPNO, -->
r.ENAME = tmp.ENAME,
r.JOB = tmp.JOB,
r.MGR = tmp.MGR,
r.HIREDATE = tmp.HIREDATE,
r.SAL = tmp.SAL,
r.COMM = tmp.COMM,
r.DEPTNO = tmp.DEPTNO
when not matched THEN
insert
<trim prefix="(" suffix=")" suffixOverrides=",">
EMPNO,
ENAME,
JOB,
MGR,
HIREDATE,
SAL,
COMM,
DEPTNO
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
tmp.EMPNO,
tmp.ENAME,
tmp.JOB,
tmp.MGR,
tmp.HIREDATE,
tmp.SAL,
tmp.COMM,
tmp.DEPTNO
</trim>
</insert>
<!-- 批量删除 -->
<delete id="test_multi_delete">
<!-- delete from emp where empno in(7980,7981) -->
delete from scott.emp t where t.empno in
<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<!-- 执行存储过程。语句类型statementType一定要为CALLABLE-->
<!-- 入参定义:占位符形式写入SQL,然后接口中使用MAP传入 -->
<!-- 参数模式:共IN、OUT、INOUT三种,如果是IN参可不写,此外IN存在 null的情况,必须指定 jdbcType,还有 OUT时必须指定 jdbcType -->
<select id="test_exe_procedure1" statementType="CALLABLE">
{CALL
P_TEST_PAGING_QUERY(
'select t.EMPNO, t.ENAME, t.JOB, t.MGR, t.HIREDATE, t.SAL, t.COMM, t.DEPTNO from scott.emp t',
#{in_PAGE, mode=IN, jdbcType=INTEGER},
#{in_ROWS, mode=IN, jdbcType=INTEGER},
#{inout_TOTAL_RECORDS,mode=INOUT, jdbcType=INTEGER},
#{inout_TOTAL_PAGES, mode=INOUT, jdbcType=INTEGER},
#{out_SYSCURSOR, mode=OUT, jdbcType=CURSOR, javaType=java.sql.ResultSet, resultMap=Employee_resultMap}
)}
</select>
<!-- 执行存储过程2-->
<!-- 入参定义:使用parameterMap进行参数映射,这时候存储过程参数占位符为:? -->
<!-- 注意:调用存储过程的两个大括号和中间的内容不要换行!可能会出问题的。正确姿势:{CALL xxx(?,?...)} -->
<parameterMap type="java.util.Map" id="test_exe_procedure2_param">
<parameter property="in_SQL" mode="IN" jdbcType="INTEGER" />
<parameter property="in_PAGE" mode="IN" jdbcType="INTEGER" />
<parameter property="in_ROWS" mode="IN" jdbcType="INTEGER" />
<parameter property="inout_TOTAL_RECORDS" mode="INOUT" jdbcType="INTEGER" />
<parameter property="inout_TOTAL_PAGES" mode="INOUT" jdbcType="INTEGER" />
<parameter property="out_SYSCURSOR" mode="OUT" jdbcType="CURSOR" javaType="java.sql.ResultSet" resultMap="Employee_resultMap" />
</parameterMap>
<select id="test_exe_procedure2" statementType="CALLABLE" parameterMap="test_exe_procedure2_param">
{CALL P_TEST_PAGING_QUERY(?,?,?,?,?,?)}
</select>
</mapper>
application.properties
server.port=18077
server.address=127.0.0.1
server.contextPath=/
spring.datasource.url=jdbc:oracle:thin:@127.0.0.1:1521:dev2018
spring.datasource.username=system
spring.datasource.password=oracle
spring.datasource.driver-class-name=oracle.jdbc.OracleDriver
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>come.demo.SpringBootMyBatis</groupId>
<artifactId>SpringBootMyBatis</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<name>SpringBootMyBatis</name>
<description>SpringBootMyBatis</description>
<!-- lookup parent from repository -->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.9.RELEASE</version>
<relativePath />
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.oracle.ojdbc6</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.3</version>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<maimClass>com.demo.Application</maimClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
<!-- Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1: -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<verbose>true</verbose>
<fork>true</fork>
<executable>${JAVA8_HOME}/bin/javac</executable>
</configuration>
</plugin>
</plugins>
<defaultGoal>compile</defaultGoal>
</build>
</project>