1

Possible Duplicate:
spring MVC sample web app

I'm looking for a sample application that shows how to get Spring Data (using JPA & Hibernate), along with Spring MVC. I always find figuring out how to start off my Spring apps the hardest part. Does anyone know if one exists?

FWIW I had a look on Appfuse but couldn't see anything, and also the sample apps that come with Spring but nothing quite matched. The closest I've got is to create a blank MVC app from the Spring Templates in STS, and then add the Spring Data / Hibernate dependencies using Maven, but I'm never quite sure whether I'm using the best combination of libs with Maven. I just want a sample app that shows the best practices so I can build a similar one myself from scratch (and therefore figure out how they all fit together rather than spending a week jumping around the Spring docs :)

Many thanks

Community
  • 1
  • 1
Richard
  • 1,731
  • 2
  • 23
  • 54
  • 1
    Is Scala OK? https://github.com/nurkiewicz/spring-pitfalls – Tomasz Nurkiewicz Jan 10 '12 at 21:18
  • Have to admit I'm not familiar with Scala, but looking at the Maven pom file in there it seems like it's got the things I'm looking for. I'll take a look, thanks – Richard Jan 10 '12 at 21:39
  • 1
    This looks great thanks, however I think at the moment I'm really looking for something written in Java. If anyone else can point me in the right direction I would be grateful. Scala does look pretty cool though, much less code to worry about :-) – Richard Jan 10 '12 at 22:08

1 Answers1

1

Try Spring Roo. Generate a few domain classes and then once you have a working app, you can (optionally) remove the Roo-specific files to leave a pure Spring MVC app. Its been a while since I've used it but I think they use JPA & Hibernate by default (if not then there is an option for it I think).

I've used this route for the use case you've outlined. It a nice way of seeing what the SpringSource folks think is the preferred way of doing things (convension), when there are multiple possibilities in configuring a Spring MVC app.

nickdos
  • 8,348
  • 5
  • 30
  • 47
  • Hey, thanks. Ive used Roo ages ago and liked it but didnt think of using it for this particular situation. Will try it and report back – Richard Jan 11 '12 at 00:34
  • Yeah, Roo seems great actually. Really nice way to get an app up and running (in seconds). I'm using it in STS. Thanks for the tip :) – Richard Jan 11 '12 at 21:16