How to change the micrometer's version of Spring-boot-actuator 2.3.0 - spring-boot

In our project, we use spring-boot 2.3.0.RELEASE.
Default, spring-boot-actuator is the 2.3.0 and it uses the 1.5.1 micrometer-core.
However, I want it use the 1.9.0 micrometer because I want to use the 1.9.0 micrometer-registry-influx.
I loaded the 1.9.0 micrometer-core in maven ,but it makes no sense.
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-core</artifactId>
<version>1.9.0</version>
</dependency>
Our spring-boot version is not to be allowed to change, so I want to change the micrometer's version in 2.3.0.RELEASE spring-boot-actuator.What should I do next?

You should upgrade Boot so that it will bring in the latest Micrometer.
You can force your build system to resolve 1.9.x but you might need to do it for multiple dependencies (e.g.: micrometer-core, xyz-registry, etc.)

Related

Upgrading Spring boot version to version 3. Problem with javax.cache library

I'm trying to upgrade spring boot from 2.7.x to 3.0.1. The last thing I have left to upgrade is the library.
<dependency>
<groupId>javax.cache</groupId>
<artifactId>cache-api</artifactId>
<version>1.1.1</version>
</dependency>
Have any of you had a similar problem? I didn't see any information on how to do this in the guide.
Remove this dependency and use from spring boot starters.
This is already having Vulnerabilities from dependencies:CVE-2020-15250.MVN REPO CACHE 1.1.1

Spring Kafka error after upgrading spring boot to 2.6.6

I am facing runtime error after I have upgraded spring boot version from 2.4.0 to 2.6.6 (and spring cloud version 2021.0.2). My application consumes messages from a kafka topic and produces it to another kafka topic after some transformation. I am getting below error as soon as the message is consumed.
ERROR ERROR - - - - applog.cls=org.springframework.core.log.LogAccessor,applog.mthd=error,applog.line=149,applog.msg=Stopping container due to an Error,exc.stack=java.lang.NoSuchFieldError: LIFTER\n\tat org.springframework.cloud.sleuth.instrument.reactor.ReactorHooksHelper.getLifterName(ReactorHooksHelper.java:171)\n\tat org.springframework.cloud.sleuth.instrument.reactor.ReactorHooksHelper.isTraceContextPropagator(ReactorHooksHelper.java:175)\n\tat org.springframework.cloud.sleuth.instrument.reactor.ReactorHooksHelper.shouldDecorate(ReactorHooksHelper.java:121)\n\tat reactor.core.publisher.Operators$LiftFunction.apply(Operators.java:2488)\n\tat reactor.core.publisher.Operators$LiftFunction.apply(Operators.java:2449)\n\tat reactor.core.publisher.Flux.onAssembly(Flux.java:9692)\n\tat reactor.core.publisher.Flux.fromIterable(Flux.java:1118)\n\tat com.org.listener.MyListener.listen(MyListener.java:32)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n\tat java.lang.reflect.Method.invoke(Method.java:498)\n\tat org.springframework.messaging.handler.invocation.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:169)\n\tat org.springframework.messaging.handler.invocation.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:119)\n\tat org.springframework.kafka.listener.adapter.HandlerAdapter.invoke(HandlerAdapter.java:56)\n\tat org.springframework.kafka.listener.adapter.MessagingMessageListenerAdapter.invokeHandler(MessagingMessageListenerAdapter.java:339)\n\tat org.springframework.kafka.listener.adapter.BatchMessagingMessageListenerAdapter.invoke(BatchMessagingMessageListenerAdapter.java:180)\n\tat org.springframework.kafka.listener.adapter.BatchMessagingMessageListenerAdapter.onMessage(BatchMessagingMessageListenerAdapter.java:172)\n\tat org.springframework.kafka.listener.adapter.BatchMessagingMessageListenerAdapter.onMessage(BatchMessagingMessageListenerAdapter.java:61)\n\tat org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.doInvokeBatchOnMessage(KafkaMessageListenerContainer.java:2268)\n\tat org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.invokeBatchOnMessageWithRecordsOrList(KafkaMessageListenerContainer.java:2258)\n\tat org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.invokeBatchOnMessage(KafkaMessageListenerContainer.java:2204)\n\tat org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.doInvokeBatchListener(KafkaMessageListenerContainer.java:2114)\n\tat org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.invokeBatchListener(KafkaMessageListenerContainer.java:1997)\n\tat org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.invokeListener(KafkaMessageListenerContainer.java:1976)\n\tat org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.invokeIfHaveRecords(KafkaMessageListenerContainer.java:1364)\n\tat org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.pollAndInvoke(KafkaMessageListenerContainer.java:1355)\n\tat org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.run(KafkaMessageListenerContainer.java:1247)\n\tat java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)\n\tat java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266)\n\tat java.util.concurrent.FutureTask.run(FutureTask.java)\n\tat java.lang.Thread.run(Thread.java:748)\n
I tried checking the reactor-core ReactorHooksHelper.java file, but field LIFTER seems to be present there. Need help to understand why service is giving this error.
Looks like issue with reactor. Which version of reactor-core are you having? For spring-boot version 2.6.6 try using reactor-core version 3.4.16
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-core</artifactId>
<version>3.4.16</version>
</dependency>
You shouldn't specify a version for reactor-core. Spring-boot-dependencies takes care of that for you and would automatically use 3.4.16 of reactor-core. That's the beauty of using Spring Boot.
Check out this POM file
https://search.maven.org/artifact/org.springframework.boot/spring-boot-dependencies/2.6.6/pom
and search for <reactor-bom.version> and notice that the version is 2020.0.17.
After that, find the equivalent reactor-bom file
https://search.maven.org/artifact/io.projectreactor/reactor-bom/2020.0.17/pom
and notice that the version for reactor-core is 3.4.16
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-core</artifactId>
<version>3.4.16</version>
</dependency>

