1.0.0-SNAPSHOT
4.0.0
ly-user-service
org.springframework.boot
spring-boot-starter-web
org.springframework.cloud
spring-cloud-starter-netflix-eureka-client
org.mybatis.spring.boot
mybatis-spring-boot-starter
tk.mybatis
mapper-spring-boot-starter
mysql
mysql-connector-java
com.leyou.service
ly-user-interface
${leyou.latest.version}
(3)编写启动类
package com.leyou;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import tk.mybatis.spring.annotation.MapperScan;
@SpringBootApplication
@EnableDiscoveryClient
@MapperScan(“com.leyou.user.mapper”)
public class LyUserApplication {
public static void main(String[] args) {
SpringApplication.run(LyUserApplication.class,args);
}
}
(4)创建mapper路径
(5)编写配置文件
server:
port: 8088
spring:
application:
name: user-service
datasource:
url: jdbc:mysql://127.0.0.1:3306/yun6
username: root
password: root
driver-class-name: com.mysql.jdbc.Driver
eureka:
client:
service-url:
defaultZone: http://127.0.0.1:10086/eureka
instance:
prefer-ip-address: true
ip-address: 127.0.0.1
instance-id: e u r e k a . i n s t a n c e . i p − a d d r e s s . {eureka.instance.ip-address}. eureka.instance.ip−address.{server.port}
lease-re