<SpringProperty> is always undefined and default value does not work

Viewed 142

I have springproperty:

<springProperty scope="context" name="logUrl" source="logging.logstashHost" resource="application-unittest.yml"
                    defaultValue="myUrl:39290"/>

in my logback-test.xml

and use it like:

  <appender name="myAppender" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
        <destination>${logUrl}</destination>
        <keepAliveDuration>5 minutes</keepAliveDuration>
        <encoder class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
            <providers>
            </providers>
        </encoder>
    </appender>

However this ${logUrl} is always undefined:

logUrl_IS_UNDEFINED':

Why isnt spring picking up the property? And why isnt defaultValue used? I tried to rename my logback-test.xml to logback-test-spring.xml or logback-spring.xml but my tests arent picking the configuration then.

What is the way to fix it?

0 Answers
Related