Spring cloud config precedence property files - properties

Trying to read about the precedence of loading several properties in Spring cloud config, I am not finding my case to figure it out which is the precedence of properties. My case is the next:
I have the next properties in the spring cloud config application:
application.properties
application-dev.properties
nameOfApplicationXX.properties
nameOfApplicationXX-dev.properties
I am launching the app nameOfApplicationXX with the dev profile. My case is that application-dev.properties has one property and this property is not being overriden by the same property present in nameOfApplication.properties. So, application-dev.properties has preference over nameOfApplicationXX.properties because the first one is specifying a profile?
Which is the precedence of each one? Do you know the docs reference because I am not finding it
Thanks

If I understood your problem correctly then the below is the solution I have found from the Spring Cloud Config document reference:
"If the repository is file-based, the server creates an Environment from application.yml (shared between all clients) and foo.yml (with foo.yml taking precedence). If the YAML files have documents inside them that point to Spring profiles, those are applied with higher precedence (in order of the profiles listed). If there are profile-specific YAML (or properties) files, these are also applied with higher precedence than the defaults. Higher precedence translates to a PropertySource listed earlier in the Environment. (These same rules apply in a standalone Spring Boot application.)"
Spring Cloud Config reference link : Documentation
Note: By seeing the above problem statement I can say that you are using file based profile in Spring cloud Config server. The Spring Cloud Config server will return List of Property Sources for each type as a classpath resource properties.
To override the the default implementation I have implemented the same and reference code is available in gitHub link : Source Code
Not a similar issue but may help you : reference issue
Hope this will help you to fix the above mentioned problem statement.

Related

spring cloud config server with multiple property sources

I have spring cloud config server reading properties from multiple sources (Git and Vault). For a given path, even it finds the resource in Git, it still queries vault and report failure as the resources are not available at both sources. My requirement is to look for a resource and if its found, no need to query the other source. Please suggest if its possible. Thanks

Setting RavenDB license for automated deployment in kubernetes

I am trying to deploy a RavenDB instance on a Kubernetes cluster. The deployment should be fully automated, i.e. there should be no need to access the UI to configure something.
I have found plenty of documentation on how raven in a container can be configured, e.g. with command line args via RAVEN_ARGS, environment variables (e.g. RAVEN_License_Eula_Accepted), or a custom settings.json file in a mounted volume.
I have tried all the options above, and they all work, except when trying to set a license. I have tried to set either License directly as a JSON string or License.Path pointing to a license.json file mounted in a volume. Yet whenever I access the UI after deploying the container, I get a notification telling me I need to set a license.
Can anyone tell me how I can get Raven to use the license I provide via the approaches mentioned above?
Thanks
You need to bootstrap the cluster with some kind of operation for the license to be picked up. For example, create a database or call the /admin/cluster/bootstrap endpoint.

How do I use run-modes with context-aware configurations in AEM

We have a multi-tenancy website. We are trying to use social share components where the url needs to be shared. Since we have a dispatcher configured, we are picking up the domain from a context aware configuration. How do we use different domains for environments based on run-modes
I have tried to use different ca-config folder for each environment but this is not ideal.
Sling context aware configurations don't work on run modes. For your current requirement you should be using Externalizer service which works basis sling maps, request origin and OSGI configs based on what method you choose.
https://helpx.adobe.com/in/experience-manager/6-3/sites/developing/using/externalizer.html
https://helpx.adobe.com/experience-manager/6-4/sites/developing/using/reference-materials/javadoc/com/day/cq/commons/Externalizer.html
You can use Day CQ Link Externalizer which is available in the OSGI configurations, http://localhost:4502/system/console/configMgr.
It is an OSGI service that allows you to programmatic-ally transform a resource path into an external and absolute URL. You can configure this configuration for different run modes
You can also use a 2-step approach. 1st you create a Run-Mode dependent OSGi config. 2nd you use the built-in Override via OSGi configuration.
See here: https://sling.apache.org/documentation/bundles/context-aware-configuration/context-aware-configuration-override.html#override-via-osgi-configuration

Advanced setting not surviving application build - Sitefinity

I'm changing a value in the advanced settings of the CMS, specifically the ProviderTypeName of Blogs -> Providers -> OpenAccessDataProvider
However, when rebuilding the site the setting is reverted to its default.
I believe this is happening because the property is stored in a file, and my build and deployment is overwriting it with whatever is in my repository.
Where is this setting stored in the file structure; or if I'm way off base in my assumption, how do I get this setting to stick?
You right, most probably you overrode configuration changes during the deployment. Most of the time, I am excluding all configuration during website deployments and from VS project.
By default, Sitefinity 10 is using a hybrid mode that stores configuration files on both the file system App_Data/Sitefinity/Configurations and the database in table [sf_xml_config_items]. Documentation: https://docs.sitefinity.com/auto-storage-mode-of-configurations
Also, there is a way to move configurations to database only: https://docs.sitefinity.com/database-storage-of-configurations

Where can I find the arquillian xml configuration documentation?

I've tried to learn the JBoss Arquillian, by following the formal document and got confused about the configuration, the arquillian.xml. Since it is mentioned once here.
Even I also found that there is a specific configuration describes at the container adapters section. It does not cover all elements/properties, e.g. engine and its property list, defaultProtocol, extension and group.
I'm worried and wondered, if there is any further or full explanation for this configuration file or not. Could you please help to shed some light on this configuration?
There's no single page in the Arquillian Reference Guide that contains your answer. This is partly because of the modular and extensible nature of Arquillian - extension can have their own configuration elements and properties.
To start with, the properties for containers are in the Container Adapters Section. Every adapter has it's own page where the container configuration is detailed. For instance, JBoss AS 7 has it's own page for it's container configuration (see the Configuration section on the page), and so do other containers.
Usually, you wouldn't need to configure the protocol yourself, for the values are usually managed by Arquillian, and usually do not require any overrides to be provided via arquillian.xml. But if you need them, they're in the Protocols section and in the child pages.
A group is merely a collection of containers, to used in cases where the container does not support clustering by default. You merely need to list multiple container configurations in a group element, as shown here.
Extension configuration is typically found in the Extensions child-pages.
The defaultProtocol element does not have any page of it's own. It is used to override the protocol specified by a container adapter, for all tests. There are only a few cases where you would need to use this element, most notably when you need to use the Servlet protocol instead of the JMX protocol for JBoss AS 7 (because the Servlet protocol of Arquillian is a more widely used and tested protocol than the JMX one).
A typical use of defaultProtocol would look like:
<defaultProtocol type="Servlet 3.0" />
where the type is the name of the protocol - "Servlet 2.5" and "Servlet 3.0" are valid values. You may also need to add the protocol dependency to your classpath when you change the default protocol of the container.