Showing posts with label Spring MVC. Show all posts
Showing posts with label Spring MVC. Show all posts

Friday, 18 July 2014

Spring JDBC connection with jdbcTemplate and JdbcDaoSupport


Hello! Today I want to make a couple of examples of database access using JDBC within Spring framework. In this article we'll see how DB's manipulations can be  simplified using jdbcTemplate and JdbcDaoSupport.

Cute image from me:
If we don't use jdbcTemplate we must again and again, in every method, repeat yourself writing duplicate code for opening and clothing connection to DB, etc.

Why? I really don't understand, this solution is opposite to the one of OOP design principle (DRY: Don't Repeat Yourself). If you use some code more then ones - then you must detach it to a separate method and invoke it every time you need in the future.

Spring developers offer us to avoid repeating yourself and use jdbcTemplate which can do all redundant work for us.

Let's see the differences!

Tuesday, 24 June 2014

Spring MVC Java-based Configuration without any XML

Hello! What is the reason to use Java based Spring configuration instead of familiar XML config? I can describe it simply with the next slide:


In my opinion XML is a legacy part of java application and  it is much better to use Java in Java app :) What do you think?
Today I want to make a  review of Java config in Spring 4 with all  benefits of using Annotation approach!