I have developed config server using spring.
My Application.java is
@EnableConfigServer
@SpringBootApplication
public class SpringConfigServerApplication {
public static void main(String[] args) {
SpringApplication.run(SpringConfigServerApplication.class, args);
}}
My bootstrap.properties file
#Server port
server.port = 8888
#Git repo location
spring.cloud.config.server.git.uri=file://Users/dineth/Documents/MyProjects/sample-git-sources/config-server-repo
My config-server-client-development.properties file
msg = Hello world - this is from config server – Development environment.
I have tiggered git init, git add and git commit commands to add my file to local git.
But when I run the app and go to http://localhost:8888/client-config/development
It does not show my property value.
// 20200406064430
// http://localhost:8888/client-config/development
{
"name": "client-config",
"profiles": [
"development"
],
"label": null,
"version": "4f989b109d1e6d77c8f44a664b275305ddddf014",
"state": null,
"propertySources": [
]
}
And Application log says:
WARN 2125 --- [nio-8888-exec-2] .c.s.e.MultipleJGitEnvironmentRepository : Could not merge remote for master remote: null
Did I miss anything?
I'm using macOS
Creating Spring Cloud Configuration Server Gradle users can add the below dependency in your build. gradle file. Now, add the @EnableConfigServer annotation in your main Spring Boot application class file. The @EnableConfigServer annotation makes your Spring Boot application act as a Configuration Server.
Config Server is an externalized application configuration service. It is based on the open-source Spring Cloud Config project, which provides a centralized server for delivering external configuration properties to an application and a central source for managing this configuration across deployment environments.
You need to run Config Server using the native profile when pointing your git repo to a local directory, in your case file://Users/dineth/Documents/MyProjects/sample-git-sources/config-server-repo
Just add the following line to the Config Server application.properties:
spring.profiles.active=native
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With