Questions tagged [properties-file]

A .properties file is either a simple text file or an XML file containing pairs of keys and values. Java and related technologies frequently use .properties files to store configuration information.

Properties files can also be used to store Strings for Internationalization and Localization and error messages.

and related technologies frequently use properties files.

Further Reading:

1316 questions
12
votes
4 answers

Where to put a properties file in Java?

I tried to read a .properties file in Java and have the following code: public final class Config { static { Properties properties = new Properties(); InputStream propertiesStream =…
CSLearner
  • 121
  • 1
  • 1
  • 4
11
votes
2 answers

Accessing properties file in a JSF application programmatically

I am trying to access the i18n properties file I'm using in my JSF application in code. (The idea is to have a page that displays its keys and values as a table actually.) The project is a maven project, and in the src/resources/localization folder,…
ustun
  • 6,941
  • 5
  • 44
  • 57
10
votes
5 answers

springcloud api gateway properties file declaring variables

I have application.yaml in springboot app as below spring: cloud: gateway: routes: - id: pgService uri: http://localhost:2005/ predicates: - Path=/employee/** - id: inMateService uri:…
10
votes
5 answers

How to inject complete propertiesfile in a springbean

I have a properties-file with a lot of values and I do not want to list them in my bean-configuration-file separately. E.g.: ${foo} ${bar} and…
Jan
  • 101
  • 1
  • 1
  • 3
10
votes
5 answers

Reading multiple entity scan packages in spring boot application

I have Spring boot application @SpringBootApplication @EntityScan(basePackages = {"${scan.packages}"}) public class MyApplication { public static void main(String[] args) { SpringApplication.run(MyApplication.class, args); } While…
Elsayed
  • 2,712
  • 7
  • 28
  • 41
10
votes
2 answers

How can I override properties in Quarkus?

I would like to override the properties I have configured in my configuration file in my Quarkus application. How can I accomplish that?
geoand
  • 60,071
  • 24
  • 172
  • 190
10
votes
1 answer

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

I have a spring boot application My @Configuration class loads the xml Configuration using @ImportResource("path/to/xml"), which contains the following line Under src/main/resources I have…
mangusbrother
  • 3,988
  • 11
  • 51
  • 103
10
votes
3 answers

Get the values from the properties file at runtime based on the input - java Spring

I have my colour.roperties file as rose = red lily = white jasmine = pink I need to get the value for colour as String flower = runTimeFlower; @Value("${flower}) String colour; where flower value we will get at runtime. How can I do this in java…
pinky
  • 129
  • 1
  • 1
  • 5
10
votes
2 answers

How to escape special characters in the key of properties file?

I've got a key = value property in the .properties file: give names: (1) code = xxx ... but when I tried to get that key, it threw an error: No message found under code give names: (1) code = xxx I tried escaping the whitespace with \ but it…
user1169474
  • 191
  • 1
  • 1
  • 6
9
votes
2 answers

Hikari - Spring Boot is ignoring hikari properties

I have a Spring Boot 2 application which has two datasources. Both datasources work, however I am unable to change properties such as maximum-pool-size, my changes are not taking effect. I am configuration my two datasources in my…
SheppardDigital
  • 3,165
  • 8
  • 44
  • 74
9
votes
3 answers

How to inject java.nio.file.Path dependency using @ConfigurationProperties

I'm using Spring Boot and have the following Component class: @Component @ConfigurationProperties(prefix="file") public class FileManager { private Path localDirectory; public void setLocalDirectory(File localDirectory) { …
James
  • 2,876
  • 18
  • 72
  • 116
9
votes
2 answers

Spring placeholder doesn't resolve properties in JavaConfig

Currently i have a Spring xml configuration (Spring 4) which load a properties file. context.properties my.app.service = myService my.app.other = ${my.app.service}/sample Spring xml configuration
herau
  • 1,466
  • 2
  • 18
  • 36
9
votes
1 answer

Does java.util.Properties support nested properties?

I'm trying to set up environment-specific properties in a file, customized for each device running the code. I'd like to be able to nest some properties in others, for…
Mar
  • 7,765
  • 9
  • 48
  • 82
9
votes
2 answers

Not getting spanish characters (ú, í )but getting like (ó , Ã) on UI

I declared three locale conversions in three properties files like Strings.properties, Strings_es_ES.properties and Strings_en_GB.properties ( for US, ES and UK) In Strings_es_ES.properties,i declared the strings like below and set the properties…
user3082617
9
votes
6 answers

Python: How to create a dictionary from properties file while omitting comments

I've searched for the answer to this here for awhile and haven't found it, so hope this isn't a dupe. I have a properties file that mostly contains key=value pairs, but also contains #comments. I need to put it in a dictionary so I can grab…
fbonds66
  • 351
  • 1
  • 2
  • 13