欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

SpringCloud-2.X 学习笔记02 Eureka Client 搭建

程序员文章站 2022-07-13 09:40:13
...

SpringCloud-2.X 学习笔记02 Eureka Client 搭建

1 搭建服务

SpringCloud-2.X 学习笔记02 Eureka Client 搭建

2 添加注解

package com.xu.eureka.client;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
@MapperScan(basePackages = {"com.xu.eureka.client.mapper"})
public class EurekaClientApplication {

    public static void main(String[] args) {
        SpringApplication.run(EurekaClientApplication.class, args);
    }

}

3 修改配置

spring:
  main:
    allow-bean-definition-overriding: true
  application:
    name: EurekeClient
  datasource:
    url: jdbc:mysql://192.168.0.5:3333/langyun?serverTimezone=UTC&characterEncoding=utf8&allowPublicKeyRetrieval=true
    username: root
    password: 123456
    driver-class-name: com.mysql.cj.jdbc.Driver
  mail:
    jndi-name:
eureka:
  client:
    serviceUrl:
      defaultZone: http://127.0.0.1:8761/eureka/
server:
  port: 7770

mybatis-plus:
  mapper-locations: mapper/*.xml
  type-aliases-package: com.xu.eureka.client.entity
  configuration:
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

4 查看结果

SpringCloud-2.X 学习笔记02 Eureka Client 搭建