Spring5源码解析-搭建环境

Spring5源码解析-搭建环境
1.获取源码:
https://github.com/spring-projects/spring-framework/tree/5.0.x
2.导入IDE
Spring5源码解析-搭建环境_第1张图片
3.解决cglib和objensis的编译错误
Spring5源码解析-搭建环境_第2张图片
编译cglib和objensis jar包,然后导入

Spring5源码解析-搭建环境_第3张图片
新增的jar包在gradle有效
compile fileTree(dir:“libs”,include:".jar")
Spring5源码解析-搭建环境_第4张图片
4.运行调试
Spring5源码解析-搭建环境_第5张图片
遇到如下的错

Error:Kotlin: [Internal Error] java.lang.AbstractMethodError: org.jetbrains.kotlin.scripting.compiler.plugin.ScriptingCompilerConfigurationComponentRegistrar.registerProjectComponents(Lcom/intellij/mock/MockProject;Lorg/jetbrains/kotlin/config/CompilerConfiguration;)V
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.(KotlinCoreEnvironment.kt:173)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.(KotlinCoreEnvironment.kt:114)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment C o m p a n i o n . c r e a t e F o r P r o d u c t i o n ( K o t l i n C o r e E n v i r o n m e n t . k t : 401 ) a t o r g . j e t b r a i n s . k o t l i n . c l i . j v m . K 2 J V M C o m p i l e r . c r e a t e C o r e E n v i r o n m e n t ( K 2 J V M C o m p i l e r . k t : 282 ) a t o r g . j e t b r a i n s . k o t l i n . c l i . j v m . K 2 J V M C o m p i l e r . c r e a t e E n v i r o n m e n t W i t h S c r i p t i n g S u p p o r t ( K 2 J V M C o m p i l e r . k t : 272 ) a t o r g . j e t b r a i n s . k o t l i n . c l i . j v m . K 2 J V M C o m p i l e r . d o E x e c u t e ( K 2 J V M C o m p i l e r . k t : 151 ) a t o r g . j e t b r a i n s . k o t l i n . c l i . j v m . K 2 J V M C o m p i l e r . d o E x e c u t e ( K 2 J V M C o m p i l e r . k t : 61 ) a t o r g . j e t b r a i n s . k o t l i n . c l i . c o m m o n . C L I C o m p i l e r . e x e c I m p l ( C L I C o m p i l e r . j a v a : 107 ) a t o r g . j e t b r a i n s . k o t l i n . c l i . c o m m o n . C L I C o m p i l e r . e x e c I m p l ( C L I C o m p i l e r . j a v a : 51 ) a t o r g . j e t b r a i n s . k o t l i n . c l i . c o m m o n . C L I T o o l . e x e c ( C L I T o o l . k t : 92 ) a t o r g . j e t b r a i n s . k o t l i n . d a e m o n . C o m p i l e S e r v i c e I m p l Companion.createForProduction(KotlinCoreEnvironment.kt:401) at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.createCoreEnvironment(K2JVMCompiler.kt:282) at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.createEnvironmentWithScriptingSupport(K2JVMCompiler.kt:272) at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:151) at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:61) at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:107) at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:51) at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:92) at org.jetbrains.kotlin.daemon.CompileServiceImpl Companion.createForProduction(KotlinCoreEnvironment.kt:401)atorg.jetbrains.kotlin.cli.jvm.K2JVMCompiler.createCoreEnvironment(K2JVMCompiler.kt:282)atorg.jetbrains.kotlin.cli.jvm.K2JVMCompiler.createEnvironmentWithScriptingSupport(K2JVMCompiler.kt:272)atorg.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:151)atorg.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:61)atorg.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:107)atorg.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:51)atorg.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:92)atorg.jetbrains.kotlin.daemon.CompileServiceImplcompileKaTeX parse error: Can't use function '$' in math mode at position 8: inlined$̲ifAlive$lambda$…inlined i f A l i v e ifAlive ifAlivelambda 1. i n v o k e ( C o m p i l e S e r v i c e I m p l . k t : 96 ) a t o r g . j e t b r a i n s . k o t l i n . d a e m o n . C o m p i l e S e r v i c e I m p l 1.invoke(CompileServiceImpl.kt:96) at org.jetbrains.kotlin.daemon.CompileServiceImpl 1.invoke(CompileServiceImpl.kt:96)atorg.jetbrains.kotlin.daemon.CompileServiceImpldoCompileKaTeX parse error: Can't use function '$' in math mode at position 8: inlined$̲ifAlive$lambda$…inlined i f A l i v e ifAlive ifAlivelambda$2.invoke(CompileServiceImpl.kt:96)
at org.jetbrains.kotlin.daemon.common.DummyProfiler.withMeasure(PerfUtils.kt:137)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.checkedCompile(CompileServiceImpl.kt:919)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.doCompile(CompileServiceImpl.kt:891)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:378)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:346)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport 1. r u n ( T r a n s p o r t . j a v a : 197 ) a t j a v a . s e c u r i t y . A c c e s s C o n t r o l l e r . d o P r i v i l e g e d ( N a t i v e M e t h o d ) a t s u n . r m i . t r a n s p o r t . T r a n s p o r t . s e r v i c e C a l l ( T r a n s p o r t . j a v a : 196 ) a t s u n . r m i . t r a n s p o r t . t c p . T C P T r a n s p o r t . h a n d l e M e s s a g e s ( T C P T r a n s p o r t . j a v a : 568 ) a t s u n . r m i . t r a n s p o r t . t c p . T C P T r a n s p o r t 1.run(Transport.java:197) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:196) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568) at sun.rmi.transport.tcp.TCPTransport 1.run(Transport.java:197)atjava.security.AccessController.doPrivileged(NativeMethod)atsun.rmi.transport.Transport.serviceCall(Transport.java:196)atsun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)atsun.rmi.transport.tcp.TCPTransportConnectionHandler.run0(TCPTransport.java:826)
at sun.rmi.transport.tcp.TCPTransport C o n n e c t i o n H a n d l e r . l a m b d a ConnectionHandler.lambda ConnectionHandler.lambdarun 0 ( T C P T r a n s p o r t . j a v a : 683 ) a t j a v a . s e c u r i t y . A c c e s s C o n t r o l l e r . d o P r i v i l e g e d ( N a t i v e M e t h o d ) a t s u n . r m i . t r a n s p o r t . t c p . T C P T r a n s p o r t 0(TCPTransport.java:683) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.tcp.TCPTransport 0(TCPTransport.java:683)atjava.security.AccessController.doPrivileged(NativeMethod)atsun.rmi.transport.tcp.TCPTransportConnectionHandler.run(TCPTransport.java:682)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
这个主要是Kotlin插件的版本问题,解决方案是更新新版本的Kotlin插件
最后重启IDEA,然后测试调试即可正常运行。

  1. 遇到 InstrumentationSavingAgent 不存在的错误 需要将 spring-context.gradle 修改如下
    在这里插入图片描述
    Spring5源码解析-搭建环境_第6张图片

你可能感兴趣的:(spring)