3.x 版本
这个类AbstractCachingViewResolver里面的viewCache HashMap没有限制大小
3.x:如果在 controller 返回的 view 是不固定的,如:”redirect:form.html?entityId=” + entityId,由于 entityId 的值会存在 N 个,那么会导致产生 N 个 ViewName 被缓存起来
4.x 版本及以上已经修复这个问题,代码如下
1 | public abstract class AbstractCachingViewResolver extends WebApplicationObjectSupport implements ViewResolver { |
4.x 版本
4.x 版本是这个AbstractAutoProxyCreator这个类里面的advisedBeans ConcurrentHashMap没有限制大小
问题描述:https://github.com/spring-projects/spring-boot/issues/13771
The problem is that InternalResourceViewResolver calls AutowireCapableBeanFactory.initializeBean(Object existingBean, String beanName) using the complete URL as the beanName. The bean name is then used by AbstractAutoProxyCreator.wrapIfNecessary(Object, String, Object) as the key when it caches the fact that no advice applies to it.
经测试 spring 5.0.8.RELEASE 还存在这个问题,spring 5.3.8已不存在该问题,其他版本未测试
1 | String url = "http://localhost:8080/test?uuid" + UUID.randomUUID(); |