Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 我如何修复错误;ApplicationListener类型不是泛型;无法使用参数对其进行参数化<;contextrefresentvents>&引用;?_Java_Spring - Fatal编程技术网

Java 我如何修复错误;ApplicationListener类型不是泛型;无法使用参数对其进行参数化<;contextrefresentvents>&引用;?

Java 我如何修复错误;ApplicationListener类型不是泛型;无法使用参数对其进行参数化<;contextrefresentvents>&引用;?,java,spring,Java,Spring,我的类定义如下: public class StartEventListener implements ApplicationListener<ContextRefreshedEvent> 公共类StartEventListener实现ApplicationListener 我得到了一个错误: The type ApplicationListener is not generic; it cannot be parameterized with the arguments <

我的类定义如下:

public class StartEventListener implements ApplicationListener<ContextRefreshedEvent>
公共类StartEventListener实现ApplicationListener
我得到了一个错误:

The type ApplicationListener is not generic; it cannot be parameterized with the arguments <ContextRefresedEvents>
类型ApplicationListener不是泛型;无法使用参数对其进行参数化
我已经尝试了我见过的所有其他方法来解决这个问题,但都没有成功。有人知道这个问题的解决方法吗?

使用

import org.springframework.context.ApplicationListener;
您可能正在使用非通用的
应用程序侦听器

import org.springframework.context.ApplicationListener;

您可能正在使用非通用的
ApplicationListener

我在代码中有这一行,它仍然会向我射击相同的错误您是否在
ApplicationListener
为通用的位置使用Spring 3或更高版本?是的,我正在运行Spring 4.1.9。您的类路径上似乎有一个非通用的
ApplicationListener
类。如果你能找到它-重命名或删除它&进行一次干净的重建我应该在eclipse中查找哪一行来编辑它我的代码中有这一行,它仍然在向我射击同样的错误你是否使用Spring 3或更高版本,其中
ApplicationListener
是通用的?是的,我正在运行Spring 4.1.9。你似乎有一个非通用的版本
ApplicationListener
classpath上的类。如果您可以找到它-重命名或删除它并进行一次干净的重建我应该在eclipse中查找哪些内容来编辑它而不是作为java专家,但它不应该读为“imple_me nts”?使用正确的
ApplicationListener
来自spring的版本,并使用具有通用
ApplicationListener
(这意味着Spring的版本大于3.0)如果您使用的是较旧的版本,则会出现此错误。如果您使用maven,请使用
mvn dependency:tree
来确定正在使用哪些版本(并解决此问题)。我如何确保eclipse使用的是正确的应用程序侦听器?不是java专家,但它不应该阅读“imple\u me\nts”?使用spring中正确的
ApplicationListener
版本,并使用具有通用
ApplicationListener
的spring版本(这意味着spring版本大于3.0)如果您使用的是较旧的版本,则会出现此错误。如果您使用的是maven,请使用
mvn dependency:tree
来确定正在使用哪些版本(并修复此问题)。如何确保eclipse使用的是正确的应用程序侦听器?