I have the following in my app properties
spring:
main:
banner-mode: off
allow-bean-definition-overriding: true
config:
uri: http://localhost:8890
I have this class:
@RefreshScope
@Configuration
@Getter
public class Service {
@Value("${Some Value}")
Boolean val;
}
The problem, is that my app does not grab the configuration from the localhost running configuration server. I can tell you that my local config server is working fine and that the config is visible in a browser
CodePudding user response:
Have you added 'Spring cloud config client' dependency ? And also add some properties in client service to make connection with config server ,
spring.cloud.config.uri=http://localhost:8888(Port of your
server)
spring.cloud.config.name=user-service-ws(properties file
name in your remote)
CodePudding user response:
I have found the solution.
Since spring boot 2.4 everything has changed. We must specify to bootstrap the cloud config. This is done using the dependency such as:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
<version>3.1.4</version>
</dependency>
spring:
main:
banner-mode: off
allow-bean-definition-overriding: true
application:
name: myApp
config:
import: optional:configserver:http://localhost:8890/
cloud:
config:
name: some name
Very important to do this: optional:configserver:
Thanks everyone and hope it is useful to everyone.