Spring Boot应用启动失败,使用azure.keyvault.secret.property-sources时缺少日志。

huangapple go评论85阅读模式
英文:

Springboot application start up fails and missing logs when using azure.keyvault.secret.property-sources

问题

我正在尝试将我的用Kotlin编写的Spring Boot应用程序迁移到Azure。我在我的应用程序中添加了spring-cloud-azure-starter-keyvault-secrets:4.5.0依赖,并将以下配置添加到application.properties中。

my.secret=${my-azure-secret}
spring.cloud.azure.keyvault.secret.property-source-enabled=true
spring.cloud.azure.keyvault.secret.property-sources[0].endpoint=<my-vault>.vault.azure.net/

添加后,Spring Boot初始化不再起作用,我找不到任何日志。

log.info { "Log before springboot initialize&quot }
SpringApplication(MyApplication::class.java).run(*args)
log.info { "Log after springboot initialize&quot }

因此,Log before springboot initialize被记录,之后什么都不发生(或者我找不到后续的日志)。

我已经验证了与logback设置无关,因为如果我从application.properties中删除属性spring.cloud.azure.keyvault.secret.property-sources[0].endpoint,它会正常启动。

(我还尝试添加了额外的依赖项spring-cloud-azure-dependencies:4.5.0

有关发生的情况以及如何解决的任何线索/提示吗?

谢谢。

英文:

I am trying to migrate my springboot application written in kotlin to azure.
I added spring-cloud-azure-starter-keyvault-secrets:4.5.0 dependency in my app, and added below configurations to application.properties.

my.secret=${my-azure-secret}
spring.cloud.azure.keyvault.secret.property-source-enabled=true
spring.cloud.azure.keyvault.secret.property-sources[0].endpoint=<my-vault>.vault.azure.net/

After I add this, the spring boot initialization doesn't work any more and i can't find any logs.

log.info { "Log before springboot initialize" }
SpringApplication(MyApplication::class.java).run(*args)
log.info { "Log after springboot initialize" }

So, Log before springboot initialize is logged, and after that nothing happens (or I can't find any logs afterwards)

I already verified it is not related to any logback settings because if I remove the property spring.cloud.azure.keyvault.secret.property-sources[0].endpoint from application.properties, it boots up properly.

(I also tried to add the additional dependency spring-cloud-azure-dependencies:4.5.0 )

Any clues/hints what is happening and how to resolve it ?

Thanks.

答案1

得分: 1

  • Here I was able to boot the spring application using the same dependencies.

  • But here I used the latest version of spring-cloud-azure-starter-keyvault-secrets i.e. 5.0.0 also my spring boot version is 3.0.2

my dependencies:

<dependencies>  
 <dependency> <groupId>org.springframework.boot</groupId>  
 <artifactId>spring-boot-starter-web</artifactId>  
 </dependency>  <!-- https://mvnrepository.com/artifact/com.azure.spring/spring-cloud-azure-starter-keyvault-secrets -->  
  <dependency>  
 <groupId>com.azure.spring</groupId>  
 <artifactId>spring-cloud-azure-starter-keyvault-secrets</artifactId>  
 <version>5.0.0</version>  
 </dependency>  
  
 <dependency> <groupId>org.springframework.boot</groupId>  
 <artifactId>spring-boot-starter-test</artifactId>  
 <scope>test</scope>  
 </dependency></dependencies>
  • Also I use windows so instead of my_azure_secret instead of the my-azure-secret

output:
Spring Boot应用启动失败,使用azure.keyvault.secret.property-sources时缺少日志。

英文:
  • Here I was able to boot the spring application using the same dependencies.

  • But here I used the latest version of spring-cloud-azure-starter-keyvault-secrets i.e. 5.0.0 also my spring boot version is 3.0.2

my dependencies:

<dependencies>  
 <dependency> <groupId>org.springframework.boot</groupId>  
 <artifactId>spring-boot-starter-web</artifactId>  
 </dependency>  <!-- https://mvnrepository.com/artifact/com.azure.spring/spring-cloud-azure-starter-keyvault-secrets -->  
  <dependency>  
 <groupId>com.azure.spring</groupId>  
 <artifactId>spring-cloud-azure-starter-keyvault-secrets</artifactId>  
 <version>5.0.0</version>  
 </dependency>  
  
 <dependency> <groupId>org.springframework.boot</groupId>  
 <artifactId>spring-boot-starter-test</artifactId>  
 <scope>test</scope>  
 </dependency></dependencies>
  • Also I use windows so instead of my_azure_secret instead of the my-azure-secret

output:
Spring Boot应用启动失败,使用azure.keyvault.secret.property-sources时缺少日志。

huangapple
  • 本文由 发表于 2023年2月6日 18:34:57
  • 转载请务必保留本文链接:https://go.coder-hub.com/75360152.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定