【发布时间】:2019-03-07 07:26:19
【问题描述】:
我有这样的类和 Spring 上下文。
如何修复这个错误的 Java 配置,而不是 xml?
我尝试了其他帖子中的一些解决方案,但没有成功。
@Service
@Transactional
public class XCalculationService implements VoidService<X> {
}
public interface VoidService<Input> {
}
@AllArgsConstructor
public class XService {
private XCalculationService calculationService;
}
@Configuration
public class ServiceConfiguration {
@Bean
public OrderService orderService(XCalculationService calculationService) {
return new XService(calculationService);
}
@Bean
public XCalculationService calculationService() {
return new XCalculationService ();
}
}
错误
BeanNotOfRequiredTypeException: Bean named 'calculationService' is expected to be of type 'com.x.XCalculationService' but was actually of type 'com.sun.proxy.$Proxy
【问题讨论】:
标签: java spring configuration