3

I'm having a problem with my Spring Boot application ignoring my ignoreUnresolvablePlaceHolders set to true in my config.xml file.

I have these options explicitly set:

<property name="ignoreUnresolvablePlaceholders" value="true" />
<!-- <property name="localOverride" value="false" /> -->
<property name="ignoreResourceNotFound" value="true" />

It works fine in a Junit but when I run my app as a Spring Boot it throws a Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder on startup.

Everything started to fail when I added Spring Profiles like this:

<beans profile="default,dev">

Any help would be very much appreciated...

Murasame
  • 183
  • 3
  • 13
  • 1
    Maybe this http://www.baeldung.com/properties-with-spring can help you out. And also take a look at this question: http://stackoverflow.com/questions/14224524/how-to-override-spring-3-1-propertysource-to-set-ignoreresourcenotfound-ignor – Kees de Kooter Dec 22 '16 at 12:02

1 Answers1

1

By default if SpringBoot is unable to read the properties file then it will throw error. In case you want it to ignore the unresolvable property sources and not throw any error then set attribute ignoreResourceNotFound to true or set attribute ignoreUnresolvablePlaceHolders to true as below.

@Configuration
@PropertySource(name="unknown",                
                value="classpath:${unresolvable}/unknown.properties",
                ignoreResourceNotFound=true)
public class SpringPropertySourceIgnoreUnresolvableErrorExample {
    //....
}

For more information, you can refer below link https://www.javarticles.com/2016/01/spring-propertysources-annotation-example.html

Costi Muraru
  • 2,065
  • 1
  • 20
  • 25