我使用 vaadin 和 flow 开发 web 应用程序已经有一段时间了(与 Spring Boot 一起),并且偶然发现了 hilla,一个新的 vaadin“插件”或项目...(www.hilla.dev)。
我知道 flow 和 vaadin 使用 typescript 来做一些事情,但我从来不需要深入研究我的 java 后端和生成的 html/js/css 之间的这个元层......
所以我问自己,hilla 有什么用处让我的生活变得更轻松?或者,hilla 是否更适合从 javascript 和 typescript 转向 vaadin 的人,而不是相反?
我当前的Vaadin 8项目遇到的问题是,我有一个 java 入口类,它使用一些静态和动态上下文启动Tomcat的 2 个实例。
在Vaadin 8中,我曾经在 Eclipse 上静态链接所有库,因此之前我没有使用 pom.xml 文件,但为了更新当前工作流程,我在 pom.xml 文件上定义了所有这些库。现在我正在使用 pom.xml 文件,我意识到整个前端是通过vaadin-maven-plugin启动的,我真的不知道如何使用嵌入式Tomcat服务器来工作前端( Fusion 和 Flow ) ,但是没有SpringBoot。
我认为 vaadin 团队希望社区越来越多地使用SpringBoot 。
那么如何集成Vaadin 20(Fusion 和 Flow)+ 嵌入式Tomcat服务器但没有SpringBoot呢?或者您是否建议也迁移到SpringBoot?我看到了Vaadin 20 Fusion部分所需的许多注释,并且仅适用于SpringBoot。
尝试在 hilla(vaadin) 中创建一个应用程序,它将列出产品及其详细信息。为了对产品进行分类,需要存储与类别相关的信息,但在尝试在 hilla/vaadin 网格中列出类别时面临的问题。从端点返回类别列表,并在商店中消耗该列表并尝试在网格中显示。尝试运行应用程序时出现错误“
Type 'Promise<void>' is missing the following properties from type
Run Code Online (Sandbox Code Playgroud)
”
@Nonnull 是在列表的响应中指定的,并且在方法中仍然出现错误
下面是端点类
@Endpoint
@AnonymousAllowed
public class ProductEndpoint {
private InterProductService productService;
@Autowired
public ProductEndpoint(InterProductService productService) {
this.productService = productService;
}
public List<ProductDataList> fetchAllProducts() {
return this.productService.fetchProducts("");
}
public @Nonnull List<@Nonnull ProductCategoryDataList> fetchAllProdCategory() {
return this.productService.fetchProductCategory("");
}
@Nonnull
public EndpointResponse saveCatgeory(@Nonnull CategoryDetails categoryDetails) {
return this.productService.saveCategory(categoryDetails);
}
}
Run Code Online (Sandbox Code Playgroud)
下面是商店
export class ProductStore {
constructor() {
makeAutoObservable(
this);
this.fetchProductCatgeory();
}
async saveProductCategory(prodCategory: CategoryDetails) {
const responseData …Run Code Online (Sandbox Code Playgroud)