Note that there are some explanatory texts on larger screens.

plurals
  1. POSpring @Value with multimine properties file value
    text
    copied!<p>Spring (3.1): Given a property file with multi line value (of course the real value is much larger):</p> <pre><code>requestStatuses=select sysdate \ from dual </code></pre> <p>I have set up Spring as described:</p> <pre><code>&lt;util:properties id="sql_lookup_data_repo" location="classpath:sql_lookup_data_repo.properties"/&gt; </code></pre> <p>And used as described:</p> <pre><code> @Value("#{sql_lookup_data_repo.requestStatuses}") public void setRequestStatuses(String requestStatuses) { this.requestStatuses = requestStatuses; } </code></pre> <p>At first sight it seems to be working BUT <strong>only the first line of property value is read</strong>.</p> <p>When spring is starting up it is reading the file correctly (debugged). It seems that it is lost when evaluating SpEL expression.</p> <p><strong>Is it possible to use this spring functionality with multi line property file values and how?</strong></p> <p>Already checked:</p> <ul> <li><a href="https://stackoverflow.com/questions/9259819/how-to-read-values-from-properties-file">How to read values from properties file?</a></li> <li><a href="https://stackoverflow.com/questions/6425795/injecting-properties-using-spring-annoation-value">Injecting Properties using Spring &amp; annotation @Value</a></li> <li><a href="https://stackoverflow.com/questions/317687/how-can-i-inject-a-property-value-into-a-spring-bean-which-was-configured-using">How can I inject a property value into a Spring Bean which was configured using annotations?</a></li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload