Back Forum Reply New

DWR accessing request scoped bean

Hi guys,

I've done a few hours with of good old-fashioned web trawling in search of a solution with little luck. My problem involves an web application that's having it's front-end retrofitted with some DWR and jquery goodies.

I need to make DWR calls to methods in a spring bean (by passing spring mvc). This spring bean (MyAccountsService) is a singleton but has another spring bean (Brand) as a collaborator, but Brand is request scoped - Brand bean is configured with lt;aop:scoped-proxy/gt;. When i debug the call, it goes into MyAccountsService's method where I access a proxied reference to Brand. At this point however, Brand is null. I've tried several suggestions made by others:

- modifying lt;aop:scoped-proxy/gt; by adding proxy-target-class=quot;falsequot;. This results in a deployment error quot;Cannot convert value of type [$Proxy15 ......to required type .... for property 'Brand': no matching editors or conversion strategy foundquot;.
- adding aspectjweaver.jar and aspectjrt.jar to the classpath
- Having Brand implement and interface using an instance of that interface in MyAccountServiceI've had no luck with any of these...

I've included some relevant code below if anyone can see what's wrong?

configuration.xml (myAccountsServiceWrapper is a very thin layer created to handle authentication)

Code:
lt;bean id=quot;sessionBrandquot; class=quot;com.wessie.Brandquot; scope=quot;requestquot;gt;
lt;aop:scoped-proxy proxy-target-class=quot;falsequot; /gt;
lt;/beangt;

lt;bean id=quot;myAccountsServicequot; class=quot;com.wessie.MyAccountsServiceImplquot; parent=quot;baseServicequot;gt;
lt;property name=quot;sessionBrandquot;gt;lt;ref bean=quot;sessionBrandquot;/gt;lt;/propertygt;
lt;/beangt;

lt;bean id=quot;myAccountsServiceWrapperquot; class=quot;com.wessie.dwr.MyAccountsServiceWrapperquot;gt;
lt;property name=quot;authorizationHelperquot;gt;lt;ref bean=quot;authorizationHelperquot;gt;lt;/refgt;lt;/propertygt;
lt;property name=quot;myAccountsServicequot;gt;lt;ref bean=quot;myAccountsServicequot;gt;lt;/refgt;lt;/propertygt;
lt;/beangt;
Brand bean

Code:
package com.wessie.vo;

import java.io.Serializable;

public class Brand implements IBrand, Serializable{

private String name;

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}
}
Brand interface

Code:
package com.wessie.vo;

public interface IBrand
{
public String getName();
public void setName(String name);
}
Regards
Wessie
¥
Back Forum Reply New