我正在尝试在 Spring Cloud 项目中创建非常简单的 JUnit 测试:
@SpringBootTest(classes = {ProductMapper.class })
public class TestingWebApplicationTests {
@Test
public void contextLoads() {
}
}
import org.mapstruct.Mapper;
@Mapper(config = BaseMapperConfig.class)
public interface ProductMapper {
ProductDTO toDTO(Product product);
ProductFullDTO toFullDTO(Product product);
Product map(ProductFullDTO productDTO);
ProductFilter toFilter(ProductFilterDTO dto);
}
当我尝试在最新的 Intelij 中运行测试时出现此错误。java: No implementation was created for ProductMapper due to having a problem in the erroneous element java.util.ArrayList. Hint: this often means that some other annotation processor was supposed to process the erroneous element. You can also enable MapStruct verbose mode by setting -Amapstruct.verbose=true as a compilation argument.
你知道我该如何解决这个问题吗?
最佳答案
尝试重新排序您的注释处理器工厂路径,将 lombok 移动到顶部。
关于java:由于错误元素 java.util.ArrayList 中存在问题,没有为 ProductMapper 创建实现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66170469/