我使用ApplicationContext.getBean(String name,Class requiredType)方法。该bean是util:set类型的。我的代码如下所示:类型验证的Spring getBean
Set<String> mySet = context.getBean("myBean", Set.class);
我想知道的是如何做这样的事情,以避免类型转换警告:
Set<String> mySet = context.getBean("myBean", Set<String>.class);
我不知道,如果是可以定义的类型以这种方式上课。我在做梦还是有办法做到这一点?
谢谢。