Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring-JDBC as standalone library

I have a small application that doesn't use Spring container. Now there's a need for this application to access a database, just several small queries, nothing complex. Although I can do this with pure JDBC I'd really like to utilize Spring-JDBC library. My concern is whether it can be easily used without bringing in too much Spring into the application. By "too much Spring" I mean having to create spring containers, excessive external library dependencies, etc. Please, advise.

like image 744
andrew.z Avatar asked Oct 27 '11 09:10

andrew.z


1 Answers

I think you have to have the Spring core JAR and its dependencies, but you're never required to use the bean factory if you don't want to. Sounds like all you want is the JdbcTemplate. If that's the case, I'd put the spring-jdbc JAR into my CLASSPATH, build, and keep adding JARs until all the ClassNotFoundExceptions went away. That would be the minimum set you'd need to use Spring JDBC on its own.

like image 153
duffymo Avatar answered Sep 30 '22 20:09

duffymo