Installing Spring Cloud CLI - which version with Spring boot 2.4.5

I want to install Spring Cloud CLI, but am not clear which version to use.
This Spring cloud page https://spring.io/projects/spring-cloud shows the compatible versions of Spring Cloud with Boot. For example
Release Train
Boot Version
2020.0.x aka Ilford
2.4.x
Hoxton
2.2.x, 2.3.x (Starting with SR5)
I have Spring boot 2.4.5 installed. This implies I should use Spring cloud version 2020.0.x
If I check https://repo.spring.io/release/org/springframework/cloud/spring-cloud/ I do not see a version 2020.0.x
If I use
spring install org.springframework.cloud:spring-cloud-cli:2020.0.1
I get an error "could not find artifact org.springframework.cloud:spring-cloud-cli:jar:2020.0.1 "
If I use
$ spring install org.springframework.cloud:spring-cloud-cli:2.2.0.RELEASE
it appears to install correctly, however I get errors when I try to run commands like
$ spring cloud eureka.
My question is what version of cloud should I install with spring boot v 2.4.5 ?
2020.0.x is the version of the Spring Cloud release train, not of the single modules itself. The release train version can be used, if you use the Spring Cloud BOM to include the dependencies, as described here: https://spring.io/projects/spring-cloud.
This would look similar to this then:
<properties>
<spring.cloud-version>Hoxton.SR8</spring.cloud-version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring.cloud-version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
If you only want to use single modules, then you need to find out, which versions belong to the release train, by either looking in the respective spring-cloud-dependencies POM (https://repo.spring.io/release/org/springframework/cloud/spring-cloud-dependencies/2020.0.2/), or in the release notes, which also contain the module versions: https://spring.io/blog/2021/03/18/spring-cloud-2020-0-2-aka-ilford-is-available
So in your case, the proper version for spring-cloud-cli would be 3.0.2.

How to upgrade Apache POI version in Alfresco 5.2. project?

I have Alfresco 5.2 project with Apache POI version "3.10.1-20151016-alfresco-patched" and I need to update in up to 5.0.0 version.
I have add the section
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>5.0.0</version>
</dependency>
But as I can see the class XWPFTableCell still has an old version: /home/katya3/.m2/repository/org/apache/poi/poi-ooxml/3.10.1-20151016-alfresco-patched/poi-ooxml-3.10.1-20151016-alfresco-patched-sources.jar!/org/apache/poi/xwpf/usermodel/XWPFTableCell.java
Also I can not see the required method setWidth (added in 4.0.0) so the version is still old. Please teach me how to upgrade?
Thank you!
Current Alfresco supported Poi version is 4.1.2. Use this version and do a maven clean and install, it will work.
<dependency.poi.version>4.1.2</dependency.poi.version>

Which spring-test jar version to use with Spring Integration

We are using Spring Integration version 2.2.0.RC2.
When running tests, the following exception is thrown:
java.lang.IncompatibleClassChangeError: org/springframework/core/type/classreading/AnnotationMetadataReadingVisitor
I understand this is because of a clash of Spring jars, likely due to the wrong version in the following maven dependency
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>3.2.2.RELEASE</version>
</dependency>
When using Spring Integration version 2.2.0.RC2, which version of spring-tests should be used? Furthermore, what is the best way to resolve these kind of Maven clashes in future - is there a listing of compatible versions of Spring jars?
Thanks
If you a do a mvn dependency:tree are there any org.springframework:spring-core libraries in there that are not at the expected levels?
Run that and make sure your spring version numbers are ALL consistent. Use dependencyManagement stanzas to ensure they're consistent.
This issue had the same symptoms.
We run a nightly build of SI against Spring 3.2.x; 3.1.3 is simply the minimum supported dep. To use a newer version of Spring, you can <exclude/> the transitive dependencies in your POM.

Resources