У меня есть класс обслуживания, который имеет метод:аспект не вызывался от класса обслуживания
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>
Вам не нужно пространство между '*' и 'org' в вашем pointcut? – sp00m
@ sp00m Да есть пробел между * и org, все еще стоящий перед вопросом – Abhishek
И зачем он должен работать. Я не вижу '' aop: aspectj-autoproxy /> 'в вашей конфигурации. Вам также нужно помнить о том, что Spring AOP будет работать только для определенных весом и контролируемых бобов. Если у вас есть неуправляемый экземпляр (созданный Jasper, например), он не будет работать. –