ruijiege

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

1.导包

 <!--mybatisplus的包-->
            <dependency>
                <groupId>com.baomidou</groupId>
                <artifactId>mybatis-plus-boot-starter</artifactId>
                <version>2.2.0</version>
            </dependency>
            <!--连接数据库-->
            <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
                <version>5.1.6</version>
            </dependency>

            <!-- druid连接池的包 -->
            <dependency>
                <groupId>com.alibaba</groupId>
                <artifactId>druid</artifactId>
                <version>1.1.10</version>
            </dependency>

 

2.在主配置类上添加标签

package cn.jiedada;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * @EnableTransactionManagement:开启事务
 */
@SpringBootApplication
@EnableEurekaClient
@EnableTransactionManagement
@MapperScan(basePackages = "cn.jiedada.hrm.mapper")
public class SystemManageApplication2010 {
    public static void main(String[] args) {
        new SpringApplicationBuilder(SystemManageApplication2010.class).web(true).run(args);
    }

}

 

3.修改yml

eureka:
  client:
    serviceUrl:
      defaultZone: http://localhost:1010/eureka/
  instance:
    ip-address: true
    instance-id: systemmanage-server
server:
  port: 2010
spring:
  application:
    name: systemmanage-server
  datasource:
    username: root
    password: 123456
    driver-class-name: com.mysql.jdbc.Driver
    url: jdbc:mysql:///hrm-systemmanage
    type: com.alibaba.druid.pool.DruidDataSource
mybatis-plus:
  mapper-locations: classpath:cn/itsource/hrm/mapper/*Mapper.xml
  type-aliases-package: cn.jiedada.hrm.domain,cn.jiedada.hrm.query

 

posted on 2019-11-30 14:14  哦哟这个怎么搞  阅读(501)  评论(0编辑  收藏  举报