使用Spring Bean作为作曲家

时间:2018-08-31 12:45:33

标签: spring zk zul

我有这样的祖尔:

<window id="modwin" sclass="modalWindowCitas"  title="Cita" apply="com.company.app.mvc.zul.m.diana.f1.ModalCitaController">

ModalCitaController 是我的作曲家。

当zul打开时,ZK创建了作曲家的新实例,但是我想在我的作曲家中应用一个Spring拦截器。

这就是为什么我需要使用Bean的原因,如果ZK创建新实例,则拦截器不起作用。

我想应用PerformanceMonitorInterceptor来仅在本地环境中测量执行时间

有什么办法吗? 像这样:

<window apply="{mySpringBean}">

2 个答案:

答案 0 :(得分:0)

答案 1 :(得分:0)

您可以使用ZK提供的变量解析器。当没有其他解析器找到表达式时,它将查找具有该名称的bean。

只需将其放入zk.xml

<listener>
    <listener-class>org.zkoss.zkplus.spring.DelegatingVariableResolver</listener-class>
</listener>

有关更多信息:https://www.zkoss.org/wiki/ZK_Spring_Essentials/Working_with_ZK_Spring/Working_with_ZK_Spring_Core/Using_Spring_Variable_Resolver