You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

GitHub Actions构建Spring Boot项目时SQL Server驱动报错:不识别jdbcUrl变量${SPRING_DATASOURCE_URL}

GitHub Actions构建Spring Boot项目时SQL Server驱动报错:不识别jdbcUrl变量${SPRING_DATASOURCE_URL}

我正在开发一个Spring Boot项目,生产环境使用SQL Server和Azure App Service。我按照以下步骤配置部署:

我的数据库URL是:

jdbc:sqlserver://spring-sql-server.database.windows.net:1433;database=<database-name>;user=<username>@spring-sql-server;password=<password>;encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30;
  • 把所有密钥添加到GitHub仓库的Secrets中
    GitHub仓库Secrets配置截图
  • 在application.properties文件中添加环境变量配置
    application.properties环境变量配置截图

使用GitHub Actions构建项目时,我遇到了如下错误:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is java.lang.RuntimeException: Driver com.microsoft.sqlserver.jdbc.SQLServerDriver claims to not accept jdbcUrl, ${SPRING_DATASOURCE_URL}

我已经正确配置了URL,但还是出现这个错误。(我不确定,会不会是因为密码里包含#导致的?)

备注:内容来源于stack exchange,提问作者ayush

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.17 12:44:50