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

spring 2.2.3.RELEASE, weird related to HttpMessageConverters #20235

Closed
seunghx opened this issue Feb 20, 2020 · 2 comments
Closed

spring 2.2.3.RELEASE, weird related to HttpMessageConverters #20235

seunghx opened this issue Feb 20, 2020 · 2 comments
Labels
status: invalid An issue that we don't feel is valid

Comments

@seunghx
Copy link

seunghx commented Feb 20, 2020

as far as i know, @EnableAutoConfiguration(@SpringBootApplication)
set default HttpMessageConverters for example,

ByteArrayHttpMessageConverter@285f38f6
StringHttpMessageConverter@479f2dc2(ISO-8859-1)
ResourceHttpMessageConverter@3ab6678b
ResourceRegionHttpMessageConverter@7a904f32
SourceHttpMessageConverter@2b59501e
AllEncompassingFormHttpMessageConverter@476e8796
MappingJackson2HttpMessageConverter@1aac188d
Jaxb2RootElementHttpMessageConverter@36fc05ff

but

my spring boot app's HttpMessageConverters is added two HttpMessageConverters by HttpMessageConvertersAutoConfiguration

so result is

ByteArrayHttpMessageConverter@285f38f6
StringHttpMessageConverter@4e1459ea 
StringHttpMessageConverter@479f2dc2 (ISO-8859-1)
ResourceHttpMessageConverter@3ab6678b (UTF-8)
ResourceRegionHttpMessageConverter@7a904f32
SourceHttpMessageConverter@2b59501e
AllEncompassingFormHttpMessageConverter@476e8796
MappingJackson2HttpMessageConverter@1aac188d
MappingJackson2HttpMessageConverter@4eed2acf
Jaxb2RootElementHttpMessageConverter@36fc05ff

in source code of HttpMessageConvertersAutoConfiguration,

StringHttpMessageConverterConfiguration#stringHttpMessageConverter()method annotated with @ConditionalOnMissingBean(with no value)

but StringHttpMessageConverter@479f2dc2(ISO-8859-1) aleady exists.. (oh.. this is not bean?)

and

MappingJackson2HttpMessageConverterConfiguration(imported by HttpMessageConvertersAutoConfiguration)#mappingJackson2HttpMessageConverter() method annotated with @ConditionalOnMissingBean(MappingJackson2HttpMessageConverter.class) (this is not bean too?)

i just know, this action(duplicated HttpMessageConverters) is intended by spring boot

and

if it is intended action, then it is important of HttpMessageConverters#getConverters() because of support pattern (ask canWrite() or canRead() then command write() or read() manner) in for loop..

if ISO-8859-1 StringHttpMessageConverter is preceding UTF-8 StringHttpMessageConverter, this is not what i want...

so i just know about this HttpMessageConverters order and why spring boot add these new HttpMessageConverters not removing existing HttpMessageConverters

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Feb 20, 2020
@seunghx
Copy link
Author

seunghx commented Feb 20, 2020

i realize that this is not bug,
in source code of HttpMessageConverters,
annotation say,
newly added HttpMessageConverter is precede just before defaullt and same type HttpMessageConverter so wierd action is impossible (of course, case by case so just for my case -> using UTF-8 not ISO-8859-1)

and i think.... boot do not remove original HttpMessageConverters is rightful..

@snicoll
Copy link
Member

snicoll commented Feb 20, 2020

@seunghx please review the documentation for more details. If you're not sure about something, feel free to chat with the community on Gitter or ask questions on StackOverflow.

@snicoll snicoll closed this as completed Feb 20, 2020
@snicoll snicoll added status: invalid An issue that we don't feel is valid and removed status: waiting-for-triage An issue we've not yet triaged labels Feb 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

3 participants