hippo4j
hippo4j copied to clipboard
[Feature] Load remote configuration ahead of time when the Spring container starts.
Demand advice
Implement fetching remote configurations from the remote Apollo configuration center directly during startup in the Hippo4j-Agent module.
Approach
By default, Apollo does not fetch the latest configurations from the remote configuration center and bind them to the Spring Environment during startup.
It only refreshes the remote parameters to the local environment when the first change occurs, which can result in a discrepancy between the thread pool and the user's expectations during the first startup.
My approach is to refer to ApolloApplicationContextInitializer in Spring container startup. If the user has not configured apollo.bootstrap.enabled=true
and apollo.bootstrap.namespaces=xxx
(where 'xxx' corresponds to the configuration in spring.dynamic.thread-pool.apollo.namespace
), then before the Spring context is fully prepared, supplement the remote parameters into Spring's Environment based on the spring.dynamic.thread-pool.apollo.namespace Spring configuration.
Considerations
Note: When injecting, it is important not to modify or override the original user configurations or behaviors to avoid unexpected errors.
This ISSUE and #1132 are the same problem, but the current ISSUE is in agent mode and the other is in spring-boot-starter mode. If interested you can try to fix another ISSUE at the same time.
Hello, I want to try it, can I?