1. 程式人生 > >取出微服務整體的專案中的單獨一個模組

取出微服務整體的專案中的單獨一個模組

編寫單獨模組是不需要啟動整個專案的方案

修改服務中的bootstrap配置檔案

有四個關鍵點修改

1.修改資料庫連結配置

資料庫配置

  datasource:
    url: jdbc:mysql://localhost:3306/demo?useUnicode=true&characterEncoding=utf-8
    username: root
    password: 123456 
    max-idle: 10
    max-wait: 10000
    min-idle: 5
    initial-size: 5
    validation-query: SELECT 1
    test-on-borrow: false
    test-while-idle: true
    time-between-eviction-runs-millis: 18800
    jdbc-interceptors: ConnectionState;SlowQueryReport(threshold=0)

2.修改解析xml檔案的配置

解析的xml檔案

server:
  port: 18046
mybatis:
  mapperLocations: classpath*:mapper/**/*Dao.xml
  executor-type: REUSE     

3.修改Eureka註冊中心配置

註冊中心配置

  client: 
    fetch-registry: false
    register-with-eureka: false
    serviceUrl: 
      defaultZone: http://${myauth.eureka.username}:${myauth.eureka.password}@localhost:8761/eureka/  

4.修改開啟HTTP basic認證

不然會報錯:Full authentication is required to access this resource提示沒有許可權的問題:
修改許可權

security:
  basic:
    enabled: false