F. *_*rov 2 rest spring jax-rs spring-bean
我是开发 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**
Run Code Online (Sandbox Code Playgroud)
最近我开始收到以下异常:java.lang.IllegalStateException:@Bean 方法 AppConfig.materialsRestService 作为 [com.phoenixbv.rs.MaterialsRestService] 类型的 bean 引用调用,但被 [com.sun 类型的不兼容 bean 实例覆盖.proxy.$Proxy159]。覆盖在以下位置声明的同名 bean:com.example.config.AppConfig
我将不胜感激任何帮助 !
| 归档时间: |
|
| 查看次数: |
4133 次 |
| 最近记录: |