Reputation: 310
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
Upvotes: 10
Views: 26717
Reputation: 1
Since the changes keep going on i don't why but none of the above listed method has worked for me might be outdate here is something updated i have figured out.
spring:
application:
name: config-svc
cloud:
config:
server:
native:
search-locations : file:///{{absolutePath}}
label : main
profiles:
active: native
Upvotes: 0
Reputation: 9
Just add these entries to your application.properties
file:
spring.profiles.active=native
server.cloud.config.server.git.uri=file://ClasspathOfYourFile
Upvotes: 0
Reputation: 1
use: spring: profiles: active: native in config-server application.yaml file
Upvotes: 0
Reputation: 71
I had a similar problem, yours decisions are work too. But I had a wish use bootstrap.yml. And this problem was solved by added dependencies as:
implementation 'org.springframework.cloud:spring-cloud-starter-bootstrap:4.0.2'
after added it, I splitted configuration. source: Spring Boot 3.1.5 Spring Cloud
Upvotes: 0
Reputation: 41
I had the same problem, I solved it by renaming the bootstrap.yml
file to application.yml
.
Upvotes: 4
Reputation: 41
I was getting the similar error in my application, here is the fix for the same:
a) Please add @EnableConfigServer annotation in your SpringBootApplication class
@EnableConfigServer
@SpringBootApplication
public class SpringsCloudConfigServerApplication {
--
--
}
b) Add below entries in your application.properties file
spring.profiles.active=native
spring.cloud.config.server.native:searchLocations=file://ClasspathOfYourFile
or
spring.profiles.active=native
server.cloud.config.server.git.uri=file://ClasspathOfYourFile
Upvotes: 4
Reputation: 2177
I had the exact same problem that @Nuradin was having, and the problem was that I had added the spring.cloud.config.server.git.uri property in the wrong file. I needed to add that line to the application.properties files instead of my service.properties file. Here's what my application.properties file now looks like:
spring.application.name=spring-cloud-config-server
server.port=8888
spring.cloud.config.server.git.uri: file://${user.home}/cloud-git-repo
I'm using Spring Tool Suite on Windows 10.
Upvotes: 5
Reputation: 702
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
Upvotes: 12