Bean 引用被 [com.sun.proxy.$Proxy159 类型的不兼容 bean 实例覆盖
Bean reference overridden by non-compatible bean instance of type [com.sun.proxy.$Proxy159]
我是开发 Web 服务的初学者,我有一个具有以下配置的 jaxrs Web 服务:
@Configuration
@ComponentScan("com.example.service")
@ComponentScan("com.example.services")
@ImportResource({
"classpath:/META-INF/cxf/cxf.xml",
"classpath:/META-INF/cxf/cxf-servlet.xml"
})
public class AppConfig {
@Bean(destroyMethod = "shutdown")
public SpringBus cxf() {
return new SpringBus();
}
@Bean
public Server jaxRsServer() {
//Define swagger feature
Swagger2Feature feature = new Swagger2Feature();
//REST Factory with all services,providers and features
JAXRSServerFactoryBean factory = RuntimeDelegate.getInstance().createEndpoint(jaxRsApiApplication(), JAXRSServerFactoryBean.class);
factory.setServiceBeans(Arrays.asList(baseRestService(), materialsRestService(), batchRestService(), billingRestService(), locationRestService(), customerRestService(), equipmentRestService(), projectRestService(), reservationRestService(), waferRestService()));
factory.setAddress(factory.getAddress());
factory.setProviders(Arrays.asList(jsonProvider(), authenticationService()));
factory.getFeatures().add(feature);
return factory.create();
}
@Bean
public JaxRsApiApplication jaxRsApiApplication() {
return new JaxRsApiApplication();
}
@Bean
public JacksonJsonProvider jsonProvider() {
return new JacksonJsonProvider();
}
@Bean
public AuthenticationService authenticationService() {
return new AuthenticationService();
}
**all other beans**
最近我开始收到以下异常:
java.lang.IllegalStateException:@Bean 方法 AppConfig.materialsRestService 作为类型 [com.phoenixbv.rs.MaterialsRestService] 的 bean 引用调用,但被类型 [com.sun.proxy.$Proxy159] 的不兼容 bean 实例覆盖。覆盖在以下声明的同名 bean:com.example.config.AppConfig
如有任何帮助,我将不胜感激!
我能够通过创建服务接口 类 并将接口注入工厂来解决问题。
我是开发 Web 服务的初学者,我有一个具有以下配置的 jaxrs Web 服务:
@Configuration
@ComponentScan("com.example.service")
@ComponentScan("com.example.services")
@ImportResource({
"classpath:/META-INF/cxf/cxf.xml",
"classpath:/META-INF/cxf/cxf-servlet.xml"
})
public class AppConfig {
@Bean(destroyMethod = "shutdown")
public SpringBus cxf() {
return new SpringBus();
}
@Bean
public Server jaxRsServer() {
//Define swagger feature
Swagger2Feature feature = new Swagger2Feature();
//REST Factory with all services,providers and features
JAXRSServerFactoryBean factory = RuntimeDelegate.getInstance().createEndpoint(jaxRsApiApplication(), JAXRSServerFactoryBean.class);
factory.setServiceBeans(Arrays.asList(baseRestService(), materialsRestService(), batchRestService(), billingRestService(), locationRestService(), customerRestService(), equipmentRestService(), projectRestService(), reservationRestService(), waferRestService()));
factory.setAddress(factory.getAddress());
factory.setProviders(Arrays.asList(jsonProvider(), authenticationService()));
factory.getFeatures().add(feature);
return factory.create();
}
@Bean
public JaxRsApiApplication jaxRsApiApplication() {
return new JaxRsApiApplication();
}
@Bean
public JacksonJsonProvider jsonProvider() {
return new JacksonJsonProvider();
}
@Bean
public AuthenticationService authenticationService() {
return new AuthenticationService();
}
**all other beans**
最近我开始收到以下异常: java.lang.IllegalStateException:@Bean 方法 AppConfig.materialsRestService 作为类型 [com.phoenixbv.rs.MaterialsRestService] 的 bean 引用调用,但被类型 [com.sun.proxy.$Proxy159] 的不兼容 bean 实例覆盖。覆盖在以下声明的同名 bean:com.example.config.AppConfig
如有任何帮助,我将不胜感激!
我能够通过创建服务接口 类 并将接口注入工厂来解决问题。