top啦它 2022-04-23 17:18 采纳率: 66.7%
浏览 14
已结题

在静态代码块中进行AADemo_5.class.getClass();操作有什么用?


public class AADemo_7 {
    static {
        AADemo_5.class.getClass();
    }
    public static void main(String[] args) {
    }
}

代码中AADemo_5.class.getClass();这样写有什么用呢?

我是在Spring源码中看到的:

    static {
        // Eagerly load the ContextClosedEvent class to avoid weird classloader issues
        // on application shutdown in WebLogic 8.1. (Reported by Dustin Woods.)
        ContextClosedEvent.class.getName();
    }

请问这是什么意思啊?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    问题事件

    • 已结题 (查看结题原因) 4月24日
    • 创建了问题 4月23日