Saturday, October 29, 2011

100% Vaadin and Spring integration without hacks

About 6 months ago I've started working on a new project.
Vaadin was chosen as a UI framework for our product. As this project looked very simple it was decided to use very straight-forward application design. Components where instantiated manually, for inter-component communications and passing component references around we used "Application context". Later event bus solution was added for application-wide messaging.
During recent months that project have grown significantly and it became really hard to support it because of well-known tight coupling problem.
Project was refactored to use Spring for injecting dependencies between UI components and managing UI component instantiation that allowed us to get rid of application context and event bus.
A week later I've noticed that it turned out to be a non-trivial solution for some people around.

Here I publishing Address Book example from Book of Vaadin refactored to fully utilize Spring throughout the application including UI layer, inter-component dependencies and component scope management.
This application uses AspectJ but can be easily adapted to work without it.

You can download working application source following the link.

1 comment:

  1. I ran your project but I got NullPointerException in @Autowired
    private MainWindow mainWindow;
    It seems @Autowired doesn't instanciate MainWindow in SpringAddressBook.
    What could be the mistake?

    ReplyDelete