How to prevent embedded netty server from starting with spring-boot-starter-webflux?

Addition to @Brian_Clozel answer:

You can disable Netty (or any other server) by specifying inside an application.yml:

spring.main.web-application-type: none

or application.properties:

spring.main.web-application-type=none

The main issue with your code is that you're currently creating a SpringApplication, then you customize it - to finally drop everything and run the static method run(Object primarySource, String... args).

The following should work:

@SpringBootApplication
public class Client {

    public static void main(String[] args) throws Exception {
        SpringApplication app = new SpringApplication(Client.class);
        app.setWebApplicationType(WebApplicationType.NONE);
        app.run(args);
    }

    @Bean
    public CommandLineRunner myCommandLineRunner() {
      return args -> {
        // we have to block here, since command line runners don't
        // consume reactive types and simply return after the execution
        String result = WebClient.create("http://localhost:8080")
                .post()
                .uri("/fluxService")
                .body("Hallo")
                .accept(MediaType.TEXT_PLAIN)
                .retrieve()
                .bodyToMono(String.class)
                .block();
        // print the result?
      };
    }
}

If not, please run your application using the --debug flag and add to your question the relevant parts of the auto-configuration report, especially the auto-configurations dealing with servers.