No converter found capable of converting from type #22

Closed
@MicyToy

Description

I have introed mapstruct-spring-extensions and config as the docs told.
mapstruct version is 1.4.2.Final

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <annotationProcessorPaths>
                            <groupId>org.mapstruct.extensions.spring</groupId>
                            <artifactId>mapstruct-spring-extensions</artifactId>
                            <version>${org.mapstruct.extensions.spring.version}</version>
                        </path>
                            <groupId>org.mapstruct</groupId>
                            <artifactId>mapstruct-processor</artifactId>
                            <version>${org.mapstruct.version}</version>
                        </path>
                    </annotationProcessorPaths>
                </configuration>
            </plugin>

and SpringMapperConfig

@MapperConfig(componentModel = "spring", uses = ConversionServiceAdapter.class)
@SpringMapperConfig(conversionServiceAdapterPackage = "com.example.converter")
public interface MapStructSpringConfig {

converter interface (for some reason, changed type name and field name)

@Mapper(uses = ConversionServiceAdapter.class)
    interface CarStructMapper extends Converter<Car, CarDTO> {
        @Mappings({
                @Mapping(target = "seatCount", source = "seat.total"),
                @Mapping(target = "product", source = "model"),
        CarDTO convert(Car source);

used converter adapter in my class as bellow:

@Autowired private ConversionServiceAdapter conversionServiceAdapter; // source is an instance of Car conversionServiceAdapter.mapCarToCarDTO(source)

but I got an exception

No converter found capable of converting from type [com.example.Car] to type [com.example.CarDTO]

What should I do to fix it. Thanks