So I created a Spring cloud config server and linked it to local git repository and I was able to access the file, but in the JSON, the location of file is appearing incorrect . I'm not sure what is wrong. Refer below screenshot
Here is my code
Starter file
@EnableConfigServer
@SpringBootApplication
public class SpringCloudConfigurationServerApplication {
public static void main(String[] args) {
SpringApplication.run(SpringCloudConfigurationServerApplication.class, args);
}
}
Application.properties file
spring.application.name=spring-cloud-configuration-server
server.port=8081
spring.cloud.config.server.git.uri=file://G:/GIT
I have tried to change the uri to "file:///G:/GIT" and "G:/GIT" too but the result is same.
Here is where I created my local repository
Project Structure
Here is my POM
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.1</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.springCloudServer</groupId>
<artifactId>spring-cloud-configuration-server</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>spring-cloud-configuration-server</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>11</java.version>
<spring-cloud.version>2020.0.0</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</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>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</repository>
</repositories>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…