I am trying to use aop to add around advice to one of my services. Here is my cs xml
<bean id="SiteDAO" class="eits.components.Site.SiteDAO" singleton="true">
<property name="DataSourceConfig"><ref bean="DataSourceConfig" /></property>
<property name="InstancePath"><value>eits.components.Site.Site</value></property>
<property name="SequenceName"><value>eits.eits_site_id_seq</value></property>
</bean>
<bean id="SiteDGO" class="eits.components.Site.SiteDGO" singleton="true">
<property name="DataSourceConfig"><ref bean="DataSourceConfig" /></property>
</bean>
<!-- set up a proxy for the service -->
<bean id="SiteServiceTarget" class="eits.components.Site.SiteService" singleton="true">
<property name="DAO"><ref bean="SiteDAO" /></property>
<property name="DGO"><ref bean="SiteDGO" /></property>
<property name="MessagePath"><value>${MessageInstancePath}</value></property>
<property name="Utilities"><ref bean="Utilities" /></property>
</bean>
<bean id="SiteService" class="eits.coldspring.aop.framework.ProxyFactoryBean ">
<property name="target"><ref bean="SiteServiceTarget" /></property>
<property name="interceptorNames"><list><value>HistoryAroundAdvice</value></list></property>
</bean>
What I am getting is the following error:
Could not find the ColdFusion Component [runtime _expression_]
Please check that the given name is correct and that the component exists.This happens because the service function I am calling uses getInstancePath(). InstancePath is a property that I am defining
in the SiteDAO bean cs. When I try to dump the value of instancepath it says it's a [runtime _expression_] which I've never
seen before. If I remove the aop stuff everything runs fine. any help with this would be great. also if it helps I have included the cfc
for my aroundadvice below as well as the cs xml for that
<cfcomponent name="History Around Advice" extends="eits.coldspring.aop.MethodInterceptor">
<cffunction name="invokeMethod" access="public" returntype="any">
<cfargument name="mi" type="eits.coldspring.aop.MethodInvocation" required="true" />
<cfset var args = arguments.mi.getArguments() />
<cfset var methodName = arguments.mi.getMethod().getMethodName() />
<cfdump var="#methodName#">
<cfswitch _expression_="#methodName#">
<cfcase value="save">
<cfset recordInHistory(arguments.mi) />
</cfcase>
<cfcase value="delete">
<cfset recordInHistory(arguments.mi) />
</cfcase>
</cfswitch>
<cfreturn arguments.mi.proceed() />
</cffunction>
<cffunction name="recordInHistory" access="public" output="false" returntype="void">
<cfargument name="mi" type="eits.coldspring.aop.MethodInvocation" required="true" />
<cfset var lcl = StructNew() />
<cfset var args = arguments.mi.getArguments () />
<cfset var methodName = arguments.mi.getMethod().getMethodName() />
<cfset var targetObjectMeta = GetMetaData(arguments.mi.getTarget()) />
<cfset var objName = "" />
<!--- If for whatever reason history is failing don't die --->
<cftry>
<cfif StructKeyExists(targetObjectMeta,'displayname')>
<!--- TODO: remove DAO from display name --->
<cfset objName = targetObjectMeta.displayname />
</cfif>
<cfset lcl.history = getHistoryService().CreateInstance() />
<cfwddx action="" input="#args[1]#" output=" lcl.serialized" />
<cfscript>
lcl.history.setsite_id(1);
lcl.history.setteam_id(4);
lcl.history.settype(objName & '.' & methodName & '()');
lcl.history.setdetails('');
lcl.history.setinstance_wddx(lcl.serialized);
lcl.history.setcommited_by(3);
lcl.history.save();
</cfscript>
<cfcatch></cfcatch>
</cftry>
</cffunction>
<cffunction name="getHistoryService" access="public" output="false" returntype=" eits.components.History.HistoryService">
<cfreturn variables.instance.HistoryService />
</cffunction>
<cffunction name="setHistoryService" access="public" output="false" returntype="void">
<cfargument name="HistoryService" type="eits.components.History.HistoryService" required="true" />
<cfset variables.instance.HistoryService = arguments.HistoryService />
</cffunction>
</cfcomponent>
<bean id="HistoryAroundAdvice" class="eits.components.History.HistoryAroundAdvice" singleton="true">
<property name="HistoryService"><ref bean="HistoryService" /></property>
</bean>
