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.
Share
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 myCLASSPATH, build, and keep adding JARs until all theClassNotFoundExceptionswent away. That would be the minimum set you’d need to use Spring JDBC on its own.