We have a project that is using Tiles 2.1.4 & Spring 3.2.8 and I am trying to upgrade it to Tiles 2.2.2 & Spring 4.3.1. The code used for configuring Tiles is like this:
import org.apache.tiles.TilesException;
import org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO;
import org.apache.tiles.renderer.impl.BasicRendererFactory;
import org.springframework.web.servlet.view.tiles2.TilesConfigurer;
import java.util.Properties;
public class DefaultTilesConfigurer extends TilesConfigurer {
....
@Override
public void afterPropertiesSet() throws TilesException {
//set default properties
Properties props = new Properties();
props.setProperty(BasicRendererFactory.TYPE_RENDERERS_INIT_PARAM, "template,"+SkinTemplateAttributeRenderer.class.getName());
props.setProperty(BasicRendererFactory.DEFAULT_RENDERER_INIT_PARAM, UntypedSkinAttributeRenderer.class.getName());
props.setProperty(CachingLocaleUrlDefinitionDAO.CHECK_REFRESH_INIT_PARAMETER, Boolean.toString(refreshable));
super.setTilesProperties(props);
//initialize
super.afterPropertiesSet();
}
}
The thing is org.springframework.web.servlet.view.tiles2.TilesConfigurer#setTilesProperties is removed in Tiles 2.2. I have checked 2.1 and 2.2 configuration pages of Apache but I didn't understand how I can configure Tiles 2.2 with same parameters.
Thanks...
You need to strongly consider whether it makes sense to use Tiles 2.2 with Spring 4, given that it's officially deprecated in favor of Tiles 3.0. Why not upgrade to Tiles 3 while you're at it?
That being said,
TilesConfigurer#setTilesProperties()in Spring 3 is equivalent to settinginit-paramelements on theTilesServletcontext, so you could move the configuration to yourweb.xmlfile, e.g.Note: the above is deprecated in Tiles 2.2.
References:
https://tiles.apache.org/2.1/framework/tutorial/configuration.html
http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/web/servlet/view/tiles2/TilesConfigurer.html