Vaadin 7 and Spring

the topic was raised probably many times, but I can’t find anywhere a definite solution.

I’m trying to integrate our Vaadin 7 project with Spring 3.2. There are add-ons for Vaadin, which provide this integration, but they usually have one problem: if I build my Vaadin UI using components injected by Spring (e.g. views, components etc.) they will fail during serialisation to the session. Spring doesn’t like serialisation. Our application is going to run on a cluster, so serialisation is definitely must-have.

To be honest I can’t wrap my head around this topic. I am quite fresh user of both technologies - still learning - but want to have dependency management provided by Spring to avoid too tight coupling of components used in Vaadin application.

My needs would be:

  • being able to have application-wide beans injected by Spring to different parts of application (beans not related to particular session/user, mostly singletons, but possibly one-timers/prototypes as well),
  • Vaadin main UI class would be annotated with @PreserveOnRefresh - we want the user to see the application in a state he/she left it so it would serialise the components starting from the UI object, down the UI tree (erm… right?),
  • being able to have session/user bound beans injected by Spring - that would include UI components, let’s say views etc. - whatever now is instantiated by constructors starting from my application main UI class - those wouldn’t be shared between session of different users, but would be probably serialised in a session, for which it was created,
  • being able to scale the application between nodes in a cluster, so again serialisation comes into play,
  • we work in Eclipse and use “Servers” view to configure our servers, run and stop them; whenever we change a line of Java code, the server restarts; since Tomcat keeps sessions between restarts, effectively it keeps our application in the state it was before restart - with some add-ons this caused many problems.

I would appreciate if someone put me on track.


I’m falling in the same problem. Did you find a solution for it? What did you do? … Thanks in advance.