带有 MySQL 数据库的 Vaadin 应用程序 [英] Vaadin app with MySQL database

查看:61
本文介绍了带有 MySQL 数据库的 Vaadin 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在创建一个 Vaadin 应用程序,它应该从服务器上的 mysql 数据库中获取它的内容数据(例如,使用 Xampp 运行的服务器).问题是我对大多数信息来源给我的方向感到困惑.每个教程都有 spring 和 spring 引导代码,并且没有实际参考在 vaadin 中创建与数据库的连接.我阅读了很多关于这个问题的信息,但仍然是带有一些 vaadin UI 元素的 spring 后端.这是否意味着 Vaadin 应用程序使用 spring 组件来连接数据库并使用 vaadin UI 表单等更新、显示、编辑数据?我现在真的很困惑.那么如果后端仍然是在 spring 中创建的,那么在 Vaadin 或 spring/spring boot 中创建应用程序有什么区别?

I am currently creating a Vaadin app that is supposed to get it's content data from a mysql database on a server (e.g. server run with Xampp). The problem is I am confused with a direction that most information sources give me. Every single tutorial has spring and spring boot code and there is no actual reference to creating a connection with data base in vaadin. I read a lot about the matter but still all that comes up are spring backends with some vaadin UI elements. Does it mean that Vaadin app uses spring components for connection with data base and updating, showing, editing the data using vaadin UI forms etc? I'm really confused right now. So then what is the difference between creating app in Vaadin or spring/spring boot if the back-end is still created in spring no matter what?

推荐答案

Vaadin 不会就如何访问数据做出任何决定.如果您使用的是 spring-boot,则根据 他们的文档 将是一个很好的起点.

Vaadin does not take any decisions about how the data is accessed. If you are using spring-boot then creating data source according to their documentation would be a good place to start.

现在您可以创建实体和存储库.然后您可以在 Vaadin 应用程序中编辑和显示实体.有些人建议创建单独的类进行编辑和查看,而其他人不.

Now you are set to create entities and repositories. You can then edit and display entities in Vaadin application. Some recommend creating separate classes for editing and viewing while others don't.

例如,您拥有的每个 Vaadin 页面都可以注入存储库,用于加载实体,然后将其呈现给用户.

Each Vaadin page that you have could, for example, have injected repository which it uses to load entities that it will then present to the user.

这篇关于带有 MySQL 数据库的 Vaadin 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