Is it possible to have database properties outside of any property file in Intellij - intellij-idea

I want to ask is it possible to have database properties outside of any property file now I have database properties inside dbconfig.properties but I want to have it be supplied from outside passing as an argument for example.
Is there any suggestion to have this approach.

I would follow the documentation:
24.2 Accessing command line properties:
By default SpringApplication will convert any command line option
arguments (starting with ‘--’, e.g. --server.port=9000) to a property
and add it to the Spring Environment. As mentioned above, command line
properties always take precedence over other property sources.

Related

In jsr352 batch job xml, how to read/inject a environmental variable from system

I have environmental variable called ENV, which holds the DEV,QA OR PROD region as value. When the server.xml loaded it includes the corresponding db configuration using this variable. For ex: db-config-${env.GAH_ENV}.xml
I would like to pass the same value to the batch job xml as a job parameter or properties to any of the class. How Can I do that.
below code snippet not working
<property name="environment" value="${env.GAH_ENV}"/>
The short answer is that using a batch property may not be a good solution and you might consider something else like MicroProfile's #ConfigProperty.
The reason is there's not a built-in way to access environmental variables through JSL substitution. There is also not a convenient way for one artifact to set a property value to be used by a second artifact running later within the job execution.
In the special case that you are starting the job from within the same JVM it will execute, of course, you could pass the env var value as a job parameter.
But in the general case, if you can change the Java code and you don't really need a batch property I would use a MicroProfile Config property instead, injected via #Inject #ConfigProperty.
By doing so you lose the batch-specific substitution precedence, including the override available via job parameters passed with the submit/start. You also give up the ability to use this property in other JSL substitutions (to "compose" its value into other batch properties via other substitutions).
But you at least get a property with its own various levels of precedence/override (e.g. server config, env var, microprofile-config.properties), which is more flexible than just always reading the env var via System.getenv( ).
This is certainly an area to consider for the next version of the (now-Jakarta) Batch spec.

how to separate multiple values which has single key in Property files in Mule

Here is an Example which is to be place in a property file and should get separated otherwise it read it as single string.
Trade&Credit= getTrade&Credit;addTrade&Credit;findTrade&Credit;updateTrade&Credit;addTrade&CreditContact;updateTrade&CreditContact;
To access a property from property file in groovy component, you can use the following.
System.getProperty("propertyKey")
Another way round is, assuming you store the value from the property file in a flow variable named property file, splitting in for each. Just place the below expression in for each, and it will split the value as per separator.
#[org.mule.util.StringUtils.split(flowVars.propertyValue, ';')]
You can use StringTokenizer and groovy component to do this. See the below example

Modeshape configuration - combine XML + programmatic?

I have configured a Modeshape workspace on my dev box using XML, pointing to:
workspaceRootPath="C:/jcr/modeshape/dev/..."
I will deploy to Linux with a workspace mounted on a different volume:
workspaceRootPath="/jcr/modeshape/prod/..."
Is it possible to use an environment variable to configure this or do I need to resort to programmatic configuration? Is there an approach recommended by the Modeshape team?
Thanks
If you're using later versions of ModeShape, you can use a variable in the configuration file that will be replaced at configuration load time with the value of the System property of the same name. For example, if you use the following:
workspaceRootPath="${myWorkspaceDirectory}"
and have a System property "myWorkspaceDirectory" set to "/foo/bar", then when ModeShape loads the configuration it will resolve the variable into the equivalent:
workspaceRootPath="/foo/bar"
Of course, the variable can be just a part of the attribute value, and you can even use multiple variables (as long as they're not nested). For example, this is valid, too:
workspaceRootPath="${my.system.root.path}/modeshape/${my.system.deploymentType}"
Finally, the grammar of each variable is:
"${" systemPropName { "," systemPropName } [ ":" defaultValue ] "}"
This allows 1 or more System property names and an optional default value to be specified within a single variable. The System property names are evaluated from left to right, and the first to have a corresponding real system property will be used. Here's another contrived example:
workspaceRootPath="${my.system.path1,my.system.path2,my.system.path3:/default/path}/modeshape/${my.system.deploymentType}"

gtk3 get settings value from GtkSettings

I want to programmatically retrieve the value of the word wrap setting for GEdit3 from inside a Python plugin.
The GtkSettings class provides a method to set a string property, but how does one retrieve the value of a string property? I see no "getter" method.
I have also consulted pydoc gi.repository.Gtk.Settings - the methods listed there are the same as the online docs.
I am able to retrieve the property value of interest with the gsettings CLI utility. The command gsettings get org.gnome.gedit.preferences.editor wrap-mode
yields the value 'word'. I was hoping not to have to use subprocess.Popen() just to retrieve this property, however.
This will work
from gi.repository import Gio
a = Gio.Settings('org.gnome.gedit.preferences.editor')
a.get_string('wrap-mode')
Since you're using automatic generated bindings, C code samples will work just fine for you, it is just about changing the syntax.

Specifying multiple MergeSection values when using LINK task on MSBuild

Is there anyway to specify more than one MergeSection value for the MSBuild LINK task? (The MergeSection param is the same as the /merge param for link.exe)
http://msdn.microsoft.com/en-us/library/ee862471.aspx
When calling link.exe you can specify more than one /merge value, but that doesn't seem possible with the MergeSection parameter.
So far the only way I can see to make this work is by using the AddtionalOptions param, but I'm hoping there's a better way to implement this parameter.
Thanks
I think you may have to use AdditionalOptions.
In the Link task the MergeSections property is a string value, not an array, so you can only set one string. Link.exe does not seem to allow you to pass multiple pairs in one command line parameter, you must specify a separate MERGE command line parameter for each pair. The Visual Studio property page only allows a single string for the MergeSections property.