Directory

← Back

SpringVaadinIntegration

Integration Spring and Vaadin. And some useful features.

Author

Rating

Popularity

<100

Now you can use Spring Framework in your Vaadin projects.

Features:

  • Spring Framework integration
  • No AOP dependencies!
  • Vaadin's Views Autowiring
  • Vaadin's Views caching
  • Vaadin's SystemMessages customization
  • Apache Shiro integration
  • Portlet support
  • Initial OSGI support

Vaadin 7.6.x -> SpringVaadinIntegration 3.2.x Vaadin 7.2.x -> SpringVaadinIntegration 3.x Vaadin 7.1.x -> SpringVaadinIntegration 2.x Vaadin 7.0.x -> SpringVaadinIntegration 1.x

More info. http://vaadin.xpoft.ru/

Sample code

@Component
@Scope("prototype")
@Theme("myTheme")
public class MyUI extends UI
{
    @Autowired
    private MyClass myClass;

    @Override
    protected void init(final VaadinRequest request)
    {
        DiscoveryNavigator navigator = new DiscoveryNavigator(this, this);
        navigator.navigateTo(UI.getCurrent().getPage().getUriFragment());
    }
}
@Component
@Scope("prototype")
@VaadinView(MainView.NAME)
public class MainView extends Panel implements View
{
    public static final String NAME = "profile";

    @Autowired
    private transient ApplicationContext applicationContext;

    @Autowired
    private SimpleForm form;

    @PostConstruct
    public void PostConstruct()
    {
        MainLayout mainLayout = new MainLayout();
        mainLayout.setContent(form);

        setContent(mainLayout);
    }

    @Override
    public void enter(ViewChangeListener.ViewChangeEvent event)
    {
    }
}
    <servlet>
        <servlet-name>Vaadin Application</servlet-name>
        <servlet-class>ru.xpoft.vaadin.SpringVaadinServlet</servlet-class>
        ...
        <init-param>
            <param-name>systemMessagesBeanName</param-name>
            <param-value>DEFAULT</param-value>
        </init-param>
    </servlet>
vaadin.communicationError.Caption = Error
vaadin.communicationError.Message = It's a communication error. Is Jetty run?
@Component
@Scope("prototype")
@VaadinView(value = UIScopedView.NAME, cached = true)
public class UIScopedView extends Panel implements View
{
    public static final String NAME = "ui_scoped";

    private final Label statusLabel = new Label();
    private boolean scoped = false;

    public UIScopedView()
    {
        try
        {
            Thread.sleep(5000);
        }
        catch (InterruptedException e)
        {
            e.printStackTrace();
        }

        setSizeFull();
        VerticalLayout layout = new VerticalLayout();
        layout.setSpacing(true);
        layout.setMargin(true);

        layout.addComponent(new Label("At first time, it's loading about 5 seconds."));
        layout.addComponent(new Label("Now click \"Go back\" button, than \"Go to the UI scoped View\" again."));
        layout.addComponent(statusLabel);
        layout.addComponent(new Button("Go back", new Button.ClickListener()
        {
            @Override
            public void buttonClick(Button.ClickEvent event)
            {
                Page.getCurrent().setUriFragment("!" + MainView.NAME);
            }
        }));

        statusLabel.setCaption("State");
        statusLabel.setValue("First time");

        setContent(layout);
    }

    @Override
    public void enter(ViewChangeListener.ViewChangeEvent viewChangeEvent)
    {
        if (scoped)
        {
            statusLabel.setValue("Already scoped");
        }

        scoped = true;
    }
}
@Component
@Scope("prototype")
@VaadinView(RoleAdminView.NAME)
@RequiresRoles("admin")
public class RoleAdminView extends Panel implements View
{
...
}

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

Add initial OSGI support.

Released
2013-09-25
Maturity
STABLE
License
Apache License 2.0

Compatibility

Framework
Vaadin 7.1
Vaadin 7.0+ in 1.3.5
Vaadin 7.1+ in 2.0
Vaadin 7.2+ in 3.0
Vaadin 7.3+ in 3.1
Vaadin 7.6+ in 3.2
Browser
N/A

SpringVaadinIntegration - Vaadin Add-on Directory

