Hello,

Currently the application I'm working on is using Spring 1.2.0, with AOP configuration like this one:
--
<object id="ConfigurationServiceTarget" type="CompanyName.ProductName.Remodeling.Service.C onfigurationService, CompanyName.ProductName.Remodeling.Service" parent="ServiceBase">
<property name="CustomerQualificationSearchResultsLineTransf ormer" value="CustomerQualificationSearchResultsLineTrans former" />
<property name="CustomerQualificationSearchParamTransformer" value="CustomerQualificationSearchParamTransformer " />
<property name="CustomerQualificationManager" value="CustomerQualificationManager" />
</object>

<object id="ConfigurationService" type="Spring.Aop.Framework.ProxyFactoryObject, Spring.Aop">
<property name="proxyInterfaces" value="CompanyName.ProductName.Remodeling.Service. Interface.IConfigurationService"/>
<property name="target" ref="ConfigurationServiceTarget"/>
<property name="interceptorNames">
<list>
<value>ServiceInterceptor</value>
</list>
</property>
</object>
--

We want to upgrade to a more recent version, but while testing with the 1.3.0 version I get an exception indicating that the object I want to proxy doesn't implement any interface (which is false).
The problem is due to a change in the "ProxyFactoryObject.singletonInstance" initialization behavior:
1.2.0:
--
public virtual IObjectFactory ObjectFactory
{
set
{
this.objectFactory = value;

#region Instrumentation

if (logger.IsDebugEnabled)
{
logger.Debug("Setting IObjectFactory. Will configure target, interceptors and introductions...");
}

#endregion

ConfigureAdvisorChain();
ConfigureIntroductions();

#region Instrumentation

if (logger.IsDebugEnabled)
{
logger.Debug("ProxyFactoryObject config: " + this);
}

#endregion

if (IsSingleton)
{
if (this.targetName != null)
{
TargetSource = NamedObjectToTargetSource(this.objectFactory.GetOb ject(this.targetName));
}

// eagerly initialize the shared singleton instance...
this.singletonInstance = CreateAopProxy().GetProxy();

// must listen to superclass advice and interface change
// events to recache singleton instance if necessary...
AddListener(this);
}
}
}
--
1.3.0:
--
public virtual IObjectFactory ObjectFactory
{
set
{
this.objectFactory = value;
}
}
--
Indeed, in 1.2.0 the "singletonInstance" is initialized when the "ObjectFactory" is setted, but not in 1.3.0, and so the "ObjectType" getter doesn't behave the same:
--
public virtual Type ObjectType
{
get
{
if (this.singletonInstance != null)
{
return this.singletonInstance.GetType(); // Returned in 1.2.0
}
else if (Interfaces.Length == 1)
{
return Interfaces[0]; // Returned in 1.3.0
}
else if (this.targetName != null && this.objectFactory != null)
{
return this.objectFactory.GetType(this.targetName);
}
else
{
return TargetSource.TargetType;
}
}
}
--
In 1.2.0 I receive a type that implement an interface, while in 1.3.0 I receive the interface type (which doesn't implement itself), and so an exception is thrown.

I suggest the following workaround which use the "SingletonInstance" property instead of the "singletonInstance" field:
--
public virtual Type ObjectType
{
get
{
// TODO (EE): sync with Java
lock (this.SyncRoot)
{
if (this.SingletonInstance != null)
{
return this.SingletonInstance.GetType();
}
else if (Interfaces.Length == 1)
{
return Interfaces[0];
}
else if (this.targetName != null && this.objectFactory != null)
{
return this.objectFactory.GetType(this.targetName);
}
else
{
return TargetSource.TargetType;
}
}
}
}
--

Is there any other workaround ?

Best regards.

Matthieu