Home / Interview / Spring :: General Questions

Interview :: Spring

11)

In which scenario, you will use singleton and prototype scope?

Singleton scope should be used with EJB stateless session bean and prototype scope with EJB stateful session bean.

12) What are the transaction management supports provided by spring?

Spring framework provides two type of transaction management supports:

  1. Programmatic Transaction Management: should be used for few transaction operations.
  2. Declarative Transaction Management: should be used for many transaction operations.
13) What are the advantages of JdbcTemplate in spring?

Less code: By using the JdbcTemplate class, you don't need to create connection,statement,start transaction,commit transaction and close connection to execute different queries. You can execute the query directly.

14) What are classes for spring JDBC API?
  1. JdbcTemplate
  2. SimpleJdbcTemplate
  3. NamedParameterJdbcTemplate
  4. SimpleJdbcInsert
  5. SimpleJdbcCall
15) How can you fetch records by spring JdbcTemplate?

You can fetch records from the database by the query method of JdbcTemplate. There are two interfaces to do this:

  1. ResultSetExtractor
  2. RowMapper
16) What is the advantage of NamedParameterJdbcTemplate?

NamedParameterJdbcTemplate class is used to pass value to the named parameter. A named parameter is better than ? (question mark of PreparedStatement).

It is better to remember.

17) What is the advantage of SimpleJdbcTemplate?

The SimpleJdbcTemplate supports the feature of var-args and autoboxing.

18) What is AOP?

AOP is an acronym for Aspect Oriented Programming. It is a methodology that divides the program logic into pieces or parts or concerns.

It increases the modularity and the key unit is Aspect.

19) What are the advantages of spring AOP?

AOP enables you to dynamically add or remove concern before or after the business logic. It is pluggable and easy to maintain.

20) What are the AOP terminology?

AOP terminologies or concepts are as follows:

  • JoinPoint
  • Advice
  • Pointcut
  • Aspect
  • Introduction
  • Target Object
  • Interceptor
  • AOP Proxy
  • Weaving