You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Francisco Exposito <fc...@hotmail.com> on 2009/09/24 11:55:28 UTC

Instance object with spring in struts2

Hello,

I've installed spring plugin fullhibernatecore plugin. Then I have defined in applicationContext 

<bean id="countryService" class="com.virtua.market.service.dao.CountryDaoService"/>

Then I have an action class where I define (with getters and setters):

private ICountryService countryService;

And when the action happens it instances the countryService.


Also I have the same, but in a conversion class(public class CountryConversion extends StrutsTypeConverter), and it works properly.

But I have another action where nothing happens. It maintains the variable=null. This new class is a util class which I have to instantiate to execute its methods. Here is the class.

package com.virtua.market.util;

import java.util.List;

import com.virtua.market.service.interfaces.ICountryService;
import com.virtua.market.vo.Country;

public class ComboUtilPersistenceFunctions
{
    private ICountryService countryService;
    
    public List<Country> getCountries()
    {
        List<Country> countries=null;    
        countries = countryService.getAll();
        return countries;
    }

    public void setCountryService(ICountryService countryService)
    {
        this.countryService = countryService;
    }

    public ICountryService getCountryService()
    {
        return countryService;
    }    
}


Anybody knows what can I do?

Thanks in advance
 		 	   		  
_________________________________________________________________
Llévate Messenger en el móvil a todas partes ¡Conéctate!
http://www.microsoft.com/spain/windowsmobile/messenger/default.mspx