编写单独模块是不需要启动整个项目的方案
修改服务中的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文件的配置
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