首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >带有JDBC的Spring配置服务器正在引发无效的配置服务器配置错误。

带有JDBC的Spring配置服务器正在引发无效的配置服务器配置错误。
EN

Stack Overflow用户
提问于 2019-01-20 00:06:24
回答 2查看 633关注 0票数 0

我想在服务器上使用JDBC,但总是失败,这就是我要做的:

春季云版本: Finchley.SR2

  1. 在POM.xml中 org.springframework.cloud spring-cloud-config-server org.springframework spring-jdbc org.apache.tomcat tomcat-jdbc
  2. 在application.config内部:
代码语言:javascript
复制
    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

最后,当我启动服务器时,会出现以下错误:

代码语言:javascript
复制
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的?

EN

回答 2

Stack Overflow用户

发布于 2019-04-29 08:40:16

在使用MySQL时,我也遇到了同样的问题。这似乎是MySQL JdbcTemplate (看这儿)的一个问题。

我切换到H2来存储配置,它可以工作。

我想知道是否有什么解决办法可以使用MySQL?

票数 0
EN

Stack Overflow用户

发布于 2022-03-08 08:46:38

当我试图在启动时删除DataSourceAutoConfiguration.class时,我也遇到了同样的错误。

@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class })

当我刚刚用

@SpringBootApplication

一切都如期而至。

我将该类排除在外的原因是为了在启动时停止自动生成密码。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54272460

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档