user1917885
user1917885

Reputation:

What does this mean: ${somevalue}

I use this many times in my XML codes:

${some.value}

where some.value may come from

  1. Properties file
  2. System.setProperty("some.value", "any_value");

Example:

In case of spring context,

 <bean id="placeholderConfig"
            class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
            <property name="location" value="classpath:test.properties" />
        </bean>

<bean id="anyID" class="com.my.package.MyClass" >
        <constructor-arg index="0" value="${some.value}" />
    </bean>

And test.properties is,

some.value=any_value

What are they called?

What exactly are them?

Upvotes: 1

Views: 272

Answers (2)

vels4j
vels4j

Reputation: 11298

System Properties :
It is common property file for your machine which maintained by Java in java.lang.System class. Here is the detail document for System Properties.

when you set System.setProperty("some.value", "any_value"); you can access the value of property anywhere in your java program by calling System.getproperty("some.value");

Properties file:

A file that is saved in format of Key & Value pair with new line separator and .properties is the extension of file. Java doc for Properties

Upvotes: 1

Swapnil
Swapnil

Reputation: 8318

Some of the places where you configure such things are XML / property files. Spring calls them property-placeholders. Usually such variables can be loaded at run-time.

Upvotes: 1

Related Questions