IoC with GeDA Spring 3 module

Last modified by Denis Pavlov on 2018/03/26 13:00

  This page applied to GeDA v.2.0.0+, specifically module geda.spring-integration.

Module overview

To make this absolutely clear - you DO NOT have to use geda.spring-integration. All it is - is a best practice approach to spring beans setup for GeDA. You are welcome to use just geda.core if you find spring-integration not suitable for you.

So what does it actually do?

Spring integration module uses Spring in order to setup GeDA infrastructure and let you use GeDA assembler without having to work with them directly. 

Version 2.0.0 provided annotation driven approach through AOP with few enhancements in later versions.

Version 2.1.1 provided xml driven approach a pure bean service IoC.

Maven dependencies

To integrate GeDA with your Spring 3 project you will need the following two modules:

<!-- core module: use can you it on its own if you are not using Spring 3 -->

<!-- spring integration: spring 3 AOP wrapper for core -->

Whats in the box?

  • DTOSupport - a service singleton what ports the access to GeDA core
  • DTOFactory - a wrapper around BeanFactory from core
  • DTOAdaptersRegistrar - a bean that allows you to configure your converters, retrievers and matchers
  • DTODSLRegistrar - DSL support from core
  • DTOEventListener - six events are currently supported (on-dto-assembly, on-dto-assembled, on-dto-failed, on-entity-assembly, on-entity-assembled and on-entity-failed) which are configured through GeDA spring tags
  • Two schemas for annotation-driven and xml-driven approaches
  • @Transferable - annotation for annotation-driven approach


  • on-dto-assembly - invoked just before assembleDto call
  • on-dto-assembled - invoked straight after assembleDto call
  • on-dto-failed - invoked if there was an exception during assembleDto call
  • on-entity-assembly - invoked just before assembleEntity call
  • on-entity-assembled - invoked straight after assembleEntity call
  • on-entity-failed- invoked if there was an exception during assembleEntity call

annotation-driven VS xml-driven

Annotation driven is less intrusive on your code since it only requires you to use @Transferable annotation on your methods and most of the configuration and decisions are done by GeDA. However this comes at a price of use of AOP which may affect performance. Also there are some peculiarities of using "this" since Spring framework uses proxy objects for AOP, so you need to be careful.

XML driven require you to be in control and simply provides the infrastructure for DTOSupport bean. Where you use this bean is up to you through the <dtosupport> tag.

Spring GeDA 1-2-3

In the end both of these methods are very similar is the way you use them:

  1. pick correct schema
  2. put <annotation-driven> or <xml-driven> and specify your configuration.
  3. use @Transferable or <dtosupport> to specify which beans will use GeDA and how
Created by Vladyslav Pavlov on 2018/03/20 09:03
GeDA - Generic DTO Assembler © Denys Pavlov 2009 - 2019