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
8
votes
1 answer

How would I specify a Hibernate "@Pattern" annotation using a regular expression from a .properties file or database

Situation: I would like to perform Hibernate Validation based upon user properties (to allow different validation rules for input based upon a user's account data) - I think it must be possible to use a .properties file to specify a particular…
Code Jockey
  • 6,611
  • 6
  • 33
  • 45
8
votes
2 answers

Spring boot - cannot set default Locale

I am now developing Spring Boot application (only rest controllers). Each request to my server contains language tag. I would like to send response in specific language according to this tag. Controllers extract those tags from request and provide…
Patryk kowalski
  • 313
  • 2
  • 5
  • 18
8
votes
2 answers

Spring Boot + Thymeleaf not finding message properties

I am trying to create a web application using Spring Boot and Thymeleaf and am having trouble getting the template to use the messages defined in a properties file. Instead of the message defined in the properties file, it is instead showing…
SelketDaly
  • 539
  • 1
  • 5
  • 20
8
votes
2 answers

How to store and read SQL queries from properties or yml file in spring boot jdbc repository?

I am using spring boot and spring jdbc template. I want to externalize the SQL queries in either properties or yml file. I dont want to store the SQL queries in the java repositories classes. What is the best way to handle this case? This is how my…
ajm
  • 12,863
  • 58
  • 163
  • 234
8
votes
1 answer

"Address already in use: bind" exception when running Gradle JUnit tests

I'm using Spring Boot 1.2.1.RELEASE, JUnit4, and Gradle 2.1 for a RESTful service and am trying to define a properties file which includes and/or overrides values which will be used in JUnit tests only. All tests execute without an issue when…
ethesx
  • 1,339
  • 5
  • 19
  • 35
8
votes
3 answers

Appending data to properties file, comments disappear & order of data changed

While appending data to properties file, existing comments disappear & order of data is being changed. Please suggest how to avoid it? data in properties file(before appending the data) along with comments is as follows: # Setting the following…
Vikas
  • 669
  • 3
  • 10
  • 21
8
votes
2 answers

How to append new data to existing data in properties file?

I am using following code for writing data to properties file public void WritePropertiesFile(String key, String data) { Properties configProperty = new Properties(); configProperty.setProperty(key, data); File file = new…
Vikas
  • 669
  • 3
  • 10
  • 21
8
votes
5 answers

Include A Properties File With A Jar File

I've written a small application. I've put the database specific information in a properties file. db.url=jdbc:mysql://localhost:3306/librarydb db.user=root db.passwd=pas$w0rd When I build the application to get the executable jar file, the…
Isuru
  • 30,617
  • 60
  • 187
  • 303
8
votes
4 answers

How to configure the log4j output file path in web.xml and log4j.properties?

I have developed a web application where i can register a employee. My web.xml
Thinker
  • 6,820
  • 9
  • 27
  • 54
7
votes
1 answer

Get Maven basedir from a properties file in a SpringBoot project

The Maven project I inherited has some resource files used in JUnits. Those files are referred in a properties file as absolute paths. Let's assume the Maven project is under myproject, where the main pom.xml resides. A config.properties file…
nephewtom
  • 2,941
  • 3
  • 35
  • 49
7
votes
1 answer

Injecting array of values from properties file in spring boot

Ok, so i have a config.properties…
Gewure
  • 1,208
  • 18
  • 31
7
votes
2 answers

How to automatically escape unicode characters in Java property files using Gradle?

I'm translating a Java application by using a ResourceBundle with various *.properties files. Now I like to have a Gradle task or want to modify a task to automatically escape any unicode character by replacing it with its ASCII representation,…
Christian Rädel
  • 581
  • 1
  • 5
  • 13
7
votes
2 answers

is possible have a configuration file in DART?

I have this JavaScript class: 'use strict;' /* global conf */ var properties = { 'PROPERTIES': { 'CHANNEL': 'sport', 'VIEW_ELEMENTS': { 'LOADER_CLASS': '.loader', 'SPLASH_CLASS': '.splash' } …
Andrea Bozza
  • 1,374
  • 2
  • 12
  • 31
7
votes
4 answers

Generate string constants from properties file keys

I'm using .properties files for message internationalization. For example: HELLO_WORLD = Hello World HELLO_UNIVERSE = Hello Universe And then in Java code: String foo = resourceBundle.getString("HELLO_WORLD"); String literals like "HELLO_WORLD"…
imgx64
  • 4,062
  • 5
  • 28
  • 44
7
votes
3 answers

Make IntelliJ aware of a properties file

Is there some way to tell IntelliJ that a particular .properties file will be loaded into a project's environment? We use @PropertySource annotations to load properties files, and in several places load override values from a file determined by an…
Joe Lee-Moyet
  • 1,804
  • 1
  • 20
  • 24