Spring 和 AOP 的 RMI
RMI with Spring and AOP
我正在尝试使用 RMI 和 AOP 实现 Spring 应用程序。我的服务器组件有问题。如果我想公开的服务接口没有扩展 Remote
并且方法没有抛出 RemoteException
,我收到错误:
UnknownAdviceTypeException: Advice object [org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor@1f90645] is neither a supported subinterface of [org.aopalliance.aop.Advice] nor an [org.springframework.aop.Advisor]
如果接口扩展 Remote
,它可以很好地启动等等。
我的 application.xml
只声明了一个 bean:
<bean id="testService" class="org.springframework.remoting.rmi.RmiServiceExporter">
<property name="serviceName" value="TestService" />
<property name="service" ref="testServiceImpl"/>
<property name="serviceInterface"
value="xxx.service.TestService" />
</bean>
我的接口只有@Transactional
注解,而实现有@Service
注解。
在我的客户端中,我也遇到了错误。在这里我得到一个不唯一的 bean 的错误:found bean testService
and testServiceImpl
。我的 client.xml 看起来像这样:
<bean class="xxx.start.Client">
<property name="testService" ref="testService"/>
</bean>
<bean id="testService" class="org.springframework.remoting.rmi.RmiProxyFactoryBean">
<property name="serviceUrl" value="rmi://localhost:1099/TestService"/>
<property name="serviceInterface" value="xxx.service.TestService"/>
</bean>
我遵循了这个guide,但是出现了上面的错误。如果你能帮助我,我将非常高兴。如果我 运行 我的 JUnit 测试没有 RMI,它工作正常
我发现了它抛出错误的原因。这是因为我将 default-autowiring
设置为 byType
,但 RmiServiceExporter
应该 autowire=no
我正在尝试使用 RMI 和 AOP 实现 Spring 应用程序。我的服务器组件有问题。如果我想公开的服务接口没有扩展 Remote
并且方法没有抛出 RemoteException
,我收到错误:
UnknownAdviceTypeException: Advice object [org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor@1f90645] is neither a supported subinterface of [org.aopalliance.aop.Advice] nor an [org.springframework.aop.Advisor]
如果接口扩展 Remote
,它可以很好地启动等等。
我的 application.xml
只声明了一个 bean:
<bean id="testService" class="org.springframework.remoting.rmi.RmiServiceExporter">
<property name="serviceName" value="TestService" />
<property name="service" ref="testServiceImpl"/>
<property name="serviceInterface"
value="xxx.service.TestService" />
</bean>
我的接口只有@Transactional
注解,而实现有@Service
注解。
在我的客户端中,我也遇到了错误。在这里我得到一个不唯一的 bean 的错误:found bean testService
and testServiceImpl
。我的 client.xml 看起来像这样:
<bean class="xxx.start.Client">
<property name="testService" ref="testService"/>
</bean>
<bean id="testService" class="org.springframework.remoting.rmi.RmiProxyFactoryBean">
<property name="serviceUrl" value="rmi://localhost:1099/TestService"/>
<property name="serviceInterface" value="xxx.service.TestService"/>
</bean>
我遵循了这个guide,但是出现了上面的错误。如果你能帮助我,我将非常高兴。如果我 运行 我的 JUnit 测试没有 RMI,它工作正常
我发现了它抛出错误的原因。这是因为我将 default-autowiring
设置为 byType
,但 RmiServiceExporter
应该 autowire=no