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

Exposing ObjectMapper disables Spring Boot JacksonAutoConfiguration #1209

Closed
tchlyah opened this issue Sep 1, 2021 · 5 comments · Fixed by #1240
Closed

Exposing ObjectMapper disables Spring Boot JacksonAutoConfiguration #1209

tchlyah opened this issue Sep 1, 2021 · 5 comments · Fixed by #1240
Labels
status: waiting-for-triage An issue we've not yet triaged

Comments

@tchlyah
Copy link
Contributor

tchlyah commented Sep 1, 2021

Exposing ObjectMapper used by JsonSerializer implemented here: #1132, disables Spring Boot JacksonAutoConfiguration#jacksonObjectMapper(), since it is annotated with @ConditionalOnMissingBean.

It forces usage of Couchbase ObjectMapper Bean which disables Spring Boot Jackson customizations (properties, modules, ...).

@mikereiche
Copy link
Collaborator

seems that removing the @bean from couchbaseObjectMapper() would fix this.

@tchlyah
Copy link
Contributor Author

tchlyah commented Sep 2, 2021

Yes, is there any particular reason why we needed @Bean ?

@mikereiche
Copy link
Collaborator

The @bean is to expose the objectMapper. Is there some other way to do that? I suppose a user could override the couchbaseObjectMapper() in their Config class as follows, but this looks really ugly.

static ObjectMapper theObjectMapper;

@OverRide ObjectMapper couchbaseObjectMapper(){
theObjectMapper = super.couchbaseObjectMapper();
return theObjectMapper;
}

which disables Spring Boot Jackson customizations (properties, modules, ...)

The purpose of exposing the ObjectMapper was to allow it to be customized.

@martin8877
Copy link

Overriding couchbaseObjectMapper() is definitely better than exposing bean. The couchbaseObjectMapper() is only called once right? There is no need to use static property.

@mikereiche
Copy link
Collaborator

Right. Not sure what I was thinking.

@OverRide ObjectMapper couchbaseObjectMapper(){
theObjectMapper = super.couchbaseObjectMapper();
theObjectMapper... // customizations
return theObjectMapper;
}

mikereiche added a commit that referenced this issue Sep 23, 2021
mikereiche added a commit that referenced this issue Sep 23, 2021
@mikereiche mikereiche added this to the 4.3 RC1 (2021.1.0) milestone Sep 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants