I'm building a gradle plugin in which I want to give users the ability to override some properties from an external file. I'm using the Spring propertyPlaceholderConfigurer in order to set a few destinations where users can place their files, This works as expected. My problem is that when running my plugin Spring prints out to the console: "Could not load properties from URL [...]" Does anyone have any idea how I would go about squelching this message?
I've tried overriding logback and sl4j to no avail.
My Spring application-context xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:security="http://www.springframework.org/schema/security"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd"
default-lazy-init="true">
<!-- Activates scanning of @Autowired -->
<context:annotation-config/>
<!-- Activates scanning of @Repository and @Service -->
<context:component-scan base-package="com.example.test"/>
<bean id="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:/conf/plugin.properties</value>
<value>file:${user.home}/conf/plugin.properties</value>
<value>file:${user.home}/conf/plugin-override.properties</value>
</list>
</property>
<property name="placeholderPrefix" value="${"/>
<property name="ignoreResourceNotFound" value="true"/>
<property name="systemPropertiesMode" value="2"/>
</bean>
If you want to implement custom logic to set locations you can extend
PropertyPlaceholderConfigurer
likeand use it like
As far as I understand there are no such files.
Try to add configs below to the
propertyPlaceholderConfigurer
I found that the message was originating in PropertiesLoaderSupport at the loadProperties method:
So what I ended up doing is set the logger level in my gradle task to Error as follows: