Minimal sample application: https://github.com/fangzhengjin/spring-framework-issues-34386

Start the program and execute the request below.

Observe the input arguments to the com.example.demo.IQueryController#test method.

curl -X POST 'localhost:8080/test' -H 'Content-Type: application/json' -d '{"data":{"name":"test"}}'

This problem occurs when the generic names declared by IQueryController and ICrudController are inconsistent in the example project.

Expected behavior:

public interface IQueryController<Entity>

public interface ICrudController<Entity> extends IQueryController<Entity>

Unexpected behavior:

public interface IQueryController<QueryParam>

public interface ICrudController<Entity> extends IQueryController<Entity>

6.2.x

Image

Image

6.1.x

Image

Image

Comment From: jhoeller

This looks like a variant of the recently fixed #34328. Could you try the latest 6.2.3 snapshot (overriding the framework version as stated in the comments on #34217) and see whether your specific problem still remains?

Comment From: fangzhengjin

This looks like a variant of the recently fixed #34328. Could you try the latest 6.2.3 snapshot (overriding the framework version as stated in the comments on #34217) and see whether your specific problem still remains?

6.2.3 snapshot problem still remains.

Image

Comment From: jhoeller

Thanks for the immediate turnaround! I'll revisit what we do differently for mismatching type variable names then.

Comment From: fangzhengjin

This problem seems to be caused by this change e788aeb25baba51880b6c9cccbeb51fe5a6d401b

Comment From: jhoeller

@fangzhengjin this should be fixed in the latest 6.2.3 snapshot, please give it another try if you have the chance...

Comment From: fangzhengjin

@fangzhengjin this should be fixed in the latest 6.2.3 snapshot, please give it another try if you have the chance...

Sorry I'm late, he works fine in spring-framework 6.2.3 and spring-boot 3.4.3

Comment From: jhoeller

No worries, thanks for the feedback!

Comment From: nealeu

Just did my min reproducible app and found it fixed so I can confirm this scenario also fixed in 6.2.3


@SpringBootApplication
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

    @RestController
    public static class HelloController {
        /** Fails in Spring 6.2.2 with at <a href="http://localhost:8080/thing1">thing1</a> */
        @GetMapping("/{thing}")
        public <T> List<ThingConfig<T>> list(@PathVariable ConfigurableThing<T> thing) {
            return serviceMethod(thing.thingClass());
        }

        private <T> List<ThingConfig<T>> serviceMethod(Class<T> tClass) {
            return List.of( new ThingConfig<>(new ConfigurableThing<>(tClass)));
        }
    }

    @Component
    public static class String2ThingConverter implements Converter<String, ConfigurableThing<?>> {
        private final Map<String, ConfigurableThing<?>> thingsBySimpleClassName = Map.of("thing1", new ConfigurableThing<>(Object.class));

        @Override
        public ConfigurableThing<?> convert(@NonNull String source) {
            return thingsBySimpleClassName.get(source);
        }
    }

    public record ConfigurableThing<T>(Class<T> thingClass) {}
    public record ThingConfig<T>(ConfigurableThing<T> forThing) {}
}