Add cloud-2026-upgrade: step-by-step upgrade of the shop to Spring Boot 4.2.0 / Spring Cloud 2026.0.0, with probes
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b4HkWoC7hLzk61vZa8
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.ankurm.upgrade</groupId>
|
||||
<artifactId>probe-openfeign-querymap</artifactId>
|
||||
<version>1.0.0</version>
|
||||
|
||||
<properties>
|
||||
<boot.version>4.2.0</boot.version>
|
||||
<cloud.version>2026.0.0</cloud.version>
|
||||
<maven.compiler.release>21</maven.compiler.release>
|
||||
<maven.compiler.parameters>true</maven.compiler.parameters>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId><artifactId>spring-boot-dependencies</artifactId>
|
||||
<version>${boot.version}</version><type>pom</type><scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-dependencies</artifactId>
|
||||
<version>${cloud.version}</version><type>pom</type><scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-webmvc</artifactId></dependency>
|
||||
<dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-openfeign</artifactId></dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId><artifactId>maven-dependency-plugin</artifactId><version>3.9.0</version>
|
||||
<executions><execution><phase>package</phase><goals><goal>copy-dependencies</goal></goals></execution></executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
package com.ankurm.upgrade;
|
||||
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.cloud.openfeign.SpringQueryMap;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/** Sends a nested object through {@code @SpringQueryMap} to itself and prints the query string that arrived. */
|
||||
@SpringBootApplication
|
||||
@EnableFeignClients
|
||||
public class QueryMapProbeApplication {
|
||||
|
||||
public record Price(Integer min, Integer max) { }
|
||||
public record Filter(String text, Price price, List<String> tags, Map<String, String> attrs) { }
|
||||
|
||||
@FeignClient(name = "search", url = "http://localhost:${server.port}")
|
||||
public interface SearchClient {
|
||||
@GetMapping("/search")
|
||||
String search(@SpringQueryMap Filter filter);
|
||||
}
|
||||
|
||||
@RestController
|
||||
static class Echo {
|
||||
@GetMapping("/search")
|
||||
String search(HttpServletRequest request) {
|
||||
return java.net.URLDecoder.decode(String.valueOf(request.getQueryString()), java.nio.charset.StandardCharsets.UTF_8);
|
||||
}
|
||||
}
|
||||
|
||||
@Bean
|
||||
CommandLineRunner run(SearchClient client) {
|
||||
return args -> {
|
||||
var filter = new Filter("dock", new Price(10, 200), List.of("usb", "hub"), Map.of("colour", "black"));
|
||||
System.out.println("RESULT query string received: " + client.search(filter));
|
||||
};
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.exit(SpringApplication.exit(SpringApplication.run(QueryMapProbeApplication.class, args)));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
server.port: 8095
|
||||
Reference in New Issue
Block a user