带JDBC的Spring配置服务器正在抛出无效的配置服务器配置错误

问题描述 投票:0回答:1

我想将JDBC mysql与Spring云配置服务器一起使用,但总是失败,这就是我在做的事情:

Spring云版:Finchley.SR2

  1. 在POM.xml中 <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-config-server</artifactId> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-jdbc</artifactId> <exclusions> <exclusion> <groupId>org.apache.tomcat</groupId> <artifactId>tomcat-jdbc</artifactId> </exclusion> </exclusions> </dependency>
  2. 在application.config里面:
    spring.profiles.active= jdbc
    spring.datasource.url=jdbc:mysql://localhost:3306/config_db
    spring.datasource.username=root
    spring.datasource.password=12345
    spring.datasource.driver-class-name=com.mysql.jdbc.Driver
    spring.datasource.platform= mysql
    spring.cloud.config.server.jdbc.sql= SELECT `key`, `value` FROM `properties` WHERE `application`=? AND `profile`=? AND `label`=?;
    spring.cloud.config.server.jdbc.order=0
    spring.cloud.config.server.default-profile=production
    spring.cloud.config.server.default-label=latest

最后,当我启动服务器时,我收到以下错误:

APPLICATION FAILED TO START
Description:
Invalid config server configuration.
Action:
If you are using the git profile, you need to set a Git URI in your configuration.  If you are using a native profile and have spring.cloud.config.server.bootstrap=true, you need to use a composite configuration.

我这里没有使用git,为什么错误是关于git url的?

spring-cloud-config spring-config
1个回答
0
投票

使用MySQL时我遇到了同样的问题。这似乎是MySQL JdbcTemplate(look here)的一个问题。

我切换到H2存储配置,它的工作原理。

我想知道是否有使用MySQL的解决方法?

© www.soinside.com 2019 - 2024. All rights reserved.