1

I have a config file stored in git repository https://github.com/katya-dovgalets/config.git which has

message.properties

which contains one line

message-service.senderName=Katya

I have a simple project which gets data from the above repository. I have

DemoApplication.java

@SpringBootApplication
@EnableConfigServer
public class DemoApplication {

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

}

application.properties

server.port=8881
spring.cloud.config.server.git.uri=https://github.com/katya-dovgalets/config.git

and

pom.xml

<?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.1.8.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.example</groupId>
    <artifactId>demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>demo</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <java.version>1.8</java.version>
        <spring-cloud.version>Greenwich.SR3</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-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>

</project>

I expect to see something like

senderName: Katya

when I go by http://localhost:8881/message.properties link

annswerg
  • 269
  • 2
  • 7
  • 18
  • are you following some tutorial. because there are many things wrong here. Firstly your properties file should be called application.properties. secondy. You cannot access that using a link like this. – pvpkiran Sep 27 '19 at 08:57
  • @pvpkiran, I try to do as this tutorial says https://o7planning.org/ru/11723/understanding-spring-cloud-config-server-with-example – annswerg Sep 27 '19 at 09:02
  • as far as I know this doesn't work. – pvpkiran Sep 27 '19 at 09:15
  • But this example works If I change my direction in application.properties to this spring.cloud.config.server.git.uri=https://github.com/o7planning/spring-cloud-config-git-repo-example.git I see text as in tutorial – annswerg Sep 27 '19 at 09:20

0 Answers0