Skip to content
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

#3206: Enable providing Redisson configuration through Spring Boot Configuration YAML #4640

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

broodjetom
Copy link
Contributor

Fixes #3206.

These changes allow you to specify Redisson configuration through Spring Boot Configuration YAML.

There already is an option to specify config, but it is of type String. This means you will get a YAML String within YAML. If you want to overwrite that configuration you will have to overwrite the full String.

With these changes you will be able to overwrite a subset of the configuration if you want. This also means you can take advantage of Spring Boot profiles to specify Redisson configuration.

… Boot Configuration YAML

Signed-off-by: Tom Scholten <Tom.Scholten@infosupport.com>
…edisson configuration

Signed-off-by: Tom Scholten <Tom.Scholten@infosupport.com>
Signed-off-by: Tom Scholten <Tom.Scholten@infosupport.com>
@@ -361,7 +361,7 @@ protected MasterSlaveServersConfig getMasterSlaveServersConfig() {
return masterSlaveServersConfig;
}

protected void setMasterSlaveServersConfig(MasterSlaveServersConfig masterSlaveConnectionConfig) {
public void setMasterSlaveServersConfig(MasterSlaveServersConfig masterSlaveConnectionConfig) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All these methods should remain protected to avoid confusion for developers and force them to use "use...." methods instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For Spring Boot to read the configuration into an object, it uses setters by default. There is another way to do this, by reading in the several configs in the RedissonProperties class, but then I still need a way to somehow set the server configuration in the Config object. Would it be a possibility to make the

SingleServerConfig useSingleServer(SingleServerConfig config)

public instead of default visibility?

Otherwise, I only see a possibility in making a custom mapper that will set each field in the server configs separately, but this will have some impact on the maintainability of the project, since adding a field to a server config requires you to add a mapping for that as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Fill variables in redisson.yml with Spring Boot values.
2 participants