java:由于错误元素 java.util.ArrayList 中存在问题,没有为 ProductMapper 创建实现

标签 java spring-boot junit5 mapstruct

我正在尝试在 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/

相关文章:

java - Gradle 无法解析 Spring Boot HATEOAS 依赖项

spring - 如何在 Spring 中使用注释 Autowiring 第 3 方类?

java - 在 JUnit 5 测试方法中提供多个参数

java - 在下拉列表中显示从数据库中选择的数据

Java运行时错误: null pointer exception

java - 使用 spymemcached 和 HashAlgorithm.KETAMA_HASH 时如何处理恢复 memcached 节点

java - JUnit 5 : Accessing index inside ParameterizedTest

java - junit 3 中的类拆解?

java - 如何使用 save 方法更新 Spring Boot 中的元素?

spring-boot - 在 Spring MVC 集成测试中处理我的自定义异常