You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a project that uses Spring Cloud Config Consul. I can't use spring.config.import property (because it doesn't support Spring Retry now). You can view details here: https://github.com/spring-cloud/spring-cloud-consul/issues/703
So I added spring-cloud-starter-bootstrap dependency and it helped if I don't use custom ApplicationContextInitializer.
For example, here's my simplified project:
@SpringBootApplication
@EnableConfigurationProperties(UserProperties.class)
public class ConsulClientApplication {
public static void main(String[] args) {
SpringApplication.run(ConsulClientApplication.class, args);
}
}
@ConfigurationProperties
public class UserProperties {}
public class ConsulData {
private final UserProperties userProperties;
public ConsulData(UserProperties userProperties) {
this.userProperties = userProperties;
}
}
public class GatewayContextInitializer implements ApplicationContextInitializer<GenericApplicationContext> {
@Override
public void initialize(GenericApplicationContext ctx) {
ctx.registerBean(ConsulData.class);
}
}
Without spring-cloud-starter-bootstrap dependency my application starts properly. If I add this dependency then I get an exception: Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'demo.UserProperties' available: expected at least 1 bean which qualifies as autowire candidate.
Please, advise how to resolve this issue.
The text was updated successfully, but these errors were encountered:
I'm afraid this was precisely one of the reasons we made spring.config.import the default. I'm afraid there's no fix or workaround.
Ok, then do you plan to integrate Spring Retry and Spring Config import in Cloud Consul? If so then can you please provide estimates?
I saw that you already provided similar fix for Spring Cloud Config Server.
Hi
I have a project that uses Spring Cloud Config Consul. I can't use spring.config.import property (because it doesn't support Spring Retry now). You can view details here: https://github.com/spring-cloud/spring-cloud-consul/issues/703
So I added spring-cloud-starter-bootstrap dependency and it helped if I don't use custom ApplicationContextInitializer.
For example, here's my simplified project:
And my META-INF/spring.factories:
org.springframework.context.ApplicationContextInitializer=demo.GatewayContextInitializer
Without spring-cloud-starter-bootstrap dependency my application starts properly. If I add this dependency then I get an exception:
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'demo.UserProperties' available: expected at least 1 bean which qualifies as autowire candidate.
Please, advise how to resolve this issue.
The text was updated successfully, but these errors were encountered: