Declaring an aspect by R4R Team

Declaring an aspect:-
Aspects classes are like any other normal bean and may have methods and fields just like any other class,With the @AspectJ support enabled, any bean defined in your application context with a class that is an @AspectJ aspect  will be automatically detected by Spring and used to configure Spring AOP.except that they will be annotated with @Aspect as follows:
 

package org.r4r.in;

import org.aspectj.lang.annotation.Aspect;

@Aspect

public class LoginAspect {

}

A regular bean definition in the application context, pointing to a bean class that has the @Aspect annotation:

<bean id="loginAspect" class="org.r4r.in.LoginAspect">

<!-- configure properties of aspect here as normal -->

</bean>

Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!