Integration Spring and Vaadin. And some useful features. SpringVaadinIntegration - Vaadin Add-on Directory
Now you can use Spring Framework in your Vaadin projects. Features: * Spring Framework integration * No AOP dependencies! * Vaadin's Views Autowiring * Vaadin's Views caching * Vaadin's SystemMessages customization * Apache Shiro integration * Portlet support * Initial OSGI support Vaadin 7.6.x -> SpringVaadinIntegration 3.2.x Vaadin 7.2.x -> SpringVaadinIntegration 3.x Vaadin 7.1.x -> SpringVaadinIntegration 2.x Vaadin 7.0.x -> SpringVaadinIntegration 1.x More info. http://vaadin.xpoft.ru/
Sample project
Issue Tracker
Source Code
Discussion Forum
Project Homepage
Author Homepage

SpringVaadinIntegration version 1.3.5
Add SystemMessages bean support. Now you can use Spring Beans as source for SystemMessages.

SpringVaadinIntegration version 1.4
- Vaadin 7.0.0.beta4 support - Enhanced SystemMessages bean support. Now you can use localized messages! Simple & quick. See sample project.

SpringVaadinIntegration version 1.4.6
- Simplify DiscoveryNavigator. It uses Spring Root Context to autowiring Vaadin Views, and AspectJ for non-managed classes. - You should add '< context:spring-configured / >' to your spring config. See sample project. - Now serialization & deserialization work perfect.

SpringVaadinIntegration version 1.4.7
fix caching

SpringVaadinIntegration version 1.5
- Vaadin 7.0.0.beta5 - Java 6.0 support

SpringVaadinIntegration version 1.5.1
Remove AspectJ dependency

SpringVaadinIntegration version 1.5.6
Vaadin 7.0.0.beta6 support Replace AspectJ with static access to the application context. Now you can remove '' Add view scopes: prototype (default) and ui!

SpringVaadinIntegration version 1.5.7
String VaadinView.scope renamed to boolean VaadinView.cached. Be careful!

SpringVaadinIntegration version 1.6
Add Apache Shiro support. Simple check for roles. Without AspectJ! See sample project.

SpringVaadinIntegration version 1.6.1
ShiroSecurityNavigator. Fix caching

SpringVaadinIntegration version 1.6.2
Apache Shiro. Add @RequiresPermissions support

SpringVaadinIntegration version 1.6.3
fix beans add

SpringVaadinIntegration version 1.6.5
- Vaadin 7.0.0.beta10 Vaadin changes. Now UI.getContent() return instance of Component. Replace: DiscoveryNavigator navigator = new DiscoveryNavigator(this, getContent()); With: DiscoveryNavigator navigator = new DiscoveryNavigator(this, this);

SpringVaadinIntegration version 1.6.6
Vaadin 7.0.0

SpringVaadinIntegration version 1.6.7
Add portlet support (SpringVaadinPortlet). Thx to matthiasgasser

SpringVaadinIntegration version 1.6.8
NPE fix in DiscoveryNavigator. Thx to mpilone.

SpringVaadinIntegration version 1.7
- VaadinMessageSource. Use VaadinSession instead of UI - ShiroSecurityNavigator. Add @RequiresAuthentication, @RequiresGuest, @RequiresUser support.

SpringVaadinIntegration version 1.7.1
- Now you can use @Scope("session") for UI, instead of @PreserveOnRefresh. Bean with "prototype" scope it's the same as class without @PreserveOnRefresh (create new instance for each new page). Other types of scope will store UI in the session and it'll be reused.

SpringVaadinIntegration version 1.7.3
Add custom UI providers support (servlet "UIProvider" property). Thx to mpilone

SpringVaadinIntegration version 1.8
- Add servlet config parameter "contextConfigLocation". Path to Spring configuration. - Session scoped UI improvements.

SpringVaadinIntegration version 2.0
Vaadin 7.1 Vaadin 7.1.x -> SpringVaadinIntegration 2.x Vaadin 7.0.x -> SpringVaadinIntegration 1.x

SpringVaadinIntegration version 2.0.1
Add ability to initialize the plugin in a separate method.

SpringVaadinIntegration version 2.0.2
Add initial OSGI support.

SpringVaadinIntegration version 3.0
Vaadin 7.2 support

SpringVaadinIntegration version 3.0.1
Add javadoc, sources. Thx to @mstahv

SpringVaadinIntegration version 3.1
- Vaadin 7.3 support - Spring Framework 4.1

SpringVaadinIntegration version 3.2
- Vaadin 7.6 support - Spring Framework 4.2

Online