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

Skipping method visibility results in point-cutting all methods?

In AspectJ, if you don't specify the method visibility, are all methods "considered"? Example: pointcut timed() : execution(@Timed !static * (@Metrics).*(..)) && this(object); Are all methods (public, private etc.) advised here?
Parobay
  • 2,549
  • 3
  • 24
  • 36
0
votes
1 answer

When i compile aspectj file with axis2 service i found this error.Do anybody know what should i do

This Web axisService has deployment faults Error: java.lang.NoClassDefFoundError: org/aspectj/runtime/internal/AroundClosure at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2427) at…
0
votes
1 answer

Bltoolkit: How to cache values of instance properties

Example of Cache aspect using of Bltoolkit (http://bltoolkit.net/doc/Aspects/CacheAspect.htm) works for one instance only. If I create another instance and call cached method it will return value cached for first instance. To achieve the goal I…
Budda
  • 18,015
  • 33
  • 124
  • 206
0
votes
1 answer

postsharp 3 introduce/remove constructor aspect

I'm evaluating Postsharp 3.0 and would like to know if there is a way to introduce and/or remove constructors. The use case is to remove all public parameterless constructors, and introduce a private paramterless one. Thanks in advance, Kavan
0
votes
1 answer

Is there any way not to execute a line in a method using spring AOP?

Scenario : I have an application where we noticed some unnecessary logging due to which the memory usage on that server goes upto 90% which is not desirable at all and a concern for the prod support . The culprit is a class where I have bunch of…
GKP
  • 1,057
  • 1
  • 11
  • 24
0
votes
1 answer

Expected Declaration Specifiers Error?

I'm working in AOP, using AspeCt in an Ubuntu virtual box. My .acc code: before (): execution(int main(void)) { printf("Before test successful!\n"); } after (): execution(int main(void)) { printf("world!\n"); } before(): call(foo)…
0
votes
1 answer

aspectj: How to weave aspects from a library into user code?

I have a library with some classes and a few aspects in it. Say AspectedLib.jar is the file that contains such definitions (created in eclipse, with "export jar file with aspectj support"). If I import the AspectedLib.jar file, and even use some of…
Eduardo Bezerra
  • 1,923
  • 1
  • 17
  • 32
0
votes
1 answer

Alternative to Spring's @Configurable for performance reasons?

I am using @Configurable beans for non-managed spring instances in a section of code that must be highly performant. We are using a lot of non-managed beans with the new operator, and in our profiling we have noticed that the use of the…
ant-depalma
  • 2,006
  • 4
  • 26
  • 34
0
votes
1 answer

"Manual" weaving of bean using @EnableAspectJAutoProxy found aspects

I am using a fully no-XML Spring setup, and I am successfully using @EnableAspectJAutoProxy with my @Configuration class and finding my aspect classes with a combination of @Aspect and @Component. But I have come to a point where I need to on-demand…
Stmated
  • 477
  • 5
  • 17
0
votes
0 answers

(C++) AspectC++ intercept methods of derived class

This may be a dumb question, but I couldn't find the answer after searching for hours. Using AspectC++, we can define pointcuts, which represent something that, once matched, is intercepted. For instance, I can do pointcut pc() = call("%…
Eduardo Bezerra
  • 1,923
  • 1
  • 17
  • 32
0
votes
1 answer

AspectJ how to catch a NoResultException and return null instead

I want to use AspectJ to catch a NoResultException and return null instead. (Obviously I'm an Aspect noob) Here's the method that does the querying: @Override public Company getCompanyBySomeNumber(String someNumber) { TypedQuery query…
Johan
  • 74,508
  • 24
  • 191
  • 319
0
votes
1 answer

Spring aspects forward and cancel previous request

Here is my question I want to intercept request before any spring controller call, check and modify request URI. After that it has to call another SPRING controller method. I used mvc:interceptors however I want to configure it with annotations…
Dima
  • 1,045
  • 14
  • 23
0
votes
2 answers

Aspect orientation in C#

I have a FTPDataTransfer-class that has a state (FTPDataTransferState). This class provides a lot of transfer-methods like ReceiveData (overloaded), SendData, ... How can I change the state to Ready, Transfer, ... without chaning the value in every…
Luca Nate Mahler
  • 1,292
  • 2
  • 13
  • 28
0
votes
1 answer

adding extra codes at runtime in java

I am developing a library and I need to add extra codes to some of my methods of my objects at run time. there are two points here. first of all, the program I wanted to add extra code, is written before by some body else, and I don't wanted to edit…
saman
  • 199
  • 4
  • 17
0
votes
0 answers

Weave constructor created Aspects at run time?

Is it possible to define properties of an aspect's pointcut through a constructor and then allow it to weave at run time after an instance has been created? Also is it possible to load/unload/modify specific aspects during run time? I was planning…
AgentRegEdit
  • 1,089
  • 2
  • 16
  • 32
1 2 3
28
29