gpt4 book ai didi

grails - 无法从Spring Cloud Config Server加载Grails 3(GORM)数据源属性

转载 作者:行者123 更新时间:2023-12-02 14:41:12 25 4
gpt4 key购买 nike

我正在尝试使用Spring Cloud Config Server来对Grails 3(人员)应用程序配置进行外部化,但是我似乎无法设置dataSource属性。

目前,我可以将其他属性(sample.message)加载到我的Grails 3(人员)应用程序中,并使用grailsApplication.config.sample.message检索它们,而不会出现问题。击中Config Server上的REST端点(localhost:8888/personnel/master)显示了我想要的配置信息,所以我有些困惑。

我已经在我的Git存储库中的personnel.properties文件中尝试了以下各项:

datasource.user=example
datasource.password=example

grails.datasource.user=example
grails.datasource.password=example

spring.datasource.user=example
spring.datasource.password=example

但是它们都不起作用。我继续看到错误消息,上面写着 sa@localhost (using password: no),提示数据源属性特别不起作用。

我知道 spring-boot-starter-data-jpa是可能的,所以我想知道:
  • GORM是否可能?
  • 如果是,我是否需要手动创建数据源bean?
  • 我可以使用datasource.usergrails.datasource.userspring.datasource.user等哪些属性名称?
  • 最佳答案

    在完成Shashank的编辑后,我意识到这与我的媒体资源设置有关。 datasource应该是dataSource,而user应该是username。完成这些更正后,该应用程序(人员)便可以正常工作。所以,

  • 是的,有可能。
  • 不,您不需要手动创建bean
  • 属性名称是:

  • personal.properties
    dataSource.username=example
    dataSource.password=example
    dataSource.url=jdbc:mysql://localhost:3306/personnel

    关于grails - 无法从Spring Cloud Config Server加载Grails 3(GORM)数据源属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33839695/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com