簡體   English   中英

服務類未調用方面

[英]Aspect not getting called from Service class

我有一個具有方法的服務類:

public void setDataSource(DynaFormReportFilterBean filterBean,Map parameterValues,List<Map<String,Object>> dynaFormStatusList)

我已經使用@Aspect創建了一個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------//}`

當我運行代碼時,沒有調用Aspect類。

這是應用程序上下文條目:

<?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>

如注釋中所述,您將需要在配置中聲明。 另外,由於您使用的是@AfterReturning建議,因此僅當您的目標方法在運行時未引發任何異常時,此建議才會執行。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM