properties-file

How to edit a .property file in powershell

隐身守侯 提交于 2019-12-10 22:54:45
问题 I have a application.properties file in following format application.name=some thing application.version=4.1.0.1 application.list=abc.def, ghi.jkl Now my task is to append mno.pqr to application.list I am able to read it using $AppProps = convertfrom-stringdata (get-content .\application.properties -raw) I changed the Application.list value in $AppProps . How to save it back to original Application.properties file..? 回答1: You can try the following: $AppProps.GetEnumerator() | % { "$($_.Name)=

Injecting array of values from properties file in spring boot

独自空忆成欢 提交于 2019-12-10 15:07:09
问题 Ok, so i have a config.properties ..: market.curpairs[0].name=EuroDollar market.curpairs[0].symbol=EURUSD market.curpairs[0].minamount=0.1 market.curpairs[1].name=EuroFranken market.curpairs[1].symbol=EURCHF market.curpairs[1].minamount=0.1 market.currs[0].name=Euro market.currs[0].symbol=EUR market.currs[0].minamount=1.0 market.currs[0].withfee=0.1 market.currs[1].name=Dollar market.currs[1].symbol=USD market.currs[1].minamount=1.0 market.currs[1].withfee=0.1 market.currs[2].name=Franken

Is a .properties-file suitable for storing hierarchical settings-objects?

两盒软妹~` 提交于 2019-12-10 11:15:04
问题 I have been tasked with an assignement at work, that needs persistance of client side settings. These settings are represented by a XML-file in the C# version of the framework I am implementing, and it represents objects with an hierarchical structure of up to six levels. Also, the number of objects in the different levels are sometimes arbitrary, like an ArrayList. Object serialization is unfortunately not an option, due to a requirement of being able to edit the file directly. It has been

SpringBoot unknown property in application.properties

一世执手 提交于 2019-12-10 03:03:34
问题 I've generated a Spring Boot web application using Spring Initializr, using embedded Tomcat + Thymeleaf template engine. I put this property in my application.properties default.to.address=nunito.calzada@gmail.com I am using Spring Tool Suite Version: 3.8.4.RELEASE as a development environment, but I got this warning in the Editor 'default.to.address' is an unknown property. Should I put this property in another property file ? 回答1: It's because it's being opened by the STS properties editor

Spring boot yml ResourceBundle file

*爱你&永不变心* 提交于 2019-12-09 02:45:01
问题 I'm using MessageSource of Spring to load errors messages from a .properties file in classpath. My properties respect a certain "template" such as {Object}.{field}.{unrespectedConstraint} Example : userRegistrationDto.password.Size= Le mot de passe doit avoir au minimum 6 caractères. userRegistrationDto.email.ValidEmail= Merci de saisir une addresse mail valide. In case of refactoring (Changing the name of the class for example), I have to change my properties file in several places. Is there

Read common external property file in Java Webapp and java normal app

ⅰ亾dé卋堺 提交于 2019-12-09 02:05:24
问题 I know this question has answered many a time with most useful answer as below, Where to place and how to read configuration resource files in servlet based application? However, We have some special requirement as below, Webapp will be deployed to tomcat. Normal java app in form of .jar will be placed under folder /myapp myappConfig.property file will be placed under /myapp Directory Structure on client machine /myapp /myapp.jar /assests/myappConfig.property /tomcat/webapps/myapp.war

Add properties file to build path of runnable jar

≡放荡痞女 提交于 2019-12-09 01:38:08
问题 is it possible to add to the classpath of a runnable jar file some properties file? I tryed these solutions solutions: running the executable file using the following command: java -cp ../prop_dir/prop1.properties;../prop_dir/prop2.properties -jar MyRunnableJar.jar adding to the MANIFEST FILE (in the Class-Path section) ../prop_dir/prop1.properties ../prop_dir/prop1.properties but none of them works. The architecture of the running dir is the following + + MyRunnableJar.jar + prop_dir/ +

Read a properties file in powershell

余生颓废 提交于 2019-12-08 23:42:21
问题 Let's suppose that I have a file.properties and its content is: app.name=Test App app.version=1.2 ... how can I get the value of app.name? 回答1: You can use ConvertFrom-StringData to convert Key=Value pairs to a hash table: $filedata = @' app.name=Test App app.version=1.2 '@ $filedata | set-content appdata.txt $AppProps = convertfrom-stringdata (get-content ./appdata.txt -raw) $AppProps Name Value ---- ----- app.version 1.2 app.name Test App $AppProps.'app.version' 1.2 回答2: If you are running

Spring Boot - property could not be resolved in xml from application.properties

∥☆過路亽.° 提交于 2019-12-08 17:07:41
问题 I have a spring boot application My @Configuration class loads the xml Configuration using @ImportResource("path/to/xml") , which contains the following line <property name="bla" value="${log.directory}/file.ext" /> Under src/main/resources I have the application.properties file with the following content: log.directory=C:/path/I/Need However when I run It fails to load the property as follows: Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'log.directory' in

Java load properties file correctly

╄→尐↘猪︶ㄣ 提交于 2019-12-08 04:48:36
问题 I have the following project structure: ProjectName/src/java/com/main/Main.java And I have a properties file in the following folder: ProjectName/config/settings.properties Now I tried to load the properties file in the Main.java with: InputStream input = Main.class.getResourceAsStream("/config/settings.properties"); Properties prop = System.getProperties(); prop.load(input); But this does not work. How is it the right way to do it? Edit: I got the following error: Exception in thread "main"