2016-08-24 81 views
0

我有类的定义如下:我如何修复错误“之类ApplicationListener不是通用的;它不能与参数<ContextRefresedEvents>进行参数化”?

public class StartEventListener implements ApplicationListener<ContextRefreshedEvent> 

,我得到的错误:

The type ApplicationListener is not generic; it cannot be parameterized with the arguments <ContextRefresedEvents> 

我已经尝试了所有我见过Ø解决这个问题,并有其他的方式没有任何人知道这个问题的解决办法吗?

+1

不是作为一个Java专家,但它不应该读 “imple_me_nts”? –

+0

通过使用正确的'ApplicationListener'从春天的一个,并使用一个版本的春天,有一个通用的'ApplicationListener'(这意味着一个版本的春季大那么3.0)它,你有一个旧版本,你会得到这个错误。如果您使用maven,请使用'mvn dependency:tree'来确定正在使用哪些版本(并解决该问题)。 –

+0

如何确保eclipse使用正确的应用程序侦听器? –

回答

4

使用

import org.springframework.context.ApplicationListener; 

你可能使用非通用ApplicationListener

+0

我有一个行代码及其仍然 –

+0

你使用Spring 3以上,其中'ApplicationListener'是通用的拍摄我同样的错误? – Reimeus

+0

是的,我正在运行弹簧4.1.9。 –

相关问题