bean 'spring.sleuth.baggage-keys' already defined - java

I'm in the midst of upgrading an app from Spring Boot 1.x to Spring Boot 2.x. When I attempted to run an existing (and previously working) unit test, I saw the following output:
***************************
APPLICATION FAILED TO START
***************************
Description:
The bean 'spring.sleuth.baggage-keys', defined in class path resource [org/springframework/cloud/sleuth/autoconfig/brave/BraveBaggageConfiguration.class], could not be registered. A bean with that name has already been defined in class path resource [org/springframework/cloud/sleuth/autoconfig/TraceBaggageConfiguration.class] and overriding is disabled.
Action:
Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true
My Gradle project uses the following implementation: 'org.springframework.cloud:spring-cloud-sleuth-core:2.2.8.RELEASE'
I tried checking with the Gradle dependencies task to make sure there were no conflicting versions of spring-cloud-sleuth-core and friends. I also looked at this post and this post and they didn't solve my problem.
I need to avoid overriding beans, and I'm currently constrained to Spring Boot 2.4.x for my deploy target.

Check the compatibility matrix, you should use Spring Cloud 2020.0.x aka Ilford (Sleuth 3.x) with Spring Boot 2.4 (or 2.5).
Sleuth 2.2.8 is Spring Cloud Hoxton, it is not compatible with Boot 2.4.

Related

Spring Boot beans not added to context using Bazel

I have one Spring Boot application that uses Bazel to manage all of its dependencies, that I migrated from Maven.
I'm able to launch the app using Bazel, but after checking all of its beans I noticed that are missing the beans of the classes that I created using the #Component, #Service and #Repository annotations.
If I use Maven, these beans are added to the Application context as expected.
Is something missing in my Bazel configuration? How can I generate and add these beans to my application context?

Spring Boot Properties Migrator

I'm trying to run an application(spring boot v1.5.9.0) with dependency:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-properties-migrator</artifactId>
<scope>runtime</scope>
</dependency>
and getting this error:
org.springframework.boot.SpringApplication - Application startup failed
java.lang.NoClassDefFoundError: org/springframework/boot/context/properties/source/ConfigurationPropertySources
this error, apparently, did not occur before. How do I make the migrator work?
Do I have to change the spring-boot version to 2x before running the migrator?
If so, i don't really get the migrator usage.
As its scope is runtime - I have to make the app run before including it - which means I have to solve all the errors without migrator's advice? What do I use it for afterwards?
You've stated that you're running spring boot v1.5.9.0
It doesn't make sense to run the properties migrator with spring boot 1.5.x. Its primary intention is to "assist" in properties migrations that have changed during migration of spring boot 1.x to spring boot 2.x
As for the error, this specific class is available only since spring boot 2.0. See the comment #since in the sourcefile
In your project, application.properties or application.yml is present or not? Spring boot is auto-configuration. I think those properties will be expecting..Also check what are the annotations used in Spring boot main class..Share that Spring boot main class as well..will check

Skipping because it does not denote a directory

Every time I start my Spring Boot application I receive a warning saying Skipping [/opt/xxx/yyy.war] because it does not denote a directory.
Actually I found that error report on Spring Git Hub, but was on JSP application because it was in development mode, and probably solved on Spring Boot 1.3.3 than you could configure it on application properties.
I updated the Spring Boot, made the configuration setting the parameter server.jsp-servlet.init-parameters.development=false, but not solved.
This cause some performance issue on the system, any ideia?

Creating a Spring Bean for Intellij IDEA

I'm having some issues with using the Spring framework in Intellij. My question will be in reference to this post:
Intellij idea - Spring Bean Configuration File
"Enable Spring plugin in your project and check Spring plugins (Spring Support, Spring MVC, etc)": There is no option to do this
when I view the available plugins in my Intellij
"IntelliJ has a built in plugin for Spring. Go to File > new Project and create your spring project": There is also no available option
for me to create a new Spring project
My primary goal is to create a bean but obviously that isn't an option without the Spring framework working. Can someone walk me through how to get it set up?

Spring 3.0.5 Junit testing issue

I wanted to do spring junit testing to be implemented in my project, I am facing an issue. 1.I wanted a scenario where i can use one spring version jars for junit(src/test) and another spring version of jars for the running main java class(src/main) is it possible. I mean when spring is in testing phase it should use the spring 3.2.4.release and while building the ear it should use 3.0.5.release jars. is it possible.2.since the project is in 3.0.5.release and we wanted to use #WebAppConfiguration for testing which is not allowed in spring 3.0.5.release is there any way to do this (#WebAppConfiguration) in spring 3.0.5.release

Categories