There is a bean (mvcConversionService) in the context of the application that meets all the conditions, but the AutoConfiguration does not work.

log

   SpringWebConverterAutoConfiguration:
      Did not match:
         - @ConditionalOnBean (types: org.springframework.core.convert.converter.ConverterRegistry,org.springframework.core.convert.ConversionService; SearchStrategy: all) did not find any beans of type org.springframework.core.convert.converter.ConverterRegistry, org.springframework.core.convert.ConversionService (OnBeanCondition)
      Matched:
         - @ConditionalOnBean (types: org.springframework.core.convert.converter.ConverterRegistry,org.springframework.core.convert.ConversionService; SearchStrategy: all) found bean 'mvcConversionService' (OnBeanCondition)

AutoConfigurationCode

@ComponentScan("live.lingting.spring.web.converter")
@AutoConfiguration(after = [WebMvcAutoConfiguration::class])
@ConditionalOnBean(ConverterRegistry::class, ConversionService::class)
open class SpringWebConverterAutoConfiguration(
    service: ConversionService,
    registry: ConverterRegistry,
    converters: MutableList<Converter<*>>
) {
    init {
        Sequence.asc(converters)
        for (converter in converters) {
            registry.addConverter(converter)
            if (converter is AbstractConverter<*>) {
                converter.service = service
            }
        }
    }
}

Comment From: snicoll

You should not be using component scan on an auto-configuration as you have less control over its lifecycle and it won't work correctly if you mix that with conditions. This is probably what's happening here where the bean in question is created after the condition runs.

If that doesn't help and you still want support, please take the time to create a small sample that we can run ourselves rather than code in text. You can attach a zip to this issue or push the code to a separate GitHub repository.

Comment From: lingting

Thanks, I think I should change my code to make him fit my expectations.