@RequestMapping(value = "/uploadApk", produces = "text/javascript")
@ResponseBody
public String fragUploadApk(@NonNull final HttpServletRequest request, @NonNull final HttpServletResponse response) {
final WebContext context = new WebContext(request, response, request.getServletContext(), request.getLocale());
# 此处使用 Spring MVC 默认的 FormattingConversionService.class 完成对数据的格式化(Springboot 2.7.11)
final FormattingConversionService conversionService = applicationContext.getBean(FormattingConversionService.class);
final ThymeleafEvaluationContext thymeleafEvaluationContext = new ThymeleafEvaluationContext(requireApplicationContext(), conversionService);
context.setVariable(ThymeleafEvaluationContext.THYMELEAF_EVALUATION_CONTEXT_CONTEXT_VARIABLE_NAME, thymeleafEvaluationContext);
templateEngine.process(templateName, context);
}
我遇到了同样的问题,并且我的测试环境没有问题,只有在生产环境中出现。
更诡异的是,在我的for循环中,对于同一个模版,这个问题是偶现的,并且我的template.html中,并没有引用Spring Bean。
请问你是否遇到过这种问题?
我遇到了同样的问题,但是我的template.html中并没有用到spring bean。
并且,在一个for循环中调用 emplateEngine.process(new, new);时,这个问题是偶现的
建议关注一下出问题时候的 ClassLoader ,是不是被某个三方依赖替换掉了,最常见的就是某些性能监视软件,他们动作的时候进行AOP注入,导致 Classloader 被换掉了
好的,非常感谢您的建议。我去排查一下
好的,感谢您的建议,我去排查一下