I’m working with Spring Cloud Config Server version 4.2.1 and Redis as the backend. I need to set up some shared properties that all client apps can use. The docs explain how to do this, but it doesn’t seem to work with Redis.
I want client apps to be able to use @Value("${property}")
without having to make a hash field for each app in Redis. Is there a way to achieve this?
I tried creating a hash field named application
in Redis, similar to how it’s done with a JDBC repository, but that didn’t work. Although I can use spring.cloud.config.server.overrides.property="value"
in the server config, I need to update this value dynamically.
Does anyone have any ideas on how to make this work? I’m wondering if I’m overlooking something basic.
hey jasper, that’s an intriguing problem! have u considered using Redis Pub/Sub for dynamic updates? it might help with real-time property changes. Also, what about implementing a custom PropertySource to handle global properties? Just brainstorming here - curious to hear if you’ve explored these avenues?
hey jasper, maybe u can exploit spring cloud bus with redis for them dynmaic updates. try setting a unique redis hash for global props and a tailor-made PropertySourceLocator to grab 'em. could be a neat workaround if u haven’t tried that route.
Have you considered implementing a custom PropertySourceLocator? This approach could allow you to define a specific Redis key for global properties, separate from application-specific configurations. You could then prioritize this global property source in your configuration hierarchy.
Additionally, you might explore using Spring Cloud Bus with Redis as the transport. This could facilitate dynamic updates to your global properties across all client applications. By broadcasting configuration changes, you could achieve the real-time updates you’re seeking without relying on individual application-specific Redis hash fields.
Remember to carefully manage concurrency and potential conflicts when implementing these solutions, especially in a distributed environment.