I was trying to make a case and research if it is worthwhile to use Spring as a middleware library for a system that uses Wicket for the view tier and just jdbc for 开发者_运维知识库the backend tier. It looks like spring is good for integrating with hibernate or ejbs but if we aren't using those, will I still see benefits?
I do see simple POJOs used as singletons in the code, maybe those could be replaced with the Spring libraries?
Yes there are many advantages 1) Spring encourages layered architecture with standard patterns eg: MVC,DAO,IOC ... 2) There are many facilities available which can reduce a lot of repetitive code 3) For eg you can use JDBC template.
The Spring JDBC Template has the following advantages compared with standard JDBC. The Spring JDBC template allows to clean-up the resources automatically, e.g. release the database connections. The Spring JDBC template converts the standard JDBC SQLExceptions into RuntimeExceptions. This allows the programmer to react more flexible to the errors. The Spring JDBC template converts also the vendor specific error messages into better understandable error messages.
For additional reading on jdbc-template checkout http://www.vogella.de/articles/SpringJDBC/article.html
Did I mention jboss-seam is also an option you may consider.
精彩评论