-
Notifications
You must be signed in to change notification settings - Fork 32
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
spring.redis.* should be spring.data.redis.* in spring boot 3 #87
Comments
In the meantime, you can use this: Import spring cloud bindings in your app compile scopee.g. gradle:
Please note this is in Add the Boot3RedisPropertiesProcessorpublic class Boot3RedisPropertiesProcessor implements BindingsPropertiesProcessor {
public static final String TYPE = "redis";
@Override
public void process(Environment environment, Bindings bindings, Map<String, Object> properties) {
if (!shouldApply(environment)) {
return;
}
bindings.filterBindings(TYPE).forEach(binding -> {
var mapper = new BindingPropertiesMapper(binding.getSecret(), properties);
mapper.map("client-name", "spring.data.redis.client-name");
mapper.map("cluster.max-redirects", "spring.data.redis.cluster.max-redirects");
mapper.map("cluster.nodes", "spring.data.redis.cluster.nodes");
mapper.map("database", "spring.data.redis.database");
mapper.map("host", "spring.data.redis.host");
mapper.map("password", "spring.data.redis.password");
mapper.map("port", "spring.data.redis.port");
mapper.map("sentinel.master", "spring.data.redis.sentinel.master");
mapper.map("sentinel.nodes", "spring.data.redis.sentinel.nodes");
mapper.map("ssl", "spring.data.redis.ssl");
mapper.map("url", "spring.data.redis.url");
});
}
static class BindingPropertiesMapper {
private final Map<String, String> secret;
private final Map<String, Object> properties;
private final PropertyMapper mapper;
public BindingPropertiesMapper(Map<String, String> secret, Map<String, Object> properties) {
this.secret = secret;
this.properties = properties;
this.mapper = PropertyMapper.get().alwaysApplyingWhenNonNull();
}
public void map(String from, String to) {
mapper.from(secret.get(from)).to(value -> this.properties.put(to, value));
}
}
private static boolean shouldApply(Environment environment) {
return environment.getProperty(String.format("org.springframework.cloud.bindings.boot.%s.enable", TYPE),
Boolean.class, true);
}
} Register the processorIn
|
Here's an other workaround:
|
Related: #89 |
Note: the above workaround will break when gh-94 gets merged ; the custom |
hello, latest work is in #94 and should be merged soon; stay tuned! as @Kehrlann mentioned in #87 (comment) |
spring cloud bindings is failing in spring boot 3 due to pointing against old value
The text was updated successfully, but these errors were encountered: