在应用程序之间的Maven模块中共享模型类 [英] Sharing model classes in a maven module between apps

查看:123
本文介绍了在应用程序之间的Maven模块中共享模型类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含Hibernate注释的模型类的webapp,它定义了数据库属性(例如@Column,@Entity等)。我创建了一个写入同一数据库的新应用程序。



将所有模型类放入一个maven模块以便在应用程序之间共享是个好主意吗?

解决方案

这是您的案例中的正确方法。它既可缩放又可重用。如果这是您正在开发的MVC类型的应用程序,则模型充其量应该保持独立和共享能够跨模块。


I have a webapp with model classes containing Hibernate annotation which defines the database properties (e.g. @Column, @Entity, etc). I'm creating a new app that writes to the same database.

Is it a good idea to put all the model classes into a maven module to be shared between apps?

解决方案

That is the correct approach in your case. Its both scale able and reusable. Maven dependencies can be used across apps and support versioning as well.

If this is a MVC type of app you are developing, the models at best should be kept separate and share able across modules.

这篇关于在应用程序之间的Maven模块中共享模型类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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