I have generate a standard spring boot sample using command
spring init
The outcome is a plain Java project with a pom like
<?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>org.test</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<start-class>demo.DemoApplication</start-class>
<java.version>1.7</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
When I hit
spring run src/main/java/demo/DemoApplication.java
It kicks me out with an error message such as
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'propertySourceBootstrapConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private java.util.List org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration.propertySourceLocators; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'configServicePropertySource' defined in class org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration$PropertySourceLocatorConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.config.client.ConfigServicePropertySourceLocator]: Factory method 'configServicePropertySource' threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/web/client/HttpServerErrorException
That I cannot explain.
What am I doing wrong?
One of tags on this question is spring-mvc, so I assume your want to use Web Spring features.
To enable Spring web features you need to add this Spring Boot this dependency into POM:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
I haven't use Spring CLI before, therefore I am not familiar why it didn't generate project with Web dependencies. But I would bet you need to explicitly specify somehow that to want to generate web project.
So you probably generated plain Spring Boot project without web dependencies and added some web related configuration into application.properties. Therefore Spring Boot auto configurer is trying to find web dependencies on your classpath.
Even though this already have an answer, this same issue can come up with corrupted maven dependencies. So anyone who could not solve the same issue try deleting the artifacts (or the full local repo) from
c:\Users\<username>\.m2\repository by hand or try running mvn dependency:purge-local-repository
and reload the projects in the IDE.
Related
i am learning to use activiti with spring boot
but i get some errors and searching too much about acitiviti stable version with spring boot and java
i am using java 8 and tomcat 8.0.3
i changed so many version of spring and jdk and checked so many sample and can not find any problem
i only have a controller class and spring main class
when i run the project get this error:
Error creating bean with name 'runtimeServiceBean' defined in class path resource [org/activiti/spring/boot/JpaProcessEngineAutoConfiguration$JpaConfiguration.class]: Unsatisfied dependency expressed through constructor argument with index 0 of type [org.activiti.engine.ProcessEngine]: : Error creating bean with name 'processEngine'defined in class path resource [org/activiti/spring/boot/JpaProcessEngineAutoConfiguration$JpaConfiguration.class]: Unsatisfied dependency expressed through constructor argument with index 0 of type [org.activiti.spring.SpringProcessEngineConfiguration]
this is my RestController and do nothing but an autowire
import org.activiti.engine.RuntimeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;
#RestController
public class MyRestController {
#Autowired
private RuntimeService runtimeService;
}
this is my pom.xml:
<?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>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<activiti.version>5.19.0.2</activiti.version>
</properties>
<dependencies>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-spring-boot-starter-basic</artifactId>
<version>${activiti.version}</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-spring-boot-starter-rest-api</artifactId>
<!--<artifactId>spring-boot-starter-rest-api</artifactId>-->
<version>${activiti.version}</version>
</dependency>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-spring-boot-starter-jpa</artifactId>
<version>${activiti.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
If you want to use Activiti with Spring Boot 2.x we recommend to use the new release of Activiti Core 7 which can be found here: https://search.maven.org/artifact/org.activiti/activiti-spring-boot-starter/7.0.0.SR1/jar
You can find examples here:
https://github.com/activiti/activiti-examples
after so many search i realized that spring boot 2 have problem with activiti then i change spring boot to version 1.5
and then i get new error :
'formDataResource': Unsatisfied dependency expressed through field 'formService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'formServiceBean' defined in class path resource [org/activiti/spring/boot/JpaProcessEngineAutoConfiguration$JpaConfiguration.class]: Unsatisfied dependency expressed through method 'formServiceBean' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'processEngine' defined in class path resource [org/activiti/spring/boot/JpaProcessEngineAutoConfiguration$JpaConfiguration.class]: Unsatisfied dependency expressed through method 'processEngine' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springProcessEngineConfiguration' defined in class path resource [org/activiti/spring/boot/JpaProcessEngineAutoConfiguration$JpaConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.activiti.spring.SpringProcessEngineConfiguration]
and the cause of new error : i dont have any process in src/main/resources/processes/
set some process and delete target folder
it worked for me !
With Spring Boot 2.x you have to add the dependence above, and delete the other one.`
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-spring-boot-starter</artifactId>
<version>7.0.0.SR1</version>
</dependency>`
I am setting up a Springboot(version 2.0.4) project with maven build to use PostgreSQL database. I want to utilize data-source auto configuration feature of Springboot but it is giving me following errors:
Field dataSource in com.praveen.demo.MyController required a bean of type 'javax.sql.DataSource' that could not be found.
Bean method 'dataSource' not loaded because #ConditionalOnClass did not find required class 'org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType'
Bean method 'dataSource' not loaded because #ConditionalOnClass did not find required classes 'javax.transaction.TransactionManager', 'org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType'
In my pom.xml I've dependencies on postgresql and HikariCP as below:
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
</dependency>
Also I've in my application.properties file
spring.datasource.url=jdbc:postgresql://localhost:5432/mydb?user=myself&password=mypassword
In my Java file having #RestController annotation , I am injecting DataSource as below:
#Autowired
private DataSource dataSource;
I am following below artcile: https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-sql.html
I do not want to use JPA. I believe article is not suggesting to use the JPA for auto configuration to work.
I am expecting that Spring boot should auto-configure Data source for the application as I've declared the dependencies and provided the database URL. Still I get errors(as mentioned on top) on starting the application.
Edit-1: I am following below article:
https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-sql.html
Edit-2: Complete POM:
<?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.praveen</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.5.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Although, I am still confused by the documentation provided at https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-sql.html and was expecting that I should not be required to use JPA for auto-configuration to work if I am explicitly declaring a dependency on HikariCP and Postgresql. Closing it for now.
Your pom is fine if you don't want to use JPA.
Define #Bean for Datasource to configure or add property in application.properties spring.datasource.type=com.zaxxer.hikari.HikariDataSource:
#Configuration
public class DbConfig {
#Bean
#ConfigurationProperties("spring.datasource")
public HikariDataSource dataSource() {
return DataSourceBuilder.create().type(HikariDataSource.class).build();
}
}
also change your properties to below:
spring.datasource.url=jdbc:postgresql://localhost:5432/mydb
spring.datasource.username-myself
spring.datasource.password= mypassword
Note: JPA configure for you everything so if not using JPA then you need to configure DataSource by telling about Hikari.
As per reference document 29.1.2 Connection to a Production Database
If you use the spring-boot-starter-jdbc or
spring-boot-starter-data-jpa “starters”, you automatically get a
dependency to HikariCP.
You can bypass that algorithm completely and specify the connection
pool to use by setting the spring.datasource.type property. This is
especially important if you run your application in a Tomcat
container, as tomcat-jdbc is provided by default.
[Tip] Additional connection pools can always be configured manually.
If you define your own DataSource bean, auto-configuration does not
occur.
I've just downloaded STS and started some maven project and it worked properly, but when I start using thymeleaf it doesn't work.
I see an exclamation mark on the project name, and I get this error Error: Could not find or load main class.
I tried adding its dependencies by myself in the POM, I get that error and it goes away once I remove them!
I also tried creating a "Spring Starter Project" and choosing dependencies "Web and Thymeleaf" to be added, right after the project is created I see a syntax error in the POM in the test dependency Failure to transfer org.springframework.boot:spring-boot-starter-test:jar
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
and when I remove it and its class, I get the same error above.
here is my POM now:
<?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>demo-2</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>demo-2</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Try to update your maven repository, try first:
mvn dependency:purge-local-repository
Description:
When run on a project, remove the project dependencies from the local
repository, and optionally re-resolve them. Outside of a project,
remove the manually given dependencies.
and then try:
mvn dependency:copy-dependencies
Description:
Goal that copies the project dependencies from the repository to a
defined location.
It seems to me that your local Maven repository doesn't include the thymeleaf dependecy.
The problem was solved after removing failed downloads:
from CMD:
cd %userprofile%\.m2\repository
for /r %i in (*.lastUpdated) do del %i
then updating the project.
It re-downloaded the dependencies and it worked just fine.
My application has this. It has not hibernate or jpa stuff it yet. I added only in libraries in pom.xml:
#SpringBootApplication
#ComponentScan("com.ma.vegshopping")
public class VegShoppingApplication {
public static void main(String[] args) {
SpringApplication.run(VegShoppingApplication.class, args);
}
}
pom.xml:
<?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.ma</groupId>
<artifactId>VegShopping</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>VegShopping</name>
<description>vegetable shopping list</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-social-facebook</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
When try to start app, I get following exception:
ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Tomcat.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.tomcat.jdbc.pool.DataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).
When u put the JPA hibernate jars are brought into classpath. And when Hibernate is available in classpath Spring Boot AutoConfiguration is picked for Creating the EntityManager.
This is the default behaviour of Spring boot.
Since you dont have any datasource for Hibernate the startup is failing.
Try creating a datasource by giving properties in your application.properties / yml file.
If u dont want to use hibernate or jpa then remove jpa starter from your pom.xml
I have a spring project and try to make it use spring boot and to run at embadded tomcat following :
https://spring.io/guides/gs/rest-service/
This is my Application
//#Configuration
//#EnableAspectJAutoProxy
#SpringBootApplication
#ComponentScan(basePackages = "gux.prome")
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
If I use maven command: mvn spring-boot:run, the project starts fine, but I need to debug , so I run this main method at InteliJ, exception occurs:
Exception in thread "main" java.lang.IllegalArgumentException: Cannot instantiate interface org.springframework.context.ApplicationListener : org.springframework.boot.logging.ClasspathLoggingApplicationListener
at org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:414)
at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:394)
at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:385)
at org.springframework.boot.SpringApplication.initialize(SpringApplication.java:263)
at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:237)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180)
at gux.prome.config.Application.main(Application.java:19)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
Caused by: java.lang.NoClassDefFoundError: org/springframework/context/event/GenericApplicationListener
....
This is the pom:
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>gux</groupId>
<artifactId>prome-data</artifactId>
<version>1.0-SNAPSHOT</version>
<name>prome-data Maven Webapp</name>
<url>http://maven.apache.org</url>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.3.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- guava -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>18.0</version>
</dependency>
<!-- end of guava -->
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.9.2</version>
</dependency>
</dependencies>
<properties>
<java.version>1.7</java.version>
</properties>
<build>
<finalName>prome-data</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!--<plugin>-->
<!-- use java 7 -->
<!--<artifactId> maven-compiler-plugin</artifactId>-->
<!--<version>3.1</version>-->
<!--<configuration>-->
<!--<source> 1.7</source> -->
<!--<target> 1.7</target>-->
<!--</configuration>-->
<!--</plugin>-->
</plugins>
</build>
<!--<repositories>-->
<!--<repository>-->
<!--<id>spring-releases</id>-->
<!--<url>http://repo.spring.io/libs-release</url>-->
<!--</repository>-->
<!--</repositories>-->
<!--<pluginRepositories>-->
<!--<pluginRepository>-->
<!--<id>spring-releases</id>-->
<!--<url>http://repo.spring.io/libs-release</url>-->
<!--</pluginRepository>-->
<!--</pluginRepositories>-->
</project>
This is a symptom of a version mismatch somewhere in your Spring dependencies, but not necessarily just Spring Boot and Spring itself. I had this between my Spring Boot parent:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.5.RELEASE</version>
<relativePath></relativePath>
</parent>
and my Spring Cloud Config dependency:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-client</artifactId>
<version>1.0.4.RELEASE</version>
</dependency>
For some reason, I am not able to define the spring-cloud-config-client dependency without an explicit version declaration.
Updating both to the latest release version (1.3.5.RELEASE and 1.1.1.RELEASE) solved it.
Conclusion
Update your dependencies to the latest correct ones
For ones using Gradle, I solved this issue setting the version of the Spring Boot Gradle Plugin in my library and in my main project to the same value:
plugins {
id("org.springframework.boot") version "2.2.2.RELEASE"
}
i had the same error , i just changed the release version of the spring boot parent and now everything works right