用spring aop来配置dubbo,出现异常?
问题描述
希望能够在函数调用的时候,将调用的通知发送到远程进行处理,为了实现这个功能,通过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(); } }
Server
public优艾设计网_平面设计 class Server implements IServer{ @Override public void onBefore() { String tMsg = "Hello AOP";System.out.println(tMsg); } }
精彩评论