package org.springboot.sample.config; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.servlet.resource.ResourceUrlProvider; /** * 处理静态资源URL * * @author 单红宇(365384722) * @myblog http://blog.csdn.net/catoop/ * @create 2016年1月8日 */ @ControllerAdvice public class ResourceUrlProviderController { @Autowired private ResourceUrlProvider resourceUrlProvider; @ModelAttribute("urls") public ResourceUrlProvider urls() { return this.resourceUrlProvider; } }