Spring Study Notes - Copyright © 2010 Gavin Lasnitzki Index   Notes   Objectives
Exam Objectives

Spring 2.5 Exam Objectives

Detailed objectives from Spring Certification page on BlackBeltFactory which was compiled by Fritz Duchardt using the "Spring Core Bootcamp" slides.

1. Spring Basics

1.1 Goals of the Spring Framework

  • Understand how Spring deals with the "plumbing" to allow the programmer to focus on the domain problems.
  • Know that Spring's core functionalies are: application configuration, enterprise integration, testing and data access (?))
  • Demonstrate understanding of the benefits of dependency injection
  • Demonstrate understanding of the benefits of AOP

1.2 Spring's role in enterprise application architecture

  • Know the way Spring integrates into enterprise applications
  • Be familiar with how Spring covers key requirements of enterprise applications, i.e. Database Connection Pooling, Database Transaction handling, Security, Messaging, Remote Access, Caching.

1.3 Web application development support

  • Be familiar with the way in which Spring supports web application development

1.4 Writing bean definitions

  • Demonstrate knowledge of the attributes and sub-tags of the bean tag
  • Choose between getter and setter injection
  • Be familiar with Spring's type conversion
  • Demonstrate knowledge of how the container's support for collections and maps
  • Demonstrate knowledge of factory methods and Factory Beans
  • Be familiar with Spring's supporting namespaces, e.g. context, util

1.5 Bean definition inheritance

  • Demonstrate proper understanding of the "parent" attribute and its uses.
  • Explain when to use the "abstract" attribute

1.6 Property Editors

  • Demonstrate understanding of Springs out-of-the-box PropertyEditors, i.e. NumberEditor, BooleanEditor, DateEditor etc
  • Explain how to write a custom PropertyEditor and how to install it.

1.7 Bean Naming

  • Explain the naming rules for bean names and ids.

1.8 Importing configuration files

  • Know how to split your bean configuration files up into several files
  • Explain what to consider when splitting the bean configuration up

1.9 The util namespace

  • Explain the uses of the util namespace, e.g. util:constant, util:property-path, util:properties, util:list, util:map

1.10 The Application Context

  • Creating an application context
    • Know how to configure web.xml to bootstrap Spring with the ContextLoaderListener.
    • Show how to instantiate an ApplicationContext loading the bean definitions file from the classpath, from the file system or from an environment relative resource path.
    • Demonstrate how to use the Spring resource loading prefixes ("classpath:", "file:", "http:") to control where to load the bean definition file from.
  • The life-cycle of an application context
    • Describe what happens during the three life-cycle phases of the Spring container: the initialization phase, the use phase, the destruction phase: the initialisation phase, the use phase and the description phase.
  • Bean scoping
    • Know that the default scope of the application context is singleton
    • Explain how prototype scope works
    • Explain how to configure session and request scoped beans
    • Demonstrate understanding how how to write a custom scope

1.11 Testing

  • Test driven development
    • Explain why good test coverage is important in respect to refactoring, agile programming and continuous integration.
  • Unit testing vs. Integration testing
    • Demonstrate understanding of the difference between unit- and integration-testing
  • Unit testing with stubs
    • Demonstrate understanding of the pros and contras of Stubs
  • Unit testing with mocks
    • Demonstrate understanding of the pros and contras of Mocks
  • Integration testing with Spring
    • Explain how to write make the application context available to Junit Tests
    • Demonstrate knowledge of Springs annotation support for Junit Tests, e.g. @RunWith, @ContextConfiguration, @Test
    • Explain the benefits of Spring's integration testing in regards reuse of code between test and production environment as well as the necessary to deploy the tests to an external containers in order to test application functionality.

