Directory

← Back

Spring Stuff

Makes Vaadin and Spring eternally happy together

Author

Contributors

Rating

This add-on contains classes that add some missing "glue" between Vaadin and Spring. In addition, these classes help address the "scope mismatch" between Vaadin application scope and Spring web application context scope that leads to memory leaks when a Vaadin application closes.

Some key features included are:

  • A Spring application context for each Vaadin application
  • Autowiring of Vaadin and non-Vaadin beans
  • @VaadinConfigurable for autowire-on-construction
  • Helpers for background thread interaction with Vaadin application beans
  • A Spring scope that matches Vaadin application scope
  • Memory-leak free Vaadin listeners on non-Vaadin event sources
  • Several container and property helper classes
  • Auto-generation of container properties from annotations
  • Auto-generation of form fields from annotations

Sample code

<?xml version="1.0" encoding="ISO-8859-1"?>

<!-- $Id$ -->
<beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:context="http://www.springframework.org/schema/context"
  xmlns:p="http://www.springframework.org/schema/p"
  xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">

    <!-- Activate Spring annotation support -->
    <context:annotation-config/>

    <!-- Example of an application-specific bean which gets created and autowired when the
           application starts and destroyed when the application stops -->
    <bean class="com.example.MyApplicationBean"/>

    <!-- This makse the Vaadin application instance itself available in, and autowired by, this context -->
    <bean class="org.dellroad.stuff.vaadin.ContextApplicationFactoryBean" p:autowire="true"/>

</beans>

Compatibility

(Loading compatibility data...)

Was this helpful? Need more help?
Leave a comment or a question below. You can also join the chat on Discord or ask questions on StackOverflow.

Version

Version 1.0.964 Released January 28, 2015

- Make @FieldBuilder.ProvidesField search in super-types for annotated methods
- Fixed bug in MethodAnnotationScanner that allowed duplicate methods
- Added FieldLayout, BlobField, and StringValuePropertyDef
Released
2015-01-28
Maturity
STABLE
License
Apache License 2.0

Compatibility

Framework
Vaadin 6.2+
Vaadin 7.1+
Vaadin 7.0+ in 1.0.659
Browser
Browser Independent
Online