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
Related
There is a SQL script V1.0.0_01__Init_from_ddl.sql in /src/main/resources/db/migration which initializes my database.
-> Running Spring Boot 2.7.6, this migration script is completely executed without any error.
-> Running Spring Boot 3.0.0, it says: No migrations found. Are your locations set up correctly?
I have not changed any properties regarding flyway. My database connection (MariaDB 10.6) is fine.
I have tried to rename the file to V1__Init.sql or V1_0_0__Init.sql (any many more tries) without any success.
Any ideas, what is going wrong?
It was a folder problem:
-> My current folder-structure (file-system) of Spring Boot 2.7.6 project:
../src/main/resources/db/migration/
-> My current folder-structure (file-system) of Spring Boot 3.0.0 project:
../src/main/resources/db.migration/
After setting the folder structure of the Spring Boot 3.0.0 project to the one of the Spring Boot 2.7.7 project, it works well, even with Spring Boot 3.0.0 :)
So, the problem, was not a spring boot migration problem, just a path problem.
I have a client application with a class that uses Specification, therefore I need a spring data jpa dependency. I know that the Boot dependency:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
...throws an error (Failed to configure a Datasource...) at startup if you include the dependency without a Datasource configured. However, I still get the error when I use this dependency (so just Spring, no Boot) when I import my client in a Spring Boot application when the client uses this dependency:
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
</dependency>
Why do I still get this error? I know I can suppress the warning with a property (exclude DataSourceAutoConfiguration) or annotation, but I would prefer not to, and don't really understand why I get this error from Spring. In my understanding, Boot is opiniated throws this error to inform me of missing config, but I thought the vanilla Spring dependency would not do this. I can't find any info on expected behavior on the non-starter dependency, just on the starter dependency.
In spring boot 2.7.3 I didn't find this problem.
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.
We are trying to switch databases for our Spring boot application, in case one fails. We are using hibernate as our ORM. So we found this link Primary/Secondary failover DataSource in Spring Boot, which redirected to Using HA-JDBC with Spring Boot.
But when we tried to add the dependency for HA-JDBC, we were getting error like Missing artifact net.sf.ha-jdbc:ha-jdbc:jar:3.0.0-rc-1, this was the location MVNRepository. We tried with all the versions but the error is same. We tried cleaning the project and updating the project but the error is still there.
This is the dependency
<!-- https://mvnrepository.com/artifact/net.sf.ha-jdbc/ha-jdbc -->
<dependency>
<groupId>net.sf.ha-jdbc</groupId>
<artifactId>ha-jdbc</artifactId>
<version>3.0.0-rc-1</version>
</dependency>
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