我正在尝试将以下技术组合在一起的示例项目:
我已经定义了这个映射器:
@Mapper(componentModel = "spring")
public interface SourceToTargetMapper {
SourceToTargetMapper MAPPER = Mappers.getMapper( SourceToTargetMapper.class );
@Mappings({
@Mapping(source = "characteristics", target = "description"),
@Mapping(source = "identifier", target = "id")
})
public Target toTarget(Source source);
}
Run Code Online (Sandbox Code Playgroud)
我遇到的问题是没有生成实现 SourceToTargetMapper 接口的类。
这是我运行单元测试时得到的跟踪:
2017-09-04 00:13:24.726 ERROR 1712 --- [ main] o.s.test.context.TestContextManager : Caught exception while allowing TestExecutionListener [org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@568bf312] to prepare test instance [io.alfredux.demo.MapperTest@5ccbeb64]
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'io.alfredux.demo.MapperTest': Unsatisfied dependency expressed through field 'sourceToTargetMapper'; nested exception is …Run Code Online (Sandbox Code Playgroud)