Comments (25)
@btiernay That is currently how `application.[properties|yml] is shared across all applications using config server.
from spring-cloud-config.
@dsyer Thanks for the prompt response. I actually got it working just now. So I am not sure the behaviour I am seeing is a bug or its intended (and should be put in doc in that case)
My application.yml now looks like:
server:
port: 8888
spring:
profiles:
active: native
cloud:
config:
server:
native:
search-locations: classpath:config/,classpath:config/global.yml
What is happening currently is that what I put in global.yml is seen across all clients. In the config folder I can put ymls as {application-name}.yml and its seen by that application only.
Even if its not intended I am happy for now and hope it remains same :-)
I am on spring-cloud-config-server v1.1.0.M3 (through spring cloud Brixton M3)
Thanks again!
from spring-cloud-config.
It would be nice to better describe it in the documentation. It is only very short described in brackets in the config under "Environment Repository". Also it should be noted that when a use a file-system backed config server the application.yml/properties needs to be in a seperate folger (/config is default) to work. If you put it in root it is used in the configserver but not shared with the clients.
from spring-cloud-config.
I don't think its too much of a concern, it is just a warning. If you want you might be able to adjust things using Spring Profiles so only certain configuration properties are set.
from spring-cloud-config.
My apologies then. Thats great :)
from spring-cloud-config.
Hi @ssindelar,
I am also trying to achieve what you mentioned in your last comment. By file-system backed config server I assume you mean 'spring.profiles.acive: native'. I want some shared config and some service specific config. As you suggested I created an 'application.yml' under src/main/resources i.e. config folder is at classpath. The client does not picks that up.
from spring-cloud-config.
@shashanksinghal the "native" profile excludes all property sources that occur in the server itself. I suggest you use a local git repository if you need this feature in a local repo.
from spring-cloud-config.
Yeah that would work.
from spring-cloud-config.
@shashanksinghal sorry for the late answer. It put the files outside the jar because inside the jar they don't make sense, because the whole point is that you can edited them on the fly. I also used .properties instead of .yml, maybe there is also a different. {workingdir}/config is not picked up by the normal scan for properties/yml files.
from spring-cloud-config.
Hi I'm aslo in same problem with Brixton.M4 and
spring:
profiles:
active: native
if i create application.yml
in /config folder inside resources in spring config server its not shared and if i use application.properties
it get shared. Is this a bug?
from spring-cloud-config.
It might be a bug if it shares application.properties
(since that should be used by the config server app itself), unless you mean you added it after start up. Can you provide a sample project?
from spring-cloud-config.
i have to add
spring:
application:
name: config-server
profiles:
include: native
cloud:
config:
server:
native:
search-locations: classpath:config/
to make it work even when the config folder is in BuildPath
also i found some odd behaviour like
if i use appplication.properties then the sequence in which properties from {application}.property and common appplication.properties are picked is diifferent if i use yml
also if i use @project.artifactId@
to get value from the mvn in common application.properties then it always shows the value from pom.xml of config server
and if i add @project.artifactId@
to application specific {application}.yml/.property in config server then its value is not calculated
and if i add
logging.file= ${spring.application.name}
to the common application.properties in config server its fails to start with ex Could not resolve placeholder 'spring.application.name' in string value "${spring.application.name}"
sample app is at https://github.com/dinkarthakur/spring-cloud-sample.git
from spring-cloud-config.
Placeholders with "@" are a maven feature (so part of your build). Take those out of the equation and open a new issue if you have some ordering questions.
from spring-cloud-config.
In response to the main topic:
"Add spring-cloud-config-server ability to share common configuration across applications"
Now you can add a general application.yml to share common configuration across applications.
I found the response here:
http://stackoverflow.com/questions/35555232/loading-multiple-properties-with-config-server?answertab=votes#tab-top
I paste the response in case you don't want to follow the link:
You can create a general application.yml in the root folder of SVN.
See the example config repo here: https://github.com/spring-cloud-samples/config-repo
And here is an example consumer https://github.com/spring-cloud-samples/customers-stores/blob/master/rest-microservices-store/src/main/resources/bootstrap.yml
The customer-stores project will read from application.yml and also from stores.yml in the repo.
To confirm, check the /env URL if you have actuator added and you should see two configService entries
from spring-cloud-config.
a really great feature , but I have a question. in application-dev.yml / application-test.yml /application-prod.yml I want to include configurations for the infrastructure so I dont repeat it in each service , things like hosts/usernames/passwords for ( zipkin,eureka,mysql,cassandra,rabbit,redis)
the question here is that I dont want to pull all configurations in that file , i mean some services might use MySQL configs and not Cassandra , is there something out of the box to do it or maybe i have to develop custom PropertySourcesPlaceholderConfigurer to exclude some configs based on custom property in that the service to allow it to filter only the required technology configs required by that service.
from spring-cloud-config.
What is the concern with a client pulling down some configuration it doesnt use?
from spring-cloud-config.
@ryanjbaxter I have a concern that might not be valid, the client (Spring Boot Service) may complain if it found configs for a library that it is not found on the class path.
example : the client found a property for spring.datasource.url and the client doest have any dependency declared in the pom for spring-boot-starter-data-jpa , should I worry about that ?
from spring-cloud-config.
@ryanjbaxter I don't agree with you. Setting properties not required for an application, like DB URLs or URLs to external services which include authentication is a security/privacy issue and not recommended. Why would an application get all connection properties to HR DBs, for instance, just because there may be other "global defaults" I want to share amongst all the applications?
from spring-cloud-config.
Why would the hr db credentials be in the common file?
from spring-cloud-config.
Well, in any case, they are obfuscated.
Currently, we use one single credential for all applications (which of course it's not a good practice, but that's the current situation now).
from spring-cloud-config.
Using the Spring Profiles approach would definitively do the trick, though.
from spring-cloud-config.
ok,well done
from spring-cloud-config.
Observed that, application.yml
configuration not overriden by respective service configuration, if service would need to modify the common properties. Is this expected behaviour?
from spring-cloud-config.
@parameshjava this has been working as designed for quite a long time.
If you can you provide a complete, minimal, verifiable sample that reproduces the problem, please open a new issue. It should be available as a GitHub (or similar) project or attached to the new issue as a zip file.
from spring-cloud-config.
@parameshjava this has been working as designed for quite a long time.
If you can you provide a complete, minimal, verifiable sample that reproduces the problem, please open a new issue. It should be available as a GitHub (or similar) project or attached to the new issue as a zip file.
@spencergibb thanks for your quick reply. Based on the search paths order it overriding the properties. It's working as expected, when placed base/shared configuration files path application-<profile>.yml
is first searchable path.
from spring-cloud-config.
Related Issues (20)
- PropertySources not loading, [] is returned HOT 3
- After updating from 4.0.x to 4.1.2 application asks wrong Spring Profile HOT 1
- cannot open git-upload-pack HOT 5
- Allow detecting application using full path on GIT HOT 7
- Could not locate PropertySource and the resource is not optional, failing HOT 15
- Upgrade AWS SDK packages to 2.18.41 HOT 4
- Property Order is not working in Composite Environment Repositories HOT 5
- Native support for RetryTemplateFactory as it uses reflections to access the field logger of RetryTemplate HOT 4
- Automatically resolve File to base64 encoded value in configuration.
- Sprin cloud config server- I am trying to clone data in linux machine user defined directory instead of linux default system directory /tmp/config-repo- HOT 2
- useDefaultLabel not working to get resources HOT 5
- Override remote resources with local resources HOT 2
- VaultEnvironmentRepositoryFactory is deprecated in its javadoc but it is not annotated with @Deprecated
- When requesting the log4j2-spring.xml configuration file, a 401 error occurs HOT 9
- Getting Config Server 401 error during Spring 3.X update HOT 1
- Multiple labels with JDBC not working HOT 8
- Java 21 SpringBoot 3.2 ---- Spring Cloud Client PropertySources not loading HOT 1
- Support for Targeted Property Refresh in /actuator/refresh Endpoint HOT 1
- Health indicator configuration property is documented incorrectly
- "KeyStoreException: Keystore not specified" when only truststore is configured in config client configuration. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spring-cloud-config.