repositories { maven{ url ‘https://maven.aliyun.com/nexus/content/groups/public/‘} maven{ url ‘https://maven.aliyun.com/nexus/content/repositories/jcenter‘} mavenCentral() maven { url "https://repo.spring.io/libs-spring-framework-build" } }
c、下载gradle-5.6.4-bin.zip
d、修改gradle\wrapper\ 目录下的gradle-wrapper.properties,注释掉原distributionUrl配置,以免从网上下载gradle。
#distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip
distributionUrl=file:///D:/.gradle/wrapper/dists/gradle-5.6.4-bin.zip
e、编译compileTestJava模块
执行gradlew.bat或在spring源码根目录里运行windows cmd,执行以下命令
gradlew :spring-oxm:compileTestJava
配置了镜像一般很快(1-3)分钟就能完成,如果要很久说明镜像配置不成功
3. 导入idea
Import into IntelliJ (File -> New -> Project from Existing Sources -> Navigate to directory -> Select build.gradle)
idea配置:
4 添加测试模块
@Service public class TestImpl { public void hello(){ System.out.println("Hello Spring!"); } }
@Configuration @ComponentScan("com.test") public class TestClass { public static void main(String[] args) { ApplicationContext context=new AnnotationConfigApplicationContext(TestClass.class); TestImpl bean = context.getBean(TestImpl.class); bean.hello(); } }
5 大功告成
原文:https://www.cnblogs.com/sheseido/p/14748791.html