我有一个带有Vaadin的Spring项目,我想集成Vaadin4Spring EventBus框架:
https://github.com/peholmst/vaadin4spring/tree/master/spring-vaadin-eventbus
作者说:
请注意,事件总线API在0.0.5版本中发生了更改
但是,如果我在pom.xml中添加Maven依赖项:
...
<dependency>
<groupId>org.vaadin.spring</groupId>
<artifactId>spring-vaadin-eventbus</artifactId>
<version>LATEST</version>
</dependency>
...Maven下载0.0.4.RELEASE版本。我试图显式设置以下版本:
...
<dependency>
<groupId>org.vaadin.spring</groupId>
<artifactId>spring-vaadin-eventbus</artifactId>
<version>0.0.5</version>
</dependency>
...
...
<dependency>
<groupId>org.vaadin.spring</groupId>
<artifactId>spring-vaadin-eventbus</artifactId>
<version>0.0.5.RELEASE</version>
</dependency>
...
...
<dependency>
<groupId>org.vaadin.spring</groupId>
<artifactId>spring-vaadin-eventbus</artifactId>
<version>0.0.5-SNAPSHOT</version>
</dependency>
...我还尝试将整个Spring4Vaadin插件设置为依赖项:
<dependency>
<groupId>org.vaadin.spring</groupId>
<artifactId>spring-boot-vaadin</artifactId>
<version>LATEST</version>
</dependency>
...
<dependency>
<groupId>org.vaadin.spring</groupId>
<artifactId>spring-boot-vaadin</artifactId>
<version>0.0.5</version>
</dependency>
...
<dependency>
<groupId>org.vaadin.spring</groupId>
<artifactId>spring-boot-vaadin</artifactId>
<version>0.0.5-SNAPSHOT</version>
</dependency>
...
<dependency>
<groupId>org.vaadin.spring</groupId>
<artifactId>spring-boot-vaadin</artifactId>
<version>0.0.5.RELEASE</version>
</dependency>但两者都不起作用。
基本上我不能这样做:
@Autowired
EventBus.ApplicationEventBUs appEventBus;
@Autowired
EventBus.UIEventBus UIEventBus;
...因为,正如README.md on GitHub中所说的那样:
请注意,事件总线API在0.0.5版本中发生了更改。从现在开始,您必须通过使用特定的接口来声明要注入的事件总线(以前,一切都是EventBus,您使用了一个注释来指定要获取的总线)。这一变化的原因是
因此,在版本0.0.4.RELEASE ( Maven视为最新版本)中,没有定义内部接口ApplicationEventBus和UIEventBus。
那么,我如何才能使用真正的最新版本的这句话呢?
发布于 2016-12-29 11:47:49
我把答案放进了穹顶论坛,在这里也是这样:
Vaadin加载项有一个很好的事件总线实现。检查https://github.com/peholmst/vaadin4spring/tree/master/samples/eventbus-sample
我使用了一个启用了spring (而不是spring )的Vaadin应用程序来完成这个任务,但是如果没有Spring,它也可以工作--我猜,下面的步骤很简单: 1.添加以下依赖项
<dependency>
<groupId>org.vaadin.spring.addons</groupId>
<artifactId>vaadin-spring-addon-eventbus</artifactId>
<version>0.0.7.RELEASE</version>
</dependency>UiEventBus.publish(此,新RefreshMainViewEvent(此,“使用细节更新”));
@PostConstruct公共空afterPropertiesSet() { uiEventBus.subscribe(this,false);}
@EventBusListenerMethod (RefreshMainViewEvent事件){logger.debug(“接收到的{}",事件);//blah }
https://stackoverflow.com/questions/28786579
复制相似问题