Spring IOC-Property
What is IOC Scope?
Property
- Variable setting value in spring.
- The Environment role is property source setting and get property value.
Property Priority
- ServletConfig parameter
- ServletContext parameter
- JNDI (java:comp/env)
- JVM system property (-Dkey=”value)
- JVM system environment value
Create properties file like below.
And write annotation ‘@PropertySource(“classpath:/app.properties”)’.
1 |
|
Then can get anywhere for example ‘environment.getProperty(“app.about”)’.
1 |
|
The expected result is like below.
1 | spring |