Questions tagged [aspect]

An aspect is a module implemented in an Aspect-Oriented Programming language that contains code for a cross-cutting concern, like logging or security. For questions about the aspect ratio of images, use the aspect-ratio tag.

This tag is for Aspect-Oriented Programming. For questions and answers about the aspect ratio of images, please use the tag.

A feature of a program, like logging, is usually spread throughout a program and is not related to that program's main function. Such a feature is called a cross-cutting concern. The aim of aspect-oriented software development (AOSD) (also called aspect-oriented programming or AOP) is to move a cross-cutting concerns into an aspect. This is called refactoring the code.

In AOSD, aspects are written separately from the main application, which can be written in any standard OOP language. An AOP compiler, like AspectJ, compiles the AOP code and object-oriented programming (OOP) code together in a process called weaving.

AOP is often used to enhance legacy applications or 3rd party libraries when the original source code is not available. It is also used to overcome the main weakness of OOP by collecting the cross-cutting concerns into aspects.

Wikis:

See also:

433 questions
0
votes
0 answers

Spring Aspect Rollback

I use annotation to record the operation log. But now it is rolled back by @Transactional. And I use the @Order annotation but it does not work. Here is the xml transactional config
jack chen
  • 1
  • 1
0
votes
0 answers

Can Lombok or an Aspect add a logger to a lambda using an annotation

I would like to use either an annotation (Lombok) or an aspect to include a logger for all my Java 8 Lambda's and I would like the flexibility of being able to change the logger (Slf4J or other) if I decide I want to do so. I specifically do not…
Beezer
  • 1,084
  • 13
  • 18
0
votes
0 answers

AspectJ java throwing weird errors

I'm trying to implement the observer pattern into my program using AspectJ (not spring) and I tried to write the adding observer method but the compiler seems to complain after(Subject employee, Observer handler):…
Mocktheduck
  • 1,333
  • 1
  • 22
  • 43
0
votes
1 answer

Licence error using TypeLevelAspect (Composite Aspects) in PostSharp Express 4.3

I have PostSharp Express 4.3 and I'm using TypeLevelAspect on a class. When I build, I get this error: License error. MyProject.dll uses non-licensed features (Composite Aspects). Please visit http://www.postsharp.net/purchase to acquire a license…
Neo
  • 4,145
  • 6
  • 53
  • 76
0
votes
1 answer

AspectJ - parse definitions failed - NullPointerException

Here's MVCE https://github.com/yami12376/AspectJ Add VM arguments to Run/Debug configuration of Junit test, in my case: -javaagent:C:\aspectjWeaver\spring-instrument-3.0.4.jar -javaagent:C:\aspectjWeaver\aspectjweaver-1.6.11.jar In my case i added…
Kamil Witkowski
  • 1,978
  • 1
  • 19
  • 33
0
votes
1 answer

Pointcut for methods with a specific annotation that override methods of an interface

Please consider the following setup: public interface IVehicle { public void start() {} public void move() {} public void stop() {} } public class RaceCar implements IVehicle { @Override @Authenticated(Role.Pilot) public void…
João Paiva
  • 1,937
  • 3
  • 19
  • 41
0
votes
1 answer

AspectJ - method @around not called

I want to use AspetcJ to plug in to log4J method that is located in org.apache.log4j.Category.java file. protected void forcedLog(String fqcn, Priority level, Object message, Throwable t) { callAppenders(new LoggingEvent(fqcn, this, level,…
Kamil Witkowski
  • 1,978
  • 1
  • 19
  • 33
0
votes
1 answer

Spring Not Creating Proxy For ServiceListFactoryBean Objects

I'm collecting some SPI implementing instances using ServiceFactoryBean and ServiceListFactoryBean and auto-wiring to my service beans. Now I've created some aspects to intercept these classes to measure performance and log invocations. I notice…
elvorin
  • 1
  • 3
0
votes
1 answer

Group Numerical Values by Ranges with Cut

I've sampled raster ASPECT data which ranges from 0-360 and now I want to group these data into directions (North, South, East, East, etc). I found the cut function and wanted to try using that, but something seems to not be working. For my breaks,…
0
votes
2 answers

What is the difference between Aspects in Java and Macros

I started to be interested in Aspects in Java, however I am having difficulties for understanding the benefits and usage of Aspects. I have used Macros in C++ before. I suppose Aspects are working in a similar way. I mean "Whenever you see X, insert…
Erdi İzgi
  • 1,262
  • 2
  • 15
  • 33
0
votes
2 answers

Spring Boot DeferredResult Aspect makes CPU go sky high

We are using Spring Boot to develop our servies. We chose to do it in an async way and we are faced with the following problem: We have the following aspect on top of all our async rest resources: import org.aspectj.lang.ProceedingJoinPoint; import…
gioni_go
  • 99
  • 1
  • 4
0
votes
1 answer

Android VideoView - maintaining aspect-fill after a screen orientation change

I'm an iOS developer porting an iOS app to Android, so bear with me.I have a VideoView that is acting as a "video background". Everything about it is working correctly - except for in portrait view and on orientation change (to portrait view). In…
Solsma Dev
  • 481
  • 6
  • 22
0
votes
1 answer

Passing arguments to Spring AOP advice causes exception at runtime

I am trying to apply advice on my Spring REST Controllers so I have provided @EnableAspectJAutoProxy in @Configuration and included package of @Aspect annotated class in @ComponentScan. Things are working with following code. @Pointcut("execution(*…
Bilal Mirza
  • 2,576
  • 4
  • 30
  • 57
0
votes
0 answers

Java Annotation Processing

Trying to understand the difference between these 2 approaches MethodSignature signature = (MethodSignature) joinPoint.getSignature(); Abc abc = methodSignature.getMethod().getAnnotation(Abc.class); vs MethodSignature signature =…
Vimal
  • 1
  • 1
0
votes
0 answers

Calculate Android elevation to get Aspect 4:3

Hello i use a card view with 6dp in elevation but in my code when height_4_3 = Functions.GetHeight4_3(parent.getWidth()) holder.parent_image.getLayoutParams().height = height_4_3; holder.parent_image.requestLayout(); and i have a text view with…
pedroooo
  • 563
  • 1
  • 4
  • 17