ServletContextPropertyWroConfigurationFactory dont care about Spring WroProperties configuration

131 views
Skip to first unread message

Ludovic Dussart

unread,
Jun 13, 2014, 7:58:48 AM6/13/14
to wr...@googlegroups.com
Hi all,

I use ConfigurableWroFilter to hot compile my less file. I use spring configuration to do that :

<!-- wro4j configuration -->
<bean id="wroFilter" class="ro.isdc.wro.http.ConfigurableWroFilter">
 <property name="properties" ref="wroProperties"/>
</bean>

<bean id="wroProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<!-- Pas d'exception si une des locations n'est pas trouvée -->
<property name="ignoreResourceNotFound" value="true" />
<property name="locations">
<list>
<!-- Valeurs par défaut (DEV) -->
<value>classpath*:META-INF/conf/wro.properties</value>
<!-- Surcharge des valeurs par défaut (les derniers locations surchargent les premiers)-->
<value>file:${PRODUCT_LOG_HOME:/product}/${APPLICATION_NAME:PROTOMOBILEV2}/conf/wro.properties</value>
</list>
</property>
</bean>

I have two locations for my wro.properties (external and in META-INF, not in WEB-INF)
It's works but i have an error in console for the ServletContextPropertyWroConfigurationFactory :

[FAIL] Cannot read properties file stream from default location: /WEB-INF/wro.properties. Using default configuration. 

How can i declare new location for this filter or prevent this error ? It is a important error ?

Thanks for yours solutions


Alex Objelean

unread,
Jun 13, 2014, 8:08:08 AM6/13/14
to wr...@googlegroups.com
The WroFilter is not very spring friendly, but this can be improved later. 
You can either ignore this error, or extend the WroFilter and override the following method: 

protected ObjectFactory<WroConfiguration> newWroConfigurationFactory(final FilterConfig filterConfig) {
    return new PropertyWroConfigurationFactory(myProperties);
}

The myProperties should be a reference to spring injected properties. 
Another approach is to set the WroConfiguration explicitly using WroFilter#setConfiguration method. In this case, it is your responsibility to create an instance of WroConfiguration.

Cheers,
Alex


--
You received this message because you are subscribed to the Google Groups "wro4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wro4j+un...@googlegroups.com.
To post to this group, send email to wr...@googlegroups.com.
Visit this group at http://groups.google.com/group/wro4j.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages