I'm trying to build custom springboot webflux application, Creating SpringBoot Application with SpringApplicationBuilder just like following,

val applicationBuilder = SpringApplicationBuilder(
    DefaultResourceLoader(multiClassLoader),
    twoClazz, *escalatedClazzes.toTypedArray()
).apply {
    bannerMode(Banner.Mode.OFF)
    web(WebApplicationType.REACTIVE)
    initializers(ApplicationContextInitializer<ConfigurableApplicationContext> {
        val propertySources = it.environment.propertySources
        println(it.environment::class.java.name)
        propertySources.addLast(BukkitConfigPropertySource(config))
        propertySources.addLast(PropertiesPropertySource("main-yaml", getPrimaryApplicationProperties()))

        val props = Properties()
        props["spigot.plugin"] = name
        propertySources.addLast(PropertiesPropertySource("spring-bukkit", props))

        it as AnnotationConfigApplicationContext
        it.registerBean(SpigotSpringChildPluginData::class.java, Supplier { spigotSpring })
        mainContext = it
    })

    val application = build()

    parentContext = application.run() as AnnotationConfigApplicationContext
}

And in SpringApplication Main class,

@Import(WebFluxAutoConfiguration::class)
@EnableScheduling
@ComponentScan
@Configuration
class MySpringApplication
````

spring-boot-starter-webflux is included in classpath,
i also configured SpringApplicationBuilder.web(WebApplicationType.REACTIVE).

but condition reports

WebFluxAutoConfiguration: Did not match: - not a reactive web application (OnWebApplicationCondition) Matched: - @ConditionalOnClass found required class 'org.springframework.web.reactive.config.WebFluxConfigurer' (OnClassCondition)


Why i'm getting this result?

### What i've tried
- Use `@SpringBootApplication` also evaluates same result
- Comment `DefaultResourceLoader` on SpringApplicationBuilder constructor to use default classloader also same result
- added "spring.main.web-application-type=reactive" on properties also same result

**Comment From: snicoll**

I can't say why the condition is not evaluated based on a somewhat complex arrangement in text. There is something that you're not showing that leads to create the wrong `ApplicationContext` type. You could debug that yourself by looking the actual type of the `ApplicationContext`.

Also please don't import auto-configuration as you're doing to try to force it. Auto-configurations are considered in a well-defined lifecycle of application startup and adding it as user configuration will not work as intended.

If that doesn't help, we need an actual project that we can run, rather than a partial code snippet.


**Comment From: CChuYong**

I found that packaging with shadowJar plugin not merges spring.factories of different spring-boot-starters so my webflux not initialized successfully.
I added following scripts to my project gradle files.
```kotlin
tasks.named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar") {
    mergeServiceFiles()
    append("META-INF/spring.handlers")
    append("META-INF/spring.schemas")
    append("META-INF/spring.tooling")
    transform(com.github.jengelman.gradle.plugins.shadow.transformers.PropertiesFileTransformer::class.java) {
        paths = listOf("META-INF/spring.factories")
        mergeStrategy = "append"
    }
}