Spring Dependency injection issue with Vaadin

Hi ,
I am new to vaadin. I am trying to integrate Spring dependency injection into Vaadin.
Below is my application class. I am deploying this in liferay as a portlet.
Issue : When my application is getting deployed, Spring DI works fine and the dependencies get instantiated and are not null. I can see that in logs.
But when I am accessing my application as a user , the dependencies again become null. Please suggest.
Below two listeners are present in my web.xml



package com.magellanhealth.memberinfo;

import javax.annotation.PostConstruct;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.stereotype.Component;

import com.magellanhealth.enterprise.member.persistence.orm.MemberRecipientDao;
import com.vaadin.Application;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.Window;

public class MemberProfile extends Application {

private static final long serialVersionUID = 1L;

// @Autowired
// private MemberGeneric memberGeneric ;

private MemberRecipientDao memberRecipientDao;

public MemberRecipientDao getMemberRecipientDao() {
	return memberRecipientDao;
public void setMemberRecipientDao(MemberRecipientDao memberRecipientDao) {
	System.out.println("calling setter method for de inj");
	this.memberRecipientDao = memberRecipientDao;

public void init() {
    Window window = new Window("Vaadin Portlet Application");
    System.out.println("inside init method");
    if(this.getMemberRecipientDao() != null){
    	System.out.println("mpd is not null");
    // window.addComponent(new Label("Hello Vaadin user!"));\
public void H1(Window window){

//// SpringContextHelper helper = new SpringContextHelper(this);
//// MemberGeneric bean = (MemberGeneric) helper.getBean(“memberGeneric”);
// if(memberGeneric != null){
// System.out.println(“mgr is not null”);
// }
// // MemberGeneric memberGeneric = new MemberGeneric(“”);
// window.addComponent(memberGeneric);
public void H2(Window window){
MemberTabbedInfo memberTabbedInfo = new MemberTabbedInfo();


How looks your ApplicationPortlet-subclass? Or are you using one of the Spring-Integration-addons? If yes, which one? Are your spring-beans (as far as they are Vaadin-related) session-scoped?

Thanks for your reply.
I was able to resolve this issue using following approach. Can you review high level and let me if this is ok ?

  1. In general a User’s Vaadin application class is loaded by com.vaadin.terminal.gwt.server.ApplicationPortlet2.

  2. I copied the exact code from this class and created a new class – AutowiringApplicationPortlet with few additions.
    a) This class gets and stores the Spring context in it.
    b) I overrided the getNewApplication() method of its superclass AbstractApplicationPortlet. Whenever this method is called by Vaadin engine, it
    uses the Spring’s bean factory to create the Vaadin application class. This way all the dependencies in the object tree get injected. If we don’t override this method a new instance of the application class is simply returned by the superclass method.
    I have attached this class here.

  3. For session scoped beans , In my web.xml I configured the below filter and it is working now.

requestContextFilter org.springframework.web.filter.RequestContextFilter Invoker Filter - ERROR /* ERROR requestContextFilter /* REQUEST INCLUDE FORWARD 4) I did not use any Spring add-ons as I found that they are not useful for portlets. As told below I am deploying vaadin portlet in liferay. [12367.java|attachment](upload://6eWRACWCqW0jDptPzUskdg7j4X7.java) (2.51 KB)

Well except for the copying of the ApplicationPortlet-source-code (why not just use inheritance?), your approach looks good.