Dear, All

 

I was trying to use AspectJ with EJB. My program is very simple, but I have
a little problem.

 

This is my Bean which is very simple

 

@Stateless(mappedName="HelloWorld")

public class MyBean implements MyBeanFacade

{

      @Override

      public String sayHello(String name) {

            return "Hi "+name;

      }

 

}

 

And this is my aspect

public aspect TestAOP {

 

      pointcut insertSurname() : execution(public String
MyBean.sayHello(..));

      

      after() returning(String name) : insertSurname()

      {

            System.out.println(name +" My Surname");

      }

}

 

 

 

And this is my client tester

 

      public static void main(String[] args) throws Exception {

            // TODO Auto-generated method stub

            InitialContext context = new InitialContext();

            MyBeanFacade bean = (MyBeanFacade)context.lookup("HelloWorld");

            System.out.println(bean.sayHello("Toy"));

      }

 

And I packed these classes together and deployed to Glassfish, but when I
invoked the bean. It did show "My Surname". It just showed "Hi Toy" on my
Console. I think it suppose to show "Hi Toy My Surname". Something like
this. Please help me!!!

Kindly Regards,
Noppanit Charassinvichai
=====================================
Application Development & Technology
G-ABLE COMPANY LIMITED
127/27,29-31 Panjathani Tower, Nonsee Rd,
Chongnonsee,Yanawa, Bangkok 10120 Thailand.
Mobile: 081-962-1412
Website: www.g-able.com
E-Mail: [EMAIL PROTECTED] 
====================================

 

 

 

 

_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to