spring q&&A

22) What are the important beans lifecycle methods?

There are two important bean lifecycle methods. The first one is setup which is called when the bean is loaded in to the container. The second method is the teardown method which is called when the bean is unloaded from the container.

25) What are the different types of bean injections?

There are two types of bean injections.

1. By setter
2. By constructor

27) What are different types of Autowire types?
A: http://static.springsource.org/spring/docs/2.5.6/reference/beans.html#beans-factory-autowire

48) Explain about PreparedStatementCreator?

PreparedStatementCreator is one of the most common used interfaces for writing data to database. The interface has one method createPreparedStatement().

PreparedStatement createPreparedStatement(Connection conn)
throws SQLException;

When this interface is implemented, we should create and return a PreparedStatement from the Connection argument, and the exception handling is automatically taken care of. When this interface is implemented, another interface SqlProvider is also implemented which has a method called getSql() which is used to provide sql strings to JdbcTemplate.