java - Autowiring of generic types doesn't work [Spring 4+] -


i'm working on 1 project spring 4.2.4.release.

i've heard new features spring 4 (especially autowiring of generic types), , confused when following code hadn't been compiled:

@service public interface authenticationservice<t> { ... }  public class vkauthenticationservice implements authenticationservice<vktoken> { ... }  @restcontroller public class vkauthenticationcontroller {    @autowired    private authenticationservice<vktoken> service; } 

thank in advance assistance.

how declare @service on vkauthenticationservice

@service(name="myservice") public class vkauthenticationservice implements authenticationservice<vktoken> { ... } 

and use @autowired , @qualifier inject it

@restcontroller public class vkauthenticationcontroller {    @autowired    @qualifier("myservice")    private authenticationservice<vktoken> service; } 

Comments