Add boot42-preview module: Spring Boot 4.2.0-M2 vs 4.1.1 forwarded headers, AMQP starters, buildpack cache, RestTemplate removal warnings
Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Gth99spB1CzQmBFofXmU4Z
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package com.ankurm.boot42;
|
||||
|
||||
import java.util.Map;
|
||||
import org.springframework.boot.WebApplicationType;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.web.client.RestClient;
|
||||
|
||||
/** Starts the real application with the given properties on a random port. */
|
||||
final class BootRun {
|
||||
|
||||
private BootRun() {
|
||||
}
|
||||
|
||||
static ConfigurableApplicationContext start(String... props) {
|
||||
return new SpringApplicationBuilder(Boot42PreviewApplication.class)
|
||||
.web(WebApplicationType.SERVLET)
|
||||
.properties(props)
|
||||
.properties("server.port=0", "spring.main.banner-mode=off", "logging.level.root=WARN")
|
||||
.run();
|
||||
}
|
||||
|
||||
static RestClient client(ConfigurableApplicationContext ctx) {
|
||||
Environment env = ctx.getEnvironment();
|
||||
return RestClient.create("http://localhost:" + env.getProperty("local.server.port"));
|
||||
}
|
||||
|
||||
static Map<?, ?> whoAmI(ConfigurableApplicationContext ctx, Map<String, String> headers) {
|
||||
return client(ctx).get().uri("/whoami").headers(h -> headers.forEach(h::add)).retrieve().body(Map.class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user