aspectj

Capture successful login with AspectJ and Spring Security

 ̄綄美尐妖づ 提交于 2020-01-14 05:22:07
问题 i'm using spring security and AspectJ to log application's behavior. I need to capture a successful login and log it. My spring security configuration: <security:http auto-config="true" authentication-manager-ref="authenticationManager" use-expressions="true"> <security:intercept-url pattern="/login" access="permitAll"/> <security:intercept-url pattern="/loginFailed" access="permitAll"/> <security:intercept-url pattern="/viewUserAccounts" access="hasRole('ROLE_ANTANI')" /> <security:intercept

iajc fails to weave aspects from a jar but succeedes from class files

牧云@^-^@ 提交于 2020-01-14 03:13:30
问题 So I defined iajc task for my project that does intertype declarations just fine, then there is a separate jar task that creates a project.jar. Then there is iajc task for junit test target, this task references the project.jar with the goal of weaving its ITDs into test classes like so: <aspectpath> <pathelement path="${dist}/project.jar"/> <fileset dir="${lib.aspect}"> <include name="**/*.jar" /> <include name="**/*.zip" /> </fileset> </aspectpath> That does not work - compiler produces

How can I make sure that aspects generated by Spring roo are woven by a dependent project?

最后都变了- 提交于 2020-01-13 19:13:08
问题 I have a Spring Roo multi module project . I noticed that after including the jar/module containing my domain model in another project, the aspects had not been woven leaving me with domain classes without any usable getters/setters . How can I make sure that aspects generated by Spring roo are woven by the dependent project? EDIT : In order to be able to use Roo's aspects from another project, one needs to include the aspectJ plugin in the dependent project. Note that compile time loading is

Knowing caller class with AspectJ

寵の児 提交于 2020-01-13 11:24:09
问题 I'm trying to imitate Spring's AspectJ @Async support but with a message bus. The issue is I need to know if my Message Bus (RabbitMQ MessageListener) is calling the method or a normal (all others) caller where the method will return instantly. My annotation is called @MQAsync instead of Springs @Async. package com.snaphop.mqueue; import org.apache.log4j.Logger; import com.snaphop.mqueue.MQAsync; public aspect MQAsyncAspect { //pointcut asyncTypeMarkedMethod() : execution(@MQAsync void *(..))

Spring AOP: @annotation(annotation)

南笙酒味 提交于 2020-01-13 08:27:48
问题 I am (of course) trying to maintain a project using many constructs I don't know that well. In the course of attempting to figure out the AOP use within Spring, I came across methods with the following annotation: @Around(value = "@annotation(annotation)") So @Around means we're doing the 'around' version of the method pointcut in AOP, I understand that. I don't know what the other part means. The Spring documentation gives the following: @annotation - limits matching to join points where the

Why does Spring AOP intercept protected methods under certain circumstances?

社会主义新天地 提交于 2020-01-13 02:49:29
问题 I read that Spring AOP cannot intercept private and protected methods but it is intercepting them in a weird way why is that? I have these functions i want to intercept: public String getName(String string) { System.out.println("Name : " + name + string); return name; } protected String getNamesprotected(String string) { System.out.println("Name : " + name + string); return name; } This is my @Aspect code: @Aspect public class Logging { @Before("execution(* com.tutorialspoint.Student.*Name*(.

9000+ 字,彻底征服 Spring AOP ,美滋滋

可紊 提交于 2020-01-12 20:30:11
基本知识 其实, 接触了这么久的 AOP, 我感觉, AOP 给人难以理解的一个关键点是它的概念比较多, 而且坑爹的是, 这些概念经过了中文翻译后, 变得面目全非, 相同的一个术语, 在不同的翻译下, 含义总有着各种莫名其妙的差别. 鉴于此, 我在本章的开头, 着重为为大家介绍一个 Spring AOP 的各项术语的基本含义. 为了术语传达的准确性, 我在接下来的叙述中, 能使用英文术语的地方, 尽量使用英文. 什么是 AOP AOP(Aspect-Oriented Programming), 即 面向切面编程 , 它与 OOP( Object-Oriented Programming, 面向对象编程) 相辅相成, 提供了与 OOP 不同的抽象软件结构的视角. 在 OOP 中, 我们以类(class)作为我们的基本单元, 而 AOP 中的基本单元是 Aspect(切面) 术语 Aspect(切面) aspect 由 pointcount 和 advice 组成, 它既包含了横切逻辑的定义, 也包括了连接点的定义. Spring AOP就是负责实施切面的框架, 它将切面所定义的横切逻辑织入到切面所指定的连接点中. AOP的工作重心在于如何将增强织入目标对象的连接点上, 这里包含两个工作: 如何通过 pointcut 和 advice 定位到特定的 joinpoint 上 如何在

advantage of using applicationcontext.getbean vs @configurable [closed]

北城余情 提交于 2020-01-11 07:45:11
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 8 years ago . what is the advantage of using @configurable compared to on bean that not managed by bean doing di by applicationcontext.getbean ? any

Spring 3.0 / AOP / Aspectj:autoproxy intercept any call to getConnection()

a 夏天 提交于 2020-01-11 06:31:27
问题 I'm trying to intercept any call to getConnection() method to setup the dbms indentifier . I've implemented an aspect to get it but I don't get anything. Any idea? Thanks! import java.sql.CallableStatement; import java.sql.Connection; import javax.servlet.http.HttpSession; import org.aspectj.lang.annotation.AfterReturning; import org.aspectj.lang.annotation.Aspect; import org.springframework.stereotype.Component; import org.springframework.web.context.request.RequestAttributes; import org

Java synchronization and performance in an aspect

核能气质少年 提交于 2020-01-11 03:03:09
问题 I just realized that I need to synchronize a significant amount of data collection code in an aspect but performance is a real concern. If performance degrades too much my tool will be thrown out. I will be writing ints and longs individually and to various arrays, ArrayLists and Maps. There will be multiple threads of an application that will make function calls that will be picked up by my aspect. What kind of things should I look out for that will negatively affect performance? What code