Home > Mobile >  java system properties vs spring boot application.properties vs maven properties
java system properties vs spring boot application.properties vs maven properties

Time:02-02

Java system properties, properties defined inside application.properties file and properties defined in pom.xml file, are they the same ?

  1. What is different between all of these properties ?

  2. Is it possible to reference one through the other (eg, pass system property from pom.xml file ...)

  3. Are they all part of Java or JEE standard ? which one is ?

CodePudding user response:

Not the same.

Java system properties are pure Java. Part of Java

Maven properties are pom.xml with ‘<properties’>’<property’> tag.

Spring framework properties (application.properties or application.yaml). Standard properties are read by Spring classes, eg spring.data.source.url. Can be accessed in code with @Value

You can get pom properties into application.properties with [email protected]@

CodePudding user response:

Java system properties, properties defined inside the application.properties file, and properties defined in the pom.xml file are not the same.

Java system properties are defined by the operating system and are global to the Java virtual machine (JVM). The application.properties file is a configuration file that contains key-value pairs used by the application. The pom.xml file is part of Apache Maven and contains information about the project and its dependencies.

Yes, it is possible to reference one through the other. For example, a system property can be passed as a parameter to the JVM when starting the application, and the value can be read from the application.properties file.

Java system properties are part of the Java standard. Both the application.properties file and the pom.xml file are not part of the Java or Java Enterprise Edition (JEE) standard, but are commonly used in Java-based applications.

  • Related