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 javadoc, sources. Thx to @mstahv

Released
2014-06-09
Maturity
STABLE
License
Apache License 2.0

Compatibility

Framework
Vaadin 7.2+
Vaadin 7.0+ in 1.3.5
Vaadin 7.1+ in 2.0
Vaadin 7.1 in 2.0.2
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/
Online