public interface TestService<Question> {
public String test();
}
@Service
public class TestServiceImpl implements TestService<Question> {
@Override
public String test() {
String abc = "abc";
return abc;
}
}
@Controller
@RequestMapping("/test")
public class TestController {
@Autowired
private TestService<Question> testService;
@RequestMapping
public String index(){
testService.test();
ResolvableType resolvableType2 = ResolvableType.forField(ReflectionUtils.findField(TestController.class, "testService"));
System.out.println(resolvableType2.getGeneric(0).resolve());
return "index";
}
}
还没有评论,来说两句吧...