首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Aspect未从Service类调用

Aspect未从Service类调用
EN

Stack Overflow用户
提问于 2014-11-20 21:35:05
回答 1查看 240关注 0票数 0

我有一个服务类,它有一个方法:

代码语言:javascript
复制
public void setDataSource(DynaFormReportFilterBean filterBean,Map parameterValues,List<Map<String,Object>> dynaFormStatusList)

我已经使用@Aspect创建了一个方面类,并且我正在使用

代码语言:javascript
复制
@AfterReturning("execution(* org.bio.reports.service.jasper.DynaFormDataSourceReportService.setDataSource(..)) && args(bean,parameterValues,dynaFormStatusList)") 

调用方法

代码语言:javascript
复制
public void afterReportAction(JoinPoint jp,
    final AbstractBean bean, final Map parameterValues,
    final List<Map<String, Object>> dynaFormStatusList) {//----Code here------//}`

当我运行代码时,方面类没有被调用。

下面是应用程序上下文条目:

代码语言:javascript
复制
<?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>
EN

回答 1

Stack Overflow用户

发布于 2014-11-22 22:31:22

正如注释中提到的,您需要在配置中声明。此外,由于您使用的是@AfterReturning建议,因此只有当您的目标方法在运行时不抛出任何异常时,此建议才会执行。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27040951

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档