我有一个服务类,它有一个方法:
public void setDataSource(DynaFormReportFilterBean filterBean,Map parameterValues,List<Map<String,Object>> dynaFormStatusList)我已经使用@Aspect创建了一个方面类,并且我正在使用
@AfterReturning("execution(* org.bio.reports.service.jasper.DynaFormDataSourceReportService.setDataSource(..)) && args(bean,parameterValues,dynaFormStatusList)") 调用方法
public void afterReportAction(JoinPoint jp,
final AbstractBean bean, final Map parameterValues,
final List<Map<String, Object>> dynaFormStatusList) {//----Code here------//}`当我运行代码时,方面类没有被调用。
下面是应用程序上下文条目:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
<!-- The below configuration is used to enable AspectJ support -->
<aop:aspectj-autoproxy>
<aop:include name="addressBookAuditLogAspect" />
<aop:include name="inventoryAuditLogAspect" />
<!-- aop:include name="shipmentAuditLogAspect" / -->
<aop:include name="dynaAuditLogAspect" />
<aop:include name="questionAuditLogAspect" />
<aop:include name="reportAuditLogAspect" />
</aop:aspectj-autoproxy>
<!-- This bean defines the details about the TaskExecutor used for asynchronous invocation of method/s
The values 3 properties mentioned can be changed as per the requirement
Currently the values are specified for testing purpose -->
<bean id="businessLogExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
<property name="corePoolSize" value="10" />
<property name="maxPoolSize" value="25" />
<property name="queueCapacity" value="100" />
</bean>
<!-- The below bean defines the 'DynaAuditLogAspect' class which will act as a bridge between Bio4D and Auditing utility -->
<bean id="dynaAuditLogAspect" class="org.bio.audit.dynaforms.DynaAuditLogAspect">
<property name="taskExecutor" ref="businessLogExecutor" />
<property name="bioExtensionDataDAO" ref="bioExtensionDataDAO" />
</bean>
<!-- The below bean defines the 'ReportAuditLogAspect' class which will act as a bridge between Bio4D and Auditing utility -->
<bean id="reportAuditLogAspect" class="org.bio.audit.reports.ReportAuditLogAspect">
<property name="taskExecutor1" ref="businessLogExecutor" />
<property name="usersDAO" ref="usersDAO" />
</bean>
<bean id="questionAuditLogAspect" class="org.bio.audit.dynaforms.QuestionAuditLogAspect">
</bean>
<!-- The below bean defines the 'ShipmentAuditLogAspect' class which will act as a bridge between Bio4D and Auditing utility -->
<bean id="shipmentAuditLogAspect" class="org.bio.audit.bms.ShipmentAuditLogAspect">
<property name="bmsTaskExecutor" ref="businessLogExecutor" />
<property name="shipmentDAO" ref="shipmentDAO" />
</bean>
<bean id="inventoryAuditLogAspect" class="org.bio.audit.bms.InventoryAuditLogAspect">
</bean>
<!-- The below bean defines the 'AddressBookAuditLogAspect' class which will act as a bridge between Bio4D and Auditing utility -->
<bean id="addressBookAuditLogAspect" class="org.bio.audit.administration.AddressBookAuditLogAspect"/>
</beans>发布于 2014-11-22 22:31:22
正如注释中提到的,您需要在配置中声明。此外,由于您使用的是@AfterReturning建议,因此只有当您的目标方法在运行时不抛出任何异常时,此建议才会执行。
https://stackoverflow.com/questions/27040951
复制相似问题