Reputation: 421
Can anyone please tell me, what is the best way to create a project using spring and hibernate. I have two choices : create dynamic web project and then inject spring jars OR create spring project using STS ?
Thanks in advance.
Upvotes: 0
Views: 923
Reputation: 281
BalusC, Spring STS is the easiest way. Since this has some inbuilt set up which makes spring configuration easy. You can check here http://www.javavni.com/spring---environment-set-up.html to check step by step process to create new spring project.
Upvotes: 0
Reputation: 3967
My advice for you would be to take a look at the Spring Getting Started Guide. Type 'data' in the search box and look through some of the guides that get suggested.
I didn't immediately see one that helps with Hybernate in particular. But since spring really 'abstracts' the specific mechanism you use to access and persist data, the guide for JPA or JDBC probably will help you on your way.
There is also a wizard included inside of STS that gives you direct access to these Guides and can import the contents of their sample code into your workspace as a project. You can open this wizard from the menu "New >> Import Getting Started Content".
PS: The answer given by Ejaz Ahmed may also help you. The 'start.spring.io' wizard and site let you get started with pom or build.gradle that has specific dependencies. Unfortunately that wizard mainly just sets up the dependencies for you. This is a big help, but it won't help you with actually writing the code that actually uses those dependencies.
Upvotes: 0
Reputation: 654
The better way is to create project from STS using available templates. If you are completely novice, you should use Spring Boot instead. Spring boot has starters for different DBs and you can use one of in-memory or file based DBs such as H2 or HSQL or Derby. To create a spring boot project goto http://start.spring.io/ and select the tools dependencies you want and then download the zip file of your project. Import this as mave/gradle project using eclipse or whatever IDE you use and run main method of your application class.
Upvotes: 1