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

Update RepositoryRestMvcConfiguration so that the bean factory knows that Jackson converter beans are type constrained [DATAREST-538] #914

Closed
spring-projects-issues opened this issue May 11, 2015 · 1 comment

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented May 11, 2015

Andy Wilkinson opened DATAREST-538 and commented

In Spring Boot, we'd like to be able to be able to auto-configure a general-purpose MappingJackson2HttpMessageConverter even when there are one or more TypeConstrainedMappingJackson2HttpMessageConverter beans in the context. To do so we plan to enhance @ConditionalOnMissingBean so that it can be configured to ignore beans of certain types, for example:

@Bean
@ConditionalOnMissingBean(value = MappingJackson2HttpMessageConverter.class, ignoredType = "org.springframework.hateoas.mvc.TypeConstrainedMappingJackson2HttpMessageConverter")
public MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter() {
    // …
    return converter;
}

This only works if the beans that we want to ignore are exposed to the bean factory as being TypeConstrainedMappingJackson2HttpMessageConverter instances. This isn't the case with RepositoryRestMvcConfiguration as both halJacksonHttpMessageConverter and jacksonHttpMessageConverter are exposed as MappingJackson2HttpMessageConverter instances.

I'd like RepositoryRestMvcConfiguration to provide more type information to the bean factory by exposed both Jackson converter beans as TypeConstrainedMappingJackson2HttpMessageConverter. Ideally, this change would be made in Evans and later, allowing us to offer a fix in Spring Boot 1.2.x and later.

A pull request is on its way


Affects: 2.2.2 (Evans SR2)

Reference URL: spring-projects/spring-boot#2914

Referenced from: pull request #174

Backported to: 2.3.1 (Fowler SR1), 2.2.3 (Evans SR3), 2.1.6 (Dijkstra SR6)

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented May 14, 2015

Oliver Drotbohm commented

That's merged and ported back into maintenance branches for Fowler and Evans

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants