This week's book giveaway is in the Spring forum. We're giving away four copies of Pro Spring MVC with WebFlux: Web Development in Spring Framework 5 and Spring Boot 2 and have Marten Deinum & Iuliana Cosmina on-line! See this thread for details.
It's not that it "does not support" it. Generics types are used at compile-time. I can't see the use of defining generic subclasses at runtime.
Try this :
The context file
The main class
Why does it work ? Because of type erasure. Generic types A and B both become Object types. There's no point in defining generics at runtime. So, yes, you can instanciate generic classes. But no, you cannot define generic types.
That is because .NET has a fundamentally different (IMO better) generics infrastructure, where information about the generic type signature is retained and can be used at runtime. Although this *can* be done in Java, it's hard. For example, the ApplicationListener interface in Spring 3 works with event publishers to use runtime type reflection about the generic signature of a class implementing ApplicationListener to determine which events it's interested in.
Author, Spring Security 3 (the Book), Packt Publishing, 2010