Spring Cloud openFeign 无法创建动态查询参数。它抛出以下异常,因为 SpringMvcContract 试图找到不存在的 RequestParam 值属性。
java.lang.IllegalStateException: RequestParam.value() was empty on parameter 0
@RequestMapping(method = RequestMethod.GET, value = "/orders")
Pageable<Order> searchOrder2(@RequestParam CustomObject customObject);
Run Code Online (Sandbox Code Playgroud)
我尝试使用@QueryMap而不是@RequestParam但@QueryMap不生成查询参数。
顺便说一句,@RequestParam Map<String, Object> params方法参数可以很好地生成动态查询参数。
但我想使用一个自定义对象,其中 feign 客户端可以从对象的属性生成动态查询参数。
spring spring-mvc spring-boot spring-cloud spring-cloud-feign
我想在应用程序的开发阶段将 git 存储库放在类路径正上方的文件夹中。
目前,我将此作为我的 Spring Cloud git URI:
spring.cloud.config.server.git.uri=file://${user.dir}/cloud-configuration-repository
此 URI 指向类路径正上方的文件夹。
但是,在运行时我收到此错误。
***************************
APPLICATION FAILED TO START
***************************
Description:
Invalid config server configuration.
Action:
If you are using the git profile, you need to set a Git URI in your configuration. If you are using a native profile and have spring.cloud.config.server.bootstrap=true, you need to use a composite configuration.
Run Code Online (Sandbox Code Playgroud)
编辑:这是我希望拥有的项目结构:
Project
??? _.idea
??? src
| ??? main
| ??? test
??? target
??? cloud-configuration-repository
Run Code Online (Sandbox Code Playgroud) 我计划使用 spring webflux 将我的微服务从阻塞实现重构为反应式 API。我有几个疑问:
1)是否选择基于注解的控制器或功能路由器?2) 是否支持反应式假装客户端?
请帮忙。
spring microservices spring-cloud spring-cloud-feign spring-webflux
我已将 sleuth 依赖项添加到我的 Spring boot 项目中。尽管存在依赖关系,但在日志中看不到任何跟踪信息。没有编译或运行时错误。
<?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
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>TestProject</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>TestProject</name>
<description>Test Project.</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.1.RELEASE</version>
<relativePath />
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spring-cloud.version>Greenwich.RC2</spring-cloud.version>
</properties>
<repositories>
<repository>
<id>ccp-master</id>
<url>https://maven.teamccp.com/content/groups/master</url>
</repository>
<repository>
<id>spring-release</id>
<url>http://repo.spring.io/libs-release</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestone</id>
<url>http://repo.spring.io/libs-milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>spring-snapshot</id>
<url>http://repo.spring.io/libs-snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jersey</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>
<dependency> …Run Code Online (Sandbox Code Playgroud) @ClassRule
public static WireMockRule wireMockRule = new WireMockRule(9898);
@Test
public void createXmlFile() {
stubFor(get(urlPathEqualTo("/data/racing/"))
.willReturn(aResponse()
.withBody(loadJSONFile("unibet-demo-input.json"))));
}
Run Code Online (Sandbox Code Playgroud)
我不知道这里出了什么问题!
2019-01-16 15:54:05.810 [qtp1929284175-20] INFO ROOT:2341 - RequestHandlerClass from context returned com.github.tomakehurst.wiremock.http.StubRequestHandler. Normalized mapped under returned 'null'
2019-01-16 15:54:05.822 [qtp1929284175-15] INFO __admin:2341 - RequestHandlerClass from context returned com.github.tomakehurst.wiremock.http.AdminRequestHandler. Normalized mapped under returned 'null'
2019-01-16 15:54:05.925 [qtp1929284175-20] ERROR WireMock:40 - Request was not matched as there were no stubs registered:
{
"url" : "/data/racing/",
"absoluteUrl" : "http://localhost:9898/data/racing/",
"method" : "GET",
"clientIp" : "127.0.0.1",
"headers" …Run Code Online (Sandbox Code Playgroud) 我创建了两个 Spring Boot 应用程序,它们都将部署在 Kubernetes 集群中。其中一个应用程序将充当网关,因此使用 Spring Cloud Gateway 作为依赖项。另外我想将服务发现与 Spring Cloud Kubernetes 集成,网关使用服务发现来自动生成相应的路由。但是,当我公开在本地 Minikube 集群中运行的网关应用程序并调用第二个应用程序/服务时,我收到 503 错误并显示以下消息:Unable to find instance for ...-service
目前我已经安装了以下内容:
我创建了一个包含两个子项目(网关和另一个服务)的 Gradle 项目。所有项目都将在本地构建/部署。默认服务帐户具有读取 Kubernetes API 的权限。部署这些服务后,我向外部公开网关服务。在网关服务中,我实现了一些端点,其中
一切似乎都有效,但是当我使用其他服务调用时URI/serviceId,出现 503 错误...
使用以下 Spring Cloud 版本: spring-cloud-starter-kubernetes 1.0.1.RELEASE spring-cloud-starter-gateway 2.1.1.RELEASE
我的演示应用程序可从https://github.com/nmaoez/spring-cloud-gateway-kubernetes 获得,README.md 提供了在本地 Minikube 集群中部署这两种服务的步骤。还显示了所有可用的端点。但有趣的部分是 application.yaml 和网关的应用程序类。
应用程序.yaml:
spring:
application:
name: gateway-service
cloud:
gateway:
discovery:
locator:
enabled: true
lower-case-service-id: true
management:
endpoints: …Run Code Online (Sandbox Code Playgroud) service-discovery spring-boot spring-cloud spring-cloud-gateway spring-cloud-kubernetes
由于 Spring Cloud 团队已经放弃了 Zuul 模块的开发,我们正在转向 Spring Cloud Gateway 或 Zuul2,但我相信 Zuul2 需要在架构上进行大量更改,并且需要在微服务中进行较大更改(如果我错了,请纠正我),可以任何人都在 zuul2 或 Spring-Cloud-Gateway 上给出了推荐,有没有人或您知道使用 Spring-Cloud-Gateway 的技术领域的任何大玩家?
我们在 Istio 中使用 Opentracing/Jaeger 来跟踪多个基于 Spring Boot/Spring Cloud 的微服务。
我目前想知道是否有一个选项可以通过提供有关已执行查询(即 SQL 语句)的信息来丰富跟踪范围?使用opentracing-contrib/java-spring-cloud跟踪 JDBC 连接信息工作正常,但缺少附加信息。
我知道,例如,glowroot能够跟踪语句本身,但没有找到与 Opentracing 或 Jaeger 相关的任何内容。
如果有人可以展示一些研究方向,那就太好了!
我想将我的项目 Zipkin 设置更新为 Spring Boot 2.2.2.RELEASE 和 Spring Cloud Hoxton.RELEASE,但看起来简单的 jars 更新是不够的。
我认为旧的设置(它对 Spring Boot 2.1.5.RELEASE 和 Greenwich.SR2 工作正常)也适用于 Boot 2.2.2.RELEASE 和 Hoxton.RELEASE,但似乎我仍然错过了一些东西。
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.2.RELEASE</version>
<relativePath/>
</parent>
<properties>
...
<spring-cloud.version>Hoxton.RELEASE</spring-cloud.version>
<!-- <zipkin.version>2.12.9</zipkin.version> does not work either-->
<zipkin.version>2.11.8</zipkin.version>
...
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zipkin</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-server</artifactId>
<version>${zipkin.version}</version>
</dependency>
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-autoconfigure-ui</artifactId>
<version>${zipkin.version}</version>
<scope>runtime</scope>
</dependency>
...
</dependencies>
Run Code Online (Sandbox Code Playgroud)
我收到以下异常(java.lang.NoClassDefFoundError: zipkin2 /internal/Buffer$Writer):
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name …Run Code Online (Sandbox Code Playgroud) 我有多个 Spring Boot 应用程序使用 kafka 代理实现 Spring Cloud 流。我想知道是否可以停止或禁用 Spring Cloud 流或 kafka 代理连接以启用应用程序。
spring-cloud ×10
spring-boot ×6
spring ×5
java ×3
apache-kafka ×1
cloud ×1
git ×1
jaeger ×1
opentracing ×1
spring-mvc ×1
wiremock ×1
zipkin ×1