1.12 Annotation-based Dependency injection

  • Configuration annotations
    • Know how to enable annotations with <context:annotation-config/>
    • Explain how @Required can be used to indicate that a bean property must be bound
    • Demonstrate knowledge of the use of @Autowired, e.g.
      • That it can be applied to methods, constructors
      • That it can be applied to arrays, collections and maps
      • That it can be used to bind well-known "resolvable dependencies", i.e. the BeanFactory, the ApplicationContext, the ResourceLoader, the ApplicationEventPublisher and the MessageSource
    • Show how @Qualifier and the <qualifier> tag can be used to narrow down the autowiring scopes.
    • Explain how to extend the Qualifier mechanism with custom annotations placing @Qualifier in the annotation definition and using the CustomAutowireConfigurer.
    • Demonstrate knowledge of the @Resource annotation
    • Demonstrate knowledge of the @Component annotation, how to make the container scan for it and how to use it in conjunction with the @Scope annotation.
    • Show how to use the @PostConstruct and @PreDestroy tags to call initialization and destruction methods
  • When use what
    • Explain when better to use annotations and when xml configuration is preferable
  • Annotations for testing and Junit support
    • Show knowledge of how to create JUnit tests for JUnit4 with the @Test annotations
    • Explain what the @ContextConfiguration annotation does.
    • Know how to make test methods transactional with the @Transactional annotation

2. AOP

2.1 What Problem Does AOP Solve?

  • Explain the benefits of AOP in regards to modularizing cross-cutting concerns, i.e. logging, security, caching, error handling

2.2 Core AOP Concepts

  • Be able to define the core AOP Concepts: Join point, Advice, Pointcut, Aspect, Introduction, Target object, AOP proxy, Weaving
  • Show understanding of the different advice types and when to use them: Before advice, after returning advice, after throwing advice, after finally advice, around advice.

