-
Notifications
You must be signed in to change notification settings - Fork 191
DATACOUCH-652 - Inject translation service bean in CouchbaseTemplateSupport. #294
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
Conversation
@jorgerod Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
@jorgerod Thank you for signing the Contributor License Agreement! |
This looks good to me. I'm adding another reviewer. |
I think it would be interesting to make a backport to 4.1.x. How do you see it? |
@@ -145,14 +146,14 @@ protected void configureEnvironment(final ClusterEnvironment.Builder builder) { | |||
|
|||
@Bean(name = BeanNames.COUCHBASE_TEMPLATE) | |||
public CouchbaseTemplate couchbaseTemplate(CouchbaseClientFactory couchbaseClientFactory, | |||
MappingCouchbaseConverter mappingCouchbaseConverter) { | |||
return new CouchbaseTemplate(couchbaseClientFactory, mappingCouchbaseConverter); | |||
MappingCouchbaseConverter mappingCouchbaseConverter, TranslationService translationService) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this breaks backwards compatibility by introducing another required argument - if this should be added we need another overload that keeps the defaults as is I think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @daschl
You are right about the overloading of the CouchbaseTemplate and ReactiveCouchbaseTemplate constructors. I'll update it now.
As for the definition of beans couchbaseTemplate and reactiveCouchbaseTemplate, do you consider any change necessary? I didn't quite understand you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I was actually also talking about the bean definitions - because if someone overloads them in their actual configuration, just changing the signature on update will fail to compile for them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @daschl
It's true that is a breaking change, but I can't think of any other way to do it. Bean couchbaseTranslateService is being created but then not used.
If you don't want to be breakers, we could keep the overload on the CouchbaseTemplate and ReactiveCouchbaseTemplate constructors and at another time add the TranslationService parameter to the configuration beans and then be breakers.
What do you think?
Thank you very much
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jorgerod well, you could make the beans take the new parameter by default (as you do now), but add another 2 methods that look like the old signature and not be a Bean, which call into the new beans and just initialize the json translation service. Then if someone overrides it, their code would not break but everyone can then switch over to the new bean if needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand. Thank you very much for the help @daschl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this contains a breaking change as-is
@@ -145,14 +146,14 @@ protected void configureEnvironment(final ClusterEnvironment.Builder builder) { | |||
|
|||
@Bean(name = BeanNames.COUCHBASE_TEMPLATE) | |||
public CouchbaseTemplate couchbaseTemplate(CouchbaseClientFactory couchbaseClientFactory, | |||
MappingCouchbaseConverter mappingCouchbaseConverter) { | |||
return new CouchbaseTemplate(couchbaseClientFactory, mappingCouchbaseConverter); | |||
MappingCouchbaseConverter mappingCouchbaseConverter, TranslationService translationService) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The translationService argument should be named couchbaseTranslationService to match the bean name.
When the argument name does not match the bean name, the spring framework can only match by the type, and if there is ever another bean of type TranslationService added, the spring framework will not be able to automatically match this argument with the couchbaseTranslationService bean.
@jorgerod - Please put a period at the end of the first line of the commit message. (they are parsed programmatically) Thanks. DATACOUCH-652 - Inject translation service bean in CouchbaseTemplateSupport |
Hi @mikereiche I've checked the commit messages and they all have a period at the end of the line. |
Hello @daschl @mikereiche Have you been able to see the latest updates? Greetings |
@jorgerod - can you resolve the conflicts? Then I will merge this. |
@mikereiche Conflicts resolved. |
@jorgerod please squash your commits into a single one as we keep a single commit (and a linear history) per change. |
51ca98a
to
074b454
Compare
Hi @mp911de I have already squashes my commits. Does it look good? Thank you |
Hi @mikereiche How does it look? |
It will be in the next 4.1.x release scheduled for February 10. |
DATACOUCH-652
TranslationService is defined as bean but in CouchbaseTemplateSupport.
That bean is not being used and a new instance of JacksonTranslationSerivce is being created in the constructor.
We want CouchbaseTemplateSupport to receive a TranslationService type bean.