I'm trying to build an Gateway API using the new Spring Boot Starter Parent 2.4.2 but, for some reason, looks like the spring-cloud-starter-netflix-zuul isn't supported anymore and doesn't work with the new version! Is there any substitute?
From Spring blog:
Zuul 1 and Archaius 1 have both been superseded by later versions that are not backward compatible.
The following Spring Cloud Netflix modules and corresponding starters will be placed into maintenance mode:
spring-cloud-netflix-archaius
spring-cloud-netflix-hystrix-contract
spring-cloud-netflix-hystrix-dashboard
spring-cloud-netflix-hystrix-stream
spring-cloud-netflix-hystrix
spring-cloud-netflix-ribbon
spring-cloud-netflix-turbine-stream
spring-cloud-netflix-turbine
spring-cloud-netflix-zuul
Replacements
We recommend the following as replacements for the functionality provided by these modules.
Current
Replacement
Hystrix
Resilience4j
Hystrix Dashboard / Turbine
Micrometer + Monitoring System
Ribbon
Spring Cloud Loadbalancer
Zuul 1
Spring Cloud Gateway
Archaius 1
Spring Boot external config + Spring Cloud Config
So you'd need to migrate to Spring Cloud Gateway.
Related
Sorry for asking that. I'm not an English speaker, and Stackoverflow is the only website I have access to at my work
I need to use Spring Cloud Sleuth in a project currently in spring boot 2, but who will pass to spring boot 3 in a month?
I was reading the Spring Cloud Sleuth documentation and noticed that:
Spring Cloud Sleuth will not work with Spring Boot 3.x onward. The
last major version of Spring Boot that Sleuth will support is 2.x.
https://docs.spring.io/spring-cloud-sleuth/docs/current-SNAPSHOT/reference/html/index.html
Does this mean that the library is not currently compatible with Spring Boot 3 and there is no plan to make it work, or is work being done to make it compatible?
"My coworkers nor I am familiar with the meaning of "onward" in this context. The word does not translate well in my language."
Spring Cloud Sleuth is not planned to work with Spring Boot 3. You must migrate to Micrometer Tracing. Here you can find a link to the migration guide https://github.com/micrometer-metrics/tracing/wiki/Spring-Cloud-Sleuth-3.1-Migration-Guide
I use spring sleuth in my project and after I updated spring-boot to version 3 I receive the following error:
Consider defining a bean of type 'org.springframework.cloud.sleuth.Tracer' in your configuration.
I inject Tracer in my logging service to get current traceId and spanId. This is the dependency for spring sleuth:
implementation 'org.springframework.cloud:spring-cloud-starter-sleuth:3.1.5'
Is Tracer Bean no longer built in in terms of spring boot v3?
Spring Cloud Sleuth’s last minor version is 3.1. You can check the 3.1.x branch for the latest commits. The core of this project got moved to Micrometer Tracing project and the instrumentations will be moved to Micrometer and all respective projects (no longer all instrumentations will be done in a single repository).
see: https://spring.io/projects/spring-cloud-sleuth
This means that for Boot 3.x you need to use Micrometer Tracing instead of Sleuth.
I am using spring cloud bus to refresh application.properties in the following spring boot applications.
note: I am using rabbitmq as the messaging broker
code snippets below
1.Microservices
photaApiUsers [spring cloud version:2021.0.2, using dependency management for other spring modules],
PhotoAppApiAccountMangement [spring cloud version:2021.0.2, using dependency management for other spring modules]
2.Gateway (ApiGateway)[spring cloud version:2021.0.3-SNAPSHOT, using dependency management for other spring modules]
3.PhotoAppApiConfigServer [spring cloud version:2021.0.2, using dependency management for other spring modules]
downloads application.properties file from github on start up which is used by (1)Microservices and (2)Gateway
4.PhotoAppDiscoveryService [spring cloud version:2021.0.2, using dependency management for other spring modules]
After i invoke the busrefresh api (http://localhost:8012/actuator/busrefresh) in postman, i noticed the
token.secret property in photaApiUsers is updated but not in ApiGateway.
code snippet from UserController where token.secret is properly updated after busrefresh, line 34, env.getProperty("token.secret") has updated value
code snippet from AuthorizationHeaderFilter method (isJwtValid) entry point, inside which i expect token.secret to be updated after busrefresh, line 49
code snippet from AuthorizationHeaderFilter where token.secret is not updated after busrefresh, line 71, env.getProperty("token.secret") has old value
For exporting the metrics (to Prometheus) from the spring boot micro service, we can use the spring boot actuator and one more option is to use the Prometheus JMX exporter(https://github.com/prometheus/jmx_exporter) as a javaAgent when running the service. Though both of the options serve the same purpose, I do see that the JMX exporter is exporting way lot more metrics than the spring boot actuator. I was scouting through some spring boot documentations to see if there is any option to enable more metrics with spring boot actuator, looks like all the JMX metrics are enabled by default. So the questions is, is there a way to expose more metrics from spring boot actuator? Is there any recommendation or comparison study available for both the options mentioned above?
Any help here is greatly appreciated. Thanks!
If you are using Spring boot 2.x, then it works like this:
In Spring Boot 2.0, the in-house metrics were replaced with Micrometer support, so we can expect breaking changes. If our application was using metric services such as GaugeService or CounterService, they will no longer be available.
Instead, we're expected to interact with Micrometer directly. In Spring Boot 2.0, we'll get a bean of type MeterRegistry autoconfigured for us.
for Spring boot 1.x:
The metrics endpoint publishes information about OS and JVM as well as application-level metrics. Once enabled, we get information such as memory, heap, processors, threads, classes loaded, classes unloaded, and thread pools along with some HTTP metrics as well.
and this seems to work like Prometheus JMX
My colleague offers me a openFeign interface which is based in spring Cloud 2.x, i can't inject it in my service as usuall. (my spring cloud version is Edgware.RELEASE, and may be it may be the initiator of this problem),so what can i do to solve this problem?
As #spencergibb has mentioned in his comment, Edgeware is not compatible with Spring Boot 2.x. You will need to use the Finchley release train:
Please read the Release Train section of the Spring Cloud Documentation.