java - CachedIntrospectionResults - 不是强缓存类,因为它不是缓存安全的
问题描述
有谁知道这个警告是什么意思?
o.s.b.CachedIntrospectionResults - Not strongly caching class because it is not cache-safe
这是我的游戏框架应用程序中记录的警告。它似乎与春季的这门课有关,但我找不到更多信息......
解决方案
似乎该消息是从库的方法中抛出的,该方法使用库的org.springframework.beans.CachedIntrospectionResults#forClass
方法来检查指定的类是否是缓存安全的(它检查该类是否由与 CachedIntrospectionResults 类相同的类加载器加载)。spring-beans
org.springframework.util.ClassUtils#isCacheSafe
spring-core
CachedIntrospectionResults#forClass:
/**
* Create CachedIntrospectionResults for the given bean class.
* @param beanClass the bean class to analyze
* @return the corresponding CachedIntrospectionResults
* @throws BeansException in case of introspection failure
*/
static CachedIntrospectionResults forClass(Class<?> beanClass) {
...
if (ClassUtils.isCacheSafe(...)) {
...
}
else {
...
logger.debug("Not strongly caching class [" + beanClass.getName() + "] because it is not cache-safe");
}
...
}
ClassUtils#isCacheSafe:
/**
* Check whether the given class is cache-safe in the given context,
* i.e. whether it is loaded by the given ClassLoader or a parent of it.
* @param clazz the class to analyze
* @param classLoader the ClassLoader to potentially cache metadata in
* (may be {@code null} which indicates the system class loader)
*/
public static boolean isCacheSafe(Class<?> clazz, @Nullable ClassLoader classLoader) {
...
也许CachedIntrospectionResults和ClassUtils类的来源会澄清这个问题。
推荐阅读
- node.js - 从 Rust 使用 nodejs 库
- ios - 如何使 watchOS 上的 cloudKit 与 NSPersistentCloudKitContainer 一起工作
- python - 为什么 pandas.cut 将第一个元素归类为 NaN?
- kotlin - 函数中带有和不带有“挂起”lambda的“重载分辨率歧义”
- javascript - 没有任何 JS 访问令牌的 JWT 有效负载加密
- java - 无法通过代理连接到 websocket
- pytorch - 没有这样的运营商 torchvision::nms
- c# - 在不知道名字的情况下从 Firebase 获取第一个孩子
- android - 您需要不同的包名称,因为该名称已存在于 Play 商店中
- python-3.x - 在python中打印文件名的扩展名