com.vaadin.application 怎么了?
What happened to com.vaadin.application?
目前我需要构建一个非常古老的项目。经过几个令人沮丧的小时后,我决定将 pom.xml 更新为最先进的。当然,我在这样做的同时更改了 vaadin 版本。我已经将它从 6.8.12 提升到 7.6.7。
不足为奇,我现在有很多 "cannot be resolved to a type" 错误。其中之一是 "Application cannot be resolved to a type." 导入来自 "com.vaadin.application"。我从未听说过这个 class 并且几乎找不到任何信息。怎么了?
虽然大多数 API 保持兼容,但两个版本之间有很多变化,Application
本身已被 com.vaadin.ui.UI
取代。下面摘自官方migrating from Vaadin 6 to 7 guide:
The first code change that applies to every Vaadin 6 application
concerns the com.vaadin.Application class - it exists no more. The
main entry point to your application is now a com.vaadin.ui.UI, which
replaces Application and its main window. When switching to UI, you
also get multi-window support out of the box, so bye bye to any old
hacks to make it work. On the flip side, a new UI is created on page
reload. If you prefer to keep the UI state over page reloads in the
same way Vaadin 6 does, just add @PreserveOnRefresh annotation on your
UI class.
目前我需要构建一个非常古老的项目。经过几个令人沮丧的小时后,我决定将 pom.xml 更新为最先进的。当然,我在这样做的同时更改了 vaadin 版本。我已经将它从 6.8.12 提升到 7.6.7。
不足为奇,我现在有很多 "cannot be resolved to a type" 错误。其中之一是 "Application cannot be resolved to a type." 导入来自 "com.vaadin.application"。我从未听说过这个 class 并且几乎找不到任何信息。怎么了?
虽然大多数 API 保持兼容,但两个版本之间有很多变化,Application
本身已被 com.vaadin.ui.UI
取代。下面摘自官方migrating from Vaadin 6 to 7 guide:
The first code change that applies to every Vaadin 6 application concerns the com.vaadin.Application class - it exists no more. The main entry point to your application is now a com.vaadin.ui.UI, which replaces Application and its main window. When switching to UI, you also get multi-window support out of the box, so bye bye to any old hacks to make it work. On the flip side, a new UI is created on page reload. If you prefer to keep the UI state over page reloads in the same way Vaadin 6 does, just add @PreserveOnRefresh annotation on your UI class.