Recently I have updated the Spring boot 3.3.1 from Spring boot 2.7.18. Using my application I am trying to fetch some data storeed in AWS but just after updating I am getting below exception.
‘org.springframework.beans.factory.NoSuchBeanDefinitionException: No
qualifying bean of type
‘org.springframework.cloud.config.server.environment.AwsParameterStoreEnvironmentRepositoryFactory’
available: expected at least 1 bean which qualifies as autowire
candidate. Dependency annotations: {}’Description: Parameter 0 of method
awsParameterStoreEnvironmentRepository in
org.springframework.cloud.config.server.config.AwsParameterStoreRepositoryConfiguration
required a bean of type
‘org.springframework.cloud.config.server.environment.AwsParameterStoreEnvironmentRepositoryFactory’
that could not be found. Action: Consider defining a bean of type
‘org.springframework.cloud.config.server.environment.AwsParameterStoreEnvironmentRepositoryFactory’
in your configuration.
I tried below things till now:
tried to create manual bean AwsParameterStoreEnvironmentRepositoryFactory
tried compatible versions of ‘spring-cloud-aws-parameter-store-config dependency
My Pom files is below
<?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.example</groupId>
<artifactId>spring-config-test</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<java.version>17</java.version>
<spring-cloud.version>2023.0.3</spring-cloud.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
</dependency>
<dependency>
<groupId>io.awspring.cloud</groupId>
<artifactId>spring-cloud-aws-parameter-store-config</artifactId>
<version>2.4.4</version>
</dependency>
<dependency>
<groupId>io.awspring.cloud</groupId>
<artifactId>spring-cloud-starter-aws</artifactId>
<version>2.4.4</version>
</dependency>
</dependencies>
<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>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>3.3.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
My application.yml file is below
server:
port : 9002
spring:
application:
name: spring-config-test
profiles:
active: awsparamstore
cloud:
config:
server:
awsparamstore:
region: us-west-2
prefix: /config
profile-separator: _
recursive: true
decrypt-values: true
max-results: 5
cloud:
aws:
stack:
auto: false
region:
static: us-west-2
eureka:
client:
serviceUrl:
defaultZone: http://localhost:9072/eureka
instance:
preferIpAddress: true
mca:
config:
issuer: MCA
subject: MCA
privateKey: /etc/configPrivateKey
My main spring boot application is below:
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.config.server.EnableConfigServer;
@SpringBootApplication
@EnableConfigServer
@EnableDiscoveryClient
public class ConfigMainClass {
public static void main(String[] args) {
SpringApplication.run(ConfigMainClass.class, args);
}
}
whenever I use @EnableConfigServer, get the exception. Not able to identify the issue. Its just small application with main class. I am using Java17 with Spring Boot 3.3.1 and all the latest relevant dependencies.