zoukankan      html  css  js  c++  java
  • spring 5.2.7 编译

    1. 环境
      idea 2021社区版
      jdk8
    2. 下载spring源码
      a、git上下载spring5.2.7 zip包,解压缩
      b、修改build.gradle
      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、修改gradlewrapper 目录下的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 添加测试模块

    new->model->gradle-->输入模块名称
    @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 大功告成

  • 相关阅读:
    使用PHP绘制统计图
    微信公众平台商户模块
    jQuery Mobile入门教程
    2013中国微信公众平台用户研究报告
    WordPress的SEO技术
    微信公众平台消息接口星标功能
    微信5.0打飞机怎么取得高分?
    微信公众平台的服务号和订阅号
    微信公众平台开发(58)自定义菜单
    微信公众平台开发(57)Emoji表情符号
  • 原文地址:https://www.cnblogs.com/sheseido/p/14748791.html
Copyright © 2011-2022 走看看