Skip to content

Duplicate ModelConverter registration with Spring Boot DevTools #2939

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

Closed
SamuelGuillemet opened this issue Mar 12, 2025 · 0 comments
Closed

Comments

@SamuelGuillemet
Copy link

SamuelGuillemet commented Mar 12, 2025

Hello,

I've recently encountered a new bug.

Issue Description:

Describe the bug
A newly created ModelConverter is being registered in duplicate when used with Spring Boot DevTools, due to the class loader being different.

To Reproduce
Steps to reproduce the behavior:

  1. Create a Spring Boot application and include Spring Boot DevTools.
  2. Add a new ModelConverter and annotate it with @Component
@Component
public final class OwnConverter implements ModelConverter {

    @Override
    public Schema resolve(AnnotatedType type, ModelConverterContext context, Iterator<ModelConverter> chain) {
        return (chain.hasNext()) ? chain.next().resolve(type, context, chain) : null;
    }
}

Expected behavior
The ModelConverter should be registered only once but every time the devtool restart the app, a new OwnConverter is added to the list of converters.

Additional context
I think the issue might comes from the following line where the comparaison is done through reference equality.
ModelConverterRegistrar.java#L102

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

No branches or pull requests

1 participant