spring5.1.5环境搭建

说明:

该环境是在eclipse上进行搭建,笔者用的版本是neon3!

1.下载spring的源码

下载地址为:https://github.com/spring-projects/spring-framework

建议下载zip的格式!

2.下载并gradle,建议下载最新版本

下载地址为:https://gradle.org/releases/

安装需要配置环境变量,GRADLE_HOME和PATH

3.在spring-framework的路径下执行以下两个命令
gradle objenesisRepackJar
gradle cglibRepackJar

4.到spring的每个子项目目录下执行相关编译工作
如到spring-jcl目录下执行
gradle cleanidea eclipse

5.在spring-oxm下执行以下两个命令
gradle genCastor
gradle genJaxb

6.使用eclipse导入每个项目(单独导入)

7.遇到GroovyDynamicElementReader报错,可以使用如下处理方式
在eclipse的 Help -> Install New Software 中,添加groovy的下载连接(Neon版本):
http://dist.springsource.org/snapshot/GRECLIPSE/e4.6/
建议全部安装

8.遇到编译错误Mono.just(xx)这报错

报错代码如下

HandlerFunction handlerFunction =
// Mono. is required for compilation in Eclipse
request -> Mono.just(new ServerResponse() {
	@Override
	public HttpStatus statusCode() {
		return HttpStatus.OK;
	}
	@Override
	public HttpHeaders headers() {
		return new HttpHeaders();
	}
	@Override
	public MultiValueMap cookies() {
		return new LinkedMultiValueMap<>();
	}
	@Override
	public Mono writeTo(ServerWebExchange exchange, Context context) {
		throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Not found");
	}
});

修改为:

HandlerFunction handlerFunction =
// Mono. is required for compilation in Eclipse
request -> (Mono)Mono.just(new ServerResponse() {
	@Override
	public HttpStatus statusCode() {
		return HttpStatus.OK;
	}
	@Override
	public HttpHeaders headers() {
		return new HttpHeaders();
	}
	@Override
	public MultiValueMap cookies() {
		return new LinkedMultiValueMap<>();
	}
	@Override
	public Mono writeTo(ServerWebExchange exchange, Context context) {
		throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Not found");
	}
});

 

你可能感兴趣的:(spring)