Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring cloud, config server can not start, how to config uri for git

I am pretty interested in spring cloud project and now I am testing it, but blocked immediately.

  1. In POM: I added this dependency:
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-config-server</artifactId>
</dependency>
  1. For main application:
@Configuration
@EnableAutoConfiguration
@EnableConfigServer
public class SpringConfigServerApplication {

    public static void main(String[] args) {
        SpringApplication.run(SpringConfigServerApplication.class, args);
    }
}  

So based on the documentation, I just need to add enableConfigServer, then I tried to start it, this is the error:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'environmentRepository' defined in class org.springframework.cloud.config.server.ConfigServerConfiguration$GitRepositoryConfiguration: Invocation of init method failed; nested exception is java.lang.IllegalStateException: You need to configure a uri for the git repository

So, how can I config a uri for git repository? There is nothing mentioned in the documentation.

Thanks for more clarification

like image 225
user3006967 Avatar asked Mar 28 '15 19:03

user3006967


People also ask

How do I connect spring cloud config server to local Git repository?

Right-click on git-localconfig-repo -> Properties -> copy the Location label address and paste it into the application. properties file. Add the annotation @EnableConfigServer in the SpringCloudConfigServerApplication. java file.

What is spring config URI?

Spring Cloud Config provides server and client-side support for externalized configuration in a distributed system. With the Config Server you have a central place to manage external properties for applications across all environments.

Which annotation initializes a spring cloud config server?

Spring Cloud Config Server provides an HTTP resource-based API for external configuration (name-value pairs or equivalent YAML content). The server is embeddable in a Spring Boot application, by using the @EnableConfigServer annotation.


1 Answers

Our example is here. The configuration from application.yml looks like this:

spring:
  cloud:
    config:
      server:
        git:
          uri: https://github.com/spring-cloud-samples/config-repo
like image 152
spencergibb Avatar answered Oct 16 '22 20:10

spencergibb