Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Cloud git configuration -- placing repository in folder directly containing the classpath?

I want to place the git repository in a folder directly above the classpath during the development stage of an application.

Currently, I have this as my Spring Cloud git URI:

spring.cloud.config.server.git.uri=file://${user.dir}/cloud-configuration-repository

This URI points to a folder directly above the classpath.

I get this error, however, during runtime.

***************************
APPLICATION FAILED TO START
***************************

Description:

Invalid config server configuration.

Action:

If you are using the git profile, you need to set a Git URI in your configuration.  If you are using a native profile and have spring.cloud.config.server.bootstrap=true, you need to use a composite configuration.

Edit: here is the project structure that I wish to have:

Project
├── _.idea
├── src
|   ├── main
|   └── test
├── target
└── cloud-configuration-repository
like image 944
Nuradin Avatar asked Dec 14 '18 21:12

Nuradin


1 Answers

From the documentation:

https://cloud.spring.io/spring-cloud-config/multi/multi__spring_cloud_config_server.html

2.1.3 File System Backend: There is also a “native” profile in the Config Server that does not use Git but loads the config files from the local classpath or file system (any static URL you want to point to with spring.cloud.config.server.native.searchLocations). To use the native profile, launch the Config Server with spring.profiles.active=native.

So, in your case, it would be:

spring.profiles.active=native
spring.cloud.config.server.native:searchLocations=file://${user.dir}/cloud-configuration-repository
like image 79
Pradip Karki Avatar answered Sep 28 '22 01:09

Pradip Karki