This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

AnnouncementAnnouncement Module

Collapse

No announcement yet.

Appropriate to use Spring with a standalone java app?Page Title Module

Appropriate to use Spring with a standalone java app?

Aug 5th, 2005, 12:52 PM

Hi,

I'm implementing database functionality for a legacy java app that previously had none. I've been looking for a framework/app that will handle the repetitive low level JDBC stuff like creating connections, iterating through recordsets and populating objects with data from the database, etc.

I happened upon Spring and am curious if I can use it in this manner, or is it more geared towards web type apps, running wihin the context of an application server?

Would Spring be a good candidate for my needs? My database schema is not very large or complex at all, not more than a few dozen tables, with proper referential integrity, and not many primary/foreign key relationships. All I'm looking to do within the java app is basic CRUD operations on the databse. Nothing too fancy.

Would another solution work better for a standalone app? I've also been looking at Hibernate, Ibatis SQL Maps, and Cayenne. My #1 requirement at this point is simplicity since I don't have much time to invest in learning a massively complicated framework with many features that I won't need or understand.

Applicability?: Spring is very applicable. I'm using it in that manner. Also used it to create an embedded custom DB.
Simple?: I think its simple to some extent for that purpose.
CRUD?: Its JDBC abstraction layer does help and does get rid of all that jdbc noise without one having to code a custom abstraction class. And, when needed it also supports ORM.
complex?: As complex as one wants to make it. Spring is only dependent on one external jar, but then grows from there based on what you want to do. The claim is that Spring's abstraction framework makes using other stuff simpler.

Comment

Why not?
Hibernate integration is very cool, and Spring's IoC provides easy configurations, but many depends on your application. If your existing application is well tired, and supplied with unit tests, you'll have no problem in applying Spring's DAO with Hibernate. You just need to create data objects (POJO), annotate it (JDK 1.5) or make xml-mappings, also you'll probably need some unified DAO for accessing your data.