最后,我可以找出解决方案。现在
urlrewrite.xml从src / main / resources文件夹中读取。
无需在问题post(
public FilterRegistrationBeantuckeyRegistrationBean())中声明上述bean定义,因为以下声明为的代码
@Component将自动在上下文中注册并执行url重写。
@Componentpublic class WsdlUrlRewriteFilter extends UrlRewriteFilter { private static final String CONFIG_LOCATION = "classpath:/urlrewrite.xml"; @Value(CONFIG_LOCATION) private Resource resource; @Override protected void loadUrlRewriter(FilterConfig filterConfig) throws ServletException { try { Conf conf = new Conf(filterConfig.getServletContext(), resource.getInputStream(), resource.getFilename(), ""); checkConf(conf); } catch (IOException ex) { throw new ServletException("Unable to load URL-rewrite configuration file from " + CONFIG_LOCATION, ex); } }}


