java 有哪些使用 Spring 和 Hibernate 的优秀示例应用程序?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/531096/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-29 12:46:12  来源:igfitidea点击:

What are some good sample applications using Spring and Hibernate?

javahibernatespringspring-security

提问by Peter Kelley

I need a quick jump start for using Spring and Hibernate together and I was looking for some sample code to modify and extend. Bonus points for Struts2 and Spring Security integration.

我需要快速开始使用 Spring 和 Hibernate,我正在寻找一些示例代码来修改和扩展。Struts2 和 Spring Security 集成的加分项。

采纳答案by Peter Kelley

There is a sample projectthat includes Spring, Hibernate and Struts2 available from the Struts2 website that appears to have most of what I want. It includes a basic JPA configuration but it does not provide DAO classes.

Struts2 网站上有一个包含 Spring、Hibernate 和 Struts2的示例项目,它似乎拥有我想要的大部分内容。它包括基本的 JPA 配置,但不提供 DAO 类。

The generic DAO pattern is documented on the Hibernate site here. This gives a good DAO foundation but the code is using Hibernate directly with no JPA or Spring.

通用DAO模式被记录在Hibernate的网站在这里。这提供了良好的 DAO 基础,但代码直接使用 Hibernate,没有 JPA 或 Spring。

The following post(warning:language) gives some information about using Spring with JPA and not the HibernateTemplate class.

下面的帖子警告:语言)提供了关于使用Spring使用JPA,而不是的HibernateTemplate类的一些信息。

Put together this information has me well on the way to my skeleton project.

把这些信息放在一起,让我顺利完成我的骨架项目。

回答by Adeel Ansari

The official docs is your best bet for both Springand Hibernate. However, you can look into When Spring Meets Hibernateand Spring and Hibernate with MyEclipsetutorial to get you started.

官方文档是SpringHibernate 的最佳选择。但是,您可以查看When Spring Meets HibernateSpring and Hibernate with MyEclipse教程来帮助您入门。

Your best bet, if you are using Netbeans or have no problems in using that, just start a brand new application and follow the web application wizard and specify Spring and Hibernateas application framework, and ORM respectively. It will generate a complete skeleton for you to work on. You can even add Struts2 as web framework later, in project->properties->framework.

您最好的选择是,如果您使用 Netbeans 或使用它没有问题,只需启动一个全新的应用程序并遵循Web 应用程序向导并分别指定 Spring 和 Hibernate作为应用程序框架和 ORM。它将生成一个完整的骨架供您处理。您甚至可以稍后在项目->属性->框架中添加 Struts2 作为 Web 框架。

You might want to look into Struts2 Spring Pluginfor the latter. Further, Spring Security Integration.

对于后者,您可能需要查看Struts2 Spring Plugin。此外,Spring 安全集成

回答by Satya

Have a look at AppFuse

看看AppFuse

It has lot of starter web-app material. You also have something with Struts2-Spring-Hibernate.

它有很多入门网络应用程序材料。您还可以使用 Struts2-Spring-Hibernate。

回答by nicordesigns

SpringSource itself have a good number of good sample applications available here:

SpringSource 本身有很多很好的示例应用程序可用:

https://src.springframework.org/svn/spring-samples/

https://src.springframework.org/svn/spring-samples/

The best one to get started with here is probably:

最好的入门方法可能是:

http://static.springsource.org/docs/petclinic.html

http://static.springsource.org/docs/petclinic.html

回答by Jakub Adamek

Spring Roo creates a Spring - Hibernate skeleton with JPA 2. You can continue using Roo or you can switch it off with not much manual work. It downloads the newest Hibernate and Spring versions and you can be sure they will work together.

Spring Roo 使用 JPA 2 创建了 Spring - Hibernate 框架。您可以继续使用 Roo,也可以关闭它,无需太多手动工作。它下载最新的 Hibernate 和 Spring 版本,您可以确定它们将一起工作。

Spring Roo gives you advice with the "hint" command and you can start really quickly. You can follow the tutorial at http://static.springsource.org/spring-roo/reference/html/beginning.htmland the first two steps are enough.

Spring Roo 通过“提示”命令为您提供建议,您可以快速开始。您可以按照http://static.springsource.org/spring-roo/reference/html/beginning.html 上的教程进行操作,前两个步骤就足够了。

But Roo will not help with Struts, it offers JSF instead.

但是 Roo 不会帮助 Struts,而是提供 JSF。