我正在使用Spock框架编写规范类。
@ContextConfiguration(classes = [MyServiceImplementation.class])
class MyServiceSpecification extends Specification {
@Autowired
private MyService myServiceImplementation
def " " {
//code
}
}
类MyServiceImplementation
被注解为@Service
。我没有使用XML配置。MyServiceImpl
是接口MyService
的实现。
为什么自动装配的对象myServiceImplementation
为空?
我尝试使用ComponentScan
,但仍然无法工作。