This code将getBean()方法添加到我们正在使用的类中:
clazz.metaClass.getBean = { String name ->
return VaadinUtils.getBean(name)
}
clazz.metaClass.getBean = { Class type ->
return VaadinUtils.getBean(type)
}
当应用程序启动时,它可以正常工作,并且它几乎没有重新编译。重新编译完成like this:
def reloadedClass = application.classLoader.loadClass(vaadinGrailsClass.clazz.name)
经过几次重新编译后,它表示缺少getBean()方法并抛出异常(因此必须重新启动并重新部署正在开发的应用程序)。
Caused by MissingMethodException: No signature of method:
com.myapp.SaveIssueDetailListener.getBean() is applicable for argument types:
(java.lang.Class) values: [class agiletool.core.IssueService]
Possible solutions: getClass(), getForm(), getAt(java.lang.String)
->> 30 buttonClick in com.myapp.SaveIssueDetailListener$$ENRHmYFM
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
512 receiveEvent in com.vaadin.event.ListenerMethod
164 fireEvent . . . . . in com.vaadin.event.EventRouter
1219 fireEvent in com.vaadin.ui.AbstractComponent
550 fireClick . . . . . in com.vaadin.ui.Button
217 changeVariables in ''
1451 changeVariables . . in com.vaadin.terminal.gwt.server.AbstractCommunicationManager
1399 handleVariableBurst in ''
1318 handleVariables . . in ''
763 doHandleUidlRequest in ''
296 handleUidlRequest . in com.vaadin.terminal.gwt.server.CommunicationManager
501 service in com.vaadin.terminal.gwt.server.AbstractApplicationServlet
191 service . . . . . . in com.vaadin.terminal.gwt.server.GrailsAwareApplicationServlet
886 runTask in java.util.concurrent.ThreadPoolExecutor$Worker
908 run . . . . . . . . in ''
680 run in java.lang.Thread
这就是我们调用getBean()方法的方法:
public void buttonClick(ClickEvent event) {
UserService userService = getBean(UserService) //...
知道可能出现什么问题吗?
答案 0 :(得分:0)
仅在Vaadin 6的旧版本插件中出现此问题.Grails的Vaadin插件(适用于Vaadin 7)已经从头开始,并且此问题不存在。
可在相关JIRA issue中找到更多信息。
有关新Vaadin的更多详情,请访问http://vaadinongrails.com/