spring - Is there any analog of XML resources mapping for Java based configuration? -
my problem related access resources. more specific jsp couldn't access js , css (resources). there analog of xml tag <mvc:resources mapping="/resources/**" location="/web-inf/resources/"/>
java based configuration?
my configuration class
@enablewebmvc @configuration @componentscan("com.springapp.mvc") @propertysource("classpath:names.properties") public class webmvcconfig extends webmvcconfigureradapter { @bean public internalresourceviewresolver setupviewresolver() { internalresourceviewresolver resolver = new internalresourceviewresolver(); resolver.setprefix("/web-inf/pages/"); resolver.setsuffix(".jsp"); return resolver; } // other beans }
founded! need add method config class.
@override public void addresourcehandlers(resourcehandlerregistry registry) { registry.addresourcehandler("/resources/**").addresourcelocations("/web-inf/resources/"); }
Comments
Post a Comment