struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeroen De Ridder <voetsjo...@gmail.com>
Subject Re: Struts 2/Spring and @Required
Date Mon, 06 Apr 2009 20:39:02 GMT
Don't forget that you need to instantiate a bean postprocessor in your 
applicationContext to enforce the @Required-annotation:

<bean 
class="org.springframework.beans.factory.annotation.RequiredAnnotationBeanPostProcessor" 
/>
> I don't supply any configuration to spring. I simply have the 
> applicationContexts constructing beans, and then have a couple of 
> lines in my struts.xml configuring the Object Factory and the autowire 
> method.
>
>     <constant name="struts.objectFactory" 
> value="org.apache.struts2.spring.StrutsSpringObjectFactory" />
>     <constant name="struts.objectFactory.spring.autoWire" value="type" />
>
> and of course have the listeners set up in my web-xml. What sort of 
> configuration would be needed to get this to work?
>
> Thanks,
> Tim
>
> Musachy Barroso wrote:
>> You should post your spring xml config file, it looks like some AOP
>> config is probably missing.
>>
>> musachy
>>
>> On Mon, Apr 6, 2009 at 2:34 PM, Timothy Orme
>> <torme@genome.med.harvard.edu> wrote:
>>> Hello All,
>>>
>>>        One of the nice annotation features of spring is the ability to
>>> annotate injected fields with @Required so that you don't get null 
>>> pointer
>>> exceptions. However, I can only seem to get this to work with my 
>>> test cases
>>> (spring throws an error when a required field isn't set), but I 
>>> can't get
>>> the same behavior on the startup of my struts 2 web app. Does anyone 
>>> know if
>>> it's possible for the web-app to break when an @Required field isn't 
>>> set at
>>> startup?
>>>
>>> Thanks,
>>> Tim
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message