-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some times properties are not set on bean creation #446
Comments
And sometime only some properties are null, and other are correct. |
my beans are just created using |
We've got exactly same behaviour, and application crashes at startup in ~80% of runs because of uninitialised properties of
Partial sources# bootstrap.yml
spring:
profiles: prod
cloud:
consul:
host: http://MASKED
port: 80
config:
format: yaml
prefix: MASKED/prod
name: bb/${spring.application.name}
acl-token: ${acl_token}
vault:
scheme: https
host: MASKED
port: 443
authentication: approle
application-name: bb/${spring.application.name}
generic:
backend: MASKED/prod
app-role:
secret-id: ${secret_id}
role-id: ${role_id} # build.gradle.kts
plugins {
// ...
id("org.springframework.boot") version "2.3.3.RELEASE"
// ...
}
// ...
dependencyManagement {
imports {
mavenBom("org.springframework.cloud:spring-cloud-dependencies:Hoxton.SR7")
}
}
// ....
dependencies {
// Spring
// Boot
developmentOnly(group = "org.springframework.boot", name = "spring-boot-devtools")
implementation(group = "org.springframework.boot", name = "spring-boot-starter-cache")
implementation(group = "org.springframework.boot", name = "spring-boot-starter-webflux")
implementation(group = "org.springframework.boot", name = "spring-boot-starter-actuator")
// Cloud
implementation(group = "org.springframework.cloud", name = "spring-cloud-starter-sleuth")
// ....
} package MASKED.configuration.properties
import org.springframework.boot.context.properties.ConfigurationProperties
import org.springframework.cloud.context.config.annotation.RefreshScope
@RefreshScope
@ConfigurationProperties(prefix = "service.jira")
class JiraProperties {
lateinit var host: String
lateinit var username: String
lateinit var password: String
} Startup log
|
I have the same issue and I was able to replicate here: That is usually fine but manifests easier in low cpu environments and larger apps. |
|
@mp911de that's fine but we also have the scenario where the secret has not changed at all in vault and yet the app throws IllegalArgumentException just because the property read (@value, @ConfigurationProperties or any other read method) kicks in just between Some ideas: |
I concluded this would be probably the best option. However, we need to take into account, that rotation of secrets may fail (that's where we typically see a gap). After reconsidering, it would probably even make sense to introduce a new event If rotation fails, we emit All this needs to happen in Spring Vault. Can you file a new ticket there so we can close this ticket and apply the changes to Spring Vault? |
Closing in favor of spring-projects/spring-vault#594. |
That's fixed for version 2.3 RC1 of Spring Vault via spring-projects/spring-vault#594 now. We'd like to get feedback on this issue before backporting it to the 2.2.x line. |
In some case when my beans definitions function are run, properties are not already loaded, so I have some NullPointerException.
This happen randomly and can work after many restart. This happend on computer with limited resources.
I use vault to load properties.
I start spring cloud vault on a bootstrap.yaml like that
My JVM start on 0.5 cpu with this memory data
It seems that happen since my last spring cloud upgrade (from spring-cloud-vault-config 2.2.0 to 2.2.3).
I have a feeling that setting
config.lifecycle.enabled
tofalse
fix the issue, but I don't understand why.Can you help to understand this issue?
Thanks
The text was updated successfully, but these errors were encountered: