希望能够在函数调用的时候,将调用的通知发送到远程进行处理,为了实现这个功能,通过spring aop + dubbo进行实现,但是实现的过程中,出现了异常,异常的信息不固定,配置的内容如下:
如果要让配置正常,只需要将aspect的声明提前就好了:
下面是代码:
public class ServerTest { private IServer m_Server; private PointCutObject m_PointcutObject; @Before public void setUp(){ { //start the server ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("server.xml"); context.start(); } { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("client.xml"); context.start(); m_Server = (IServer) context.getBean("server"); m_PointcutObject = (PointCutObject) context.getBean("pointCutObject"); } } @Test public void testDefault(){ //m_Server.onBefore(); } @Test public void testBean(){ m_PointcutObject.test(); } }
public class Server implements IServer{ @Override public void onBefore() { String tMsg = "Hello AOP"; System.out.println(tMsg); } }
付费偷看金额在0.1-10元之间
一周热门 更多>