2.3 Defining Pointcuts, implementing advice

  • AspectJ
    • Understand how to enable AspectJ in the bean configuration file with <aop:aspectj-autoproxy/>
    • Be familiar with the @Aspect annotation to declare an Aspect
    • Be familiar with the @PointCut annotation and its designators (execution, within, this, target etc) to declare a Pointcut. Pointcuts consist of the pointcut expression and the pointcut method signature.
    • The pointcut expression supports the following designators: execution, within, this, target, args, @target, @within, @annotation
    • Know how to include annotations in the pointcut expression, e.g. execution( @org.tracked.Tracked void +()
    • Know that pointcut expressions can be combined with the operators &&, || and !
    • Demonstrate knowledge of how to declare advice with the annotations @Before, @AfterReturning, @AfterThrowing, @After, @Around.
    • Know how to declare parameters in the advice signature in order to pass them to the advice
    • Know how to use the target attribute in order to pass the target object to the advice
    • Know ho the order in which advice is executed can be controlled.
  • Spring AOP
    • Demonstrate knowledge of how to declare pointcuts inside <aop:config> with the <aop:pointcut> tag
    • Know how to declare before advice with <aop:before>, <aop:after-returning>, <aop:after-throwing> and <aop:around>
    • Be able to explain the pros and contras of using either AspectJ or Spring AOP.

3. Spring Data Access and JDBC Support

3.1 The role of Spring in enterprise data access

  • Show understanding of the general benefits of Spring in enterprise data access, i.e. comprehensive data access support, layered application architecture.

3.2 Spring resource management

  • Demonstrate knowledge of declarative transaction management via Spring Transaction Manager, automatic connection management and intelligent exception handling

3.3 Spring data access support

  • Demonstrate knowledge of Spring's libraries to simplify data access code
  • Know that Spring provides a factory for configuration, a base support class to implement DAO and a helper class to use the API effectively for each major data access technology, i.e. JDBC, Hibernate, JPA, JDO, Toplink, iBatis

3.4 Data access in a layered architecture

  • Understand the importance of encapsulating the complexity of data access which entails
  • encapsulating the use of data access API (Hibernate, JDBC)
  • hiding the details of data access statement (SQL, HQL)
  • mapping of data into suitable forms for business logic

3.5 Common data access configurations

  • Understand declarative Transaction Management with annotations by placing @Transactional over the transactional method.
  • Be aware that the Transaction Manager can be configured in bean configuration file without affecting the implementation
  • Be aware that PlatformTransactionManager is the base interface for several implementations provided by Spring: DataSourceTransactionManager, HibernateTransactionManager, JtaTransactionManager etc
  • Know how to define a TransactionManager in the bean configuration file, i.e. <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"><property name="dataSource" ref="dataSource"/></bean>
  • Be aware that transactional behaviour can be configured via AOP in the bean configuration file with the <tx:advice> tag.
  • Be aware that Spring provides programmatic transaction management with the TransactionTemplate
  • Understand that connections Management is also handled by Spring and configurable via the bean configuration file

3.6 Spring's JdbcTemplate

  • Demonstrate knowledge of the services provided by Spring's JdbcTemplate, e.g.: acquiring of connection, participation in transaction, execution of statements, processing of resultset, handling of exception, release of connections.
  • Create a template once and reuse it. Its threadsafe.
  • Configuration of the JdbcTemplate
    • Know how to set up a JdbcTemplate in the bean configuration file.
  • Query execution with the JdbcTemplate
    • Be familiar with how to execute queries of JdbcTemplate, i.e. the methods queryForInt, queryForMap, queryForList, queryForObject, update
    • Demonstrate knowledge of when the RowCallbackHandler and ResultSetExtractor interfaces come into play.
  • Data Access Exception handling
    • Be familiar with the benefits that the JdbcTemplate brings with by translating all generic SQLException to root cause DataAccessExceptions, i.e. consistency across vendors, selective exception handling by type, freedom from catch and wrap approach, exceptions are always propagated if not caught.

3.7 ORM Fundamentals

  • Be aware of the mismatches between the structures of Java Objects and rational databases, i.e.
  • In java there is a difference between object identity and object equivalence, in a database there is solely a primary key
  • In a object-oriented language IS-A relationships are implemented with inheritance, HAS-A relationships are modeled with composition. In a database schema, relations are limited to what can be expressed with foreign keys.

3.8 Benefits of O/R Mapping

  • Be familiar with the benefits of O/R Mapping, i.e. the use of object query Languages, automatic change detection, persistence by reachability, caching.

3.9 Hibernate General

  • Be familiar with the annotations supported by Hibernate: java.persistence.+, native Hibernate annotations.
  • Be familiar with how to configure Hibernate 3.1+ in the bean configuration file in order to handle exception in a transparent fashion with AOP. Configuring a Hibernate SessionFactory
  • Be familiar with the role of Hibernate's SessionFactory, e.g. it is a threadsafe shareable object that represents a single datasource. It provides access to transactional Sessions, which are. Hibernate implementation of data access code require access to a SessionFactory ** Demonstrate knowledge of how to set up a Session Factory in the bean configuration file. Be aware that the SessionFactory requires a Data Source and the mapping metadata.
  • Be aware that Spring provides a BeanFactory for configuring a sharable SessionFactory

3.10 Spring's HibernateTemplate

  • General
    • Be familiar with the services provided by the HibernateTemplate, e.g. acquiring/releasing Sessions, translating Exceptions to the DataAccessException hierarchy
    • Be aware that the HibernateTemplate participate in Spring managed transactions automatically
  • Implementing Native Hibernate DAOs
    • Be aware that using Spring's FactoryBean to build the Hibernate Session Factory activates participation in Spring-driven transactions
    • Be familiar with how to provide the Session Factory to the data access code via Dependency Injection
    • Demonstrate knowledge of how to define a Transaction Manager, e.g. HibernateTransactionManager, JTA TransactionManager in the bean configuration file.
    • Know how to use AOP and the @Reository annotation in order to activate the translation of Exceptions into Spring's Vendor neutral DataAccessException hierarchy

4. Transaction Management

4.1 Why use Transactions?

  • Be familiar with the ACID principle: Atomicity, Consistency, Integrity, Durability
  • Be familiar of the risks that are run by not using transactions: partial failure, dirty reads, lost updates

4.2 Local Transaction Management

  • Be familiar with the drawbacks of programmatic management of transactional behavior
  • Be able to explain that transaction demarcation belongs at service level, because multiple data access methods may be called within a transaction and connections must be managed at a higher level.

4.3 Programmatic JTA

  • Be familiar with the advantages of implementing transactions management programmatically with JTA, e.g. transactions may be handled from the service layer, global transactions are possible.
  • Be familiar with the disadvantages of implementing transaction management programmatically with JTA, e.g. JTA depends on an application server environment, the implementation is error-prone because explicit transaction commit or rollback, as well as proper exception handling has to be taken care of manually.

4.4 Declarative Transactions

  • Know that EJBs support declarative transaction via the deployment descriptor

4.5 Spring Transaction Management

  • Be familiar with Spring's abstraction layer for transaction management
  • Be aware of the benefits that result from JTA being an option, but not a requirement and the fact that differences between JTA and local transactions are completely hidden. The benefits are the additional deployment flexibility, the easier migration to distributed transactions and the possibility to avoid overhead of JTA when possible.

4.6 Transaction Propagation

  • Know that methods if configured with the setting "REQUIRED" execute within current transaction or create a new one if none exists
  • Know that methods if configured with the setting "REQUIRED_NEW" create a new transaction and suspend the current one, if one exists.

5. Spring with JNDI and JMS

5.1 Configuring JMS Resources with Spring

  • Be aware that Spring decouples of your application code from underlying infrastructure
  • Know how to configuring a ConnectionFactory in the bean configuration file, standalone as well as with JNDI.
  • Know how to configure a Message Destinations in the bean configuration file, standalone as well as with JNDI.

5.2 Sending Messages

  • Be familiar with the utilization of the JmsTemplate. This entails:
    • Be aware that JmsTemplate delegates to MessageConverter to convert objects to messages, i.e. String to TextMessage, Serializable to ObjectMessage, Map to MapMessage, byte to ByteMessage
    • Be aware that JmsTemplate delegates to DestinationResolver to resolve destination at runtime
    • Be familiar with the methods for sending messages: convertAndSend(Object message), convertAndSend(Destination destination, Object message), convertAndSend(String destinationName, Object message)
    • Be familiar with using callbacks

5.3 Receiving Messages

  • Be familiar with the usage of JmsTempaltes methods for synchronous message reception: receive(), receive(Destination destination), receive(String destination), receiveAndConvert(someDestination)
  • Demonstrate knowledge how to implement asynchronous message reception with the MessageListener interface.
  • Be aware that Spring provides lightweight alternative to EJB Container with SimpleMessageListenerContainer and DefaultMessageListenerContainer
  • Know how to define a plain JMS Message Listener in the bean configuration file.

6. Spring JMX

6.1 JMX Architecture

  • Have an understanding that an MBean is a standard Java bean with an additional management interface
  • Be aware that an MBeanServer acts as broker for communication between multiple local MBeans and a remote clients and MBeans
  • Be aware that an MBeanServer maintains a keyed reference to all MBeans registered with it
  • Know that external communication with an MBeanServer is accomplished using a JSR-160 connector
  • Be aware that the only required protocol by the spec is RMI, but Spring also supports SOAP, Hessian and IPC.

6.2 Goals of Spring JMX

  • Be aware that Spring's objective is to expose existing Spring beans as MBeans transparently without changing the code, merely by using the Spring bean configuration file
  • Be aware that Spring aims to make it possible that the JMX infrastructure can be configured declaratively with a FactoryBean in the bean configuration file
  • Be aware that Spring aims to consume JMX managed beans transparently using a proxy based mechanism

6.3 Spring JMX (server)

  • Know how to create an MBeanServer declaratively use the MBeanServerFactoryBean
  • Know how to use Spring's MBeanExporter to transparently expose an existing POJO to the MBeanServer.

6.4 Spring JMX (client)

  • Understand that if the default strategies for creating the management interface and setting the ObjectName are not sufficient, the MBeanExporter allows alternative strategies to be injected:
    • ObjectNamingStrategy: KeyNamingStrategy (default), IdentityNamingStrategy, MetadataNamingStrategy
    • MBeanInfoAssembler: SimpleReflectiveMBeanInfoAssembler (default), MethodNameBasedMBeanInfoAssembler, InterfaceBasedMBeanInfoAssembler, MetadataMBeanInfoAssembler

7. Spring WebServices

7.1 Why use or build a web service?

  • Understand that webservices enable loose coupling
  • Understand that webservices increase interoperability: XML is lingua franca - understood by all major platforms

7.2 Best practices for implementing a web service

  • Demonstrate knowledge of best practices for implementing web services, e.g. design contract independent from service interface, don't use stubs/skeleton, don't use validation for incoming requests, use XPath

7.3 Endpoint mappings

  • Have an understanding what endpoints are for, i.e. the handle SOAP messages similar to MVC Controllers
  • Know how to declare Endpoints via annotations @Endpoint, @PayloadRoot
  • Know how to map Endpoints in XML by Message Payload, SOAP Action Header, WS-Adressing, XPATH

7.4 Object-XML marshalling

  • Be familiar with technologies for Object-XML marshalling and their various advantages and disadvantages, including JAXB, Castor, XMLBeans.

7.5 Client access

  • Be familiar with the characteristics of the Webservice Template, e.g.
    • that it simplifies web service access
    • that it works with XML payload
    • that it can use marshallers /unmarshallers
    • that it provides methods for sending & receiving webservice messages
    • that it provides callbacks

8. Spring Remoting

8.1 Goals of Spring Remoting

  • Be aware of the goals behind Spring Remoting, i.e.
    • hide plumbing code / problems with plumbing code
    • configure/expose service declaratively
    • be consistent across protocols

8.2 Remoting Overview

  • Know that Service Exporters can expose services declaratively
  • Know that Client Proxies are Spring generated dynamic proxies that communicate with server-side endpoints

8.3 Supported Protocols

  • RMI
    • Be familiar with the advantages of Spring's RMI Service Exporter over traditional RMI, i.e. that Spring's RMI support is not invasive.
    • Be familiar with the characteristics of Spring's RMI Service Exporter, i.e.:
      • that is transparently exposes existing POJO
      • that it avoids traditional RMI requirements
      • that is can be configured in the bean configuration file.
    • Be familiar with the characteristics of Spring's RMI Proxy Generator, i.e.:
      • that there is a FactoryBean implementation to instantiate it from the bean configuration file
      • that it converts checked RemoteExceptions
      • that it dynamically implements the service interface
    • Have an understanding of the limitations of traditional RMI-IIOP, i.e. the service interface must extend the RMI Remote interface, all methods must throw RemoteException.
    • Have an understanding of how to implement RMI-IIOP the Spring way utilizing the JndiRMIServiceExporter and the JndiRmiProxyFactoryBean.
  • EJB
    • Demonstrate knowledge of how to utilize the jee namespace in the bean configuration file to generate Spring Proxies that can access EJBs.
    • Be aware of the advantages that Springs EJB access offers, i.e. JNDI lookup is concealed, EJB home is cached, RemoteExceptions are converted to runtime hierarchy.
  • HttpInvoker
    • Be familiar with the general characteristics of HttpInvoker, i.e. that it is a lightweight HTTP-based remoting protocol that converts method invocations to an HTTP Post.
    • Know how to configure a HttpInvoker Service Exporter in the bean configuration file.
    • Know how to configure a HttpInvoker Proxy in the bean configuration file.
  • Hessian/Burlap
    • Be familiar with the general characteristics of Burlap and Hessian, i.e. that they are two lightweight protocols for sending XML over HTTP utilizing proprietary mechanisms for the Object/XML serialization.
    • Know how to configure a Service Exporter for Hessian/Burlap in the bean configuration file.
    • Know how to configure a Proxy for Hessian/Burlap in the bean configuration file.

9. Using Spring in Web Applications

9.1 Goals of effective web application architecture

  • Be familiar with the architectural characteristics of an effective Web Application, i.e.
    • The web layer plays the role of an adapter responsible for mapping HTTP request to application functionality
    • An effective web application allows for separation of concerns, i.e. designers can focus on markup and style, java developers can focus on request processing logic

9.2 Bootstrapping a Spring-based application

  • Know how to bootstrap a Spring with the ContextLoaderListener
  • Be aware that the ContextLoaderListener loads the ApplicationContext and puts it into ServletContext

9.3 Accessing a Spring-based application

  • Be familiar with the ways in which Spring beans can be accessed: with the WebApplicationContextUtils, via dependency injection, via build-in framework integration, e.g. Struts, JSF

9.4 Spring MVC Request Processing Lifecycle

  • Demonstrate knowledge of Spring's MVC Request Processing Lifecycle, which entails:
  • the Dispatcher Servlet handles the incoming request
  • the request is dispatched to appropriate Handler, i.e. Handler method of Controller
  • the results are rendered via a View

9.5 DispatcherServlet

  • Demonstrate knowledge of how to defined the Dispatcher Servlet in the web.xml
  • Demonstrate knowledge of how to configures the Dispatcher Servlet with a spring bean configuration file.
  • Be aware, that the Dispatcher Servlet has full access to parent root context/ core application context

9.6 Handlers

  • Know that in Spring @MVC, Handlers are typically annotated with @Controller
  • Be aware that @RequestMapping tells Spring what method to execute when processing a request, i.e. @RequestMapping("/listAccount.html")
  • Know that after result handling, Controllers return a ModelAndView object, which selects the view to render the response and contains the data needed for rendering

9.7 Handler Mappings

  • Be familiar with the mapping rules for Request Mappings, i.e. they are typically URL-based an can contain wildcards, e.g. /reward/+/++
  • Know that Spring MVC will "fill in" declared parameters of the handler methods


  • Understand that the view returned by the Controller can be a concrete class, a name or null
  • Be aware that the DispatcherServlet uses a ViewResolver to map returned names to actual view implementations.
  • Know that the default ViewResolver treats the view name as a Web-Application relative file path. This can be overwritten by defining another ViewResolver in the bean configuration file of the DispatcherServlet.

10. Security

10.1 Motivations of Spring Security

  • Be familiar with the motivations behind Spring Security: Portability, Flexibility, Extensibility, Separation of concerns and Consistency.

10.2 Spring Security in a Web Environment

  • Be knowledgeable of Spring's security namespace to configure the bean configuration file
  • Know how to set up the springSecurityFilterChain Filter in the web.xml
  • Be aware that intercept-url are evaluated in the order listed in the bean configuration file

10.3 Configuring Web Authentication

  • Know how to plug-in a UserDetailsService in the bean configuration file with the <security:authentication-provider> tag
  • Be familiar with how to customize queries to retrieve user credentials with the <security:jdbc-user-service> tag
  • Be familiar with how to supply user credentials from properties file for development and testing with the <security:user-service>
  • Know how to implement a custom UserDetailsService by delegating to an existing DAO

10.4 Configuring Web Authorization

  • Be firm on how to apply security to many beans with the <security:protect-pointcut> tag
  • Know how to apply method security with annotations, e.g. @Secured("ROLE_MEMBER") and how to enable Spring Security annotations with <security:global-method-security secured-annotations="true"/>
  • Be familiar with how to apply method security with JSR-250, e.g. @RolesAllowed("ROLE_MEMBER") and how to enable JSR-250 annotations with <security:global-method-security jsr250-annotations="enabled"/>

10.5 Using Spring Security's Tag Libraries

  • Know how to display the authentication object with <security:authentication property="principal.username">
  • Understand how to hide a section based on a role with <security:authorize ifAnyGranted="ROLE_ADMIN">