Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a good method of persisting application properties?

I have a series of application properties which all have different types.

The types could include, booleans, dates, timestamps, or strings.

I need to be able to provide the ability for administrative users to change these properties and have the system to remember / persist them to a file.

I am looking for a best practice way to store these application properties and be able to persist them on change and load them on start up.

like image 607
JavaRocky Avatar asked Jul 29 '10 01:07

JavaRocky


People also ask

What is application properties used for?

So in a spring boot application, application. properties file is used to write the application-related property into that file. This file contains the different configuration which is required to run the application in a different environment, and each environment will have a different property defined by it.

Where do I put application properties?

Spring Boot Framework comes with a built-in mechanism for application configuration using a file called application. properties. It is located inside the src/main/resources folder, as shown in the following figure.

How do I pass application properties in Spring boot?

Spring Boot application converts the command line properties into Spring Boot Environment properties. Command line properties take precedence over the other property sources. By default, Spring Boot uses the 8080 port number to start the Tomcat. Let us learn how change the port number by using command line properties.


1 Answers

Message from the future: the link is already dead.

Java has a facility built specifically for this purpose - Properties. Here is very good article about it

https://docs.oracle.com/javase/tutorial/essential/environment/properties.html

like image 137
Eugene Ryzhikov Avatar answered Sep 21 '22 05:09

Eugene Ryzhikov