springboot分模块搭建springcloud 配置中心遇到的坑

  • Post author:
  • Post category:其他

这个事自己被坑了两天了,在这里记录一下,以后长记性
一开始模块建好了就是访问配置中心总提示:Failed to configure a DataSource: ‘url’ attribute is not specified and no embedded datasource could be configured.
第一个可能:你没有把application.yml变成bootstrap.yml
第二个可能:模块的启动类,应该是项目名+Application不应该是模块名
第三个可能:bootstrap.yml配置有问题,这里有两种配置,都试试
spring:
application:
name: product
cloud:
config:
uri: http://localhost:8083/ #Config server的uri
profile: dev #指定的环境
label: master #指定分支
management:
security:
enabled: false
——————————————————————————————————————
spring:
application:
name: product
cloud:
config:
discovery:
enabled: true
service-id: CONFIG(注册中心显示的服务名)
profile: dev
eureka:
client:
service-url:
defaultZone: http://localhost:8761/eureka/

最后一个可能:你git上的配置文件名和上面的name的值是不是一样的


版权声明:本文为weixin_44170566原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。