- Gradle5.5.1版本set()方法不可用
注意构建时候gradle的提示信息:
The set() method has been deprecated and is scheduled to be removed in Gradle 3.0. Please use the setProperty() or ext.set() method instead.
The plugin id 'spring-boot' is deprecated. Please use 'org.springframework.boot' instead.
def environment = hasProperty('env') ? env : 'dev'
project.set('environment', environment)
需要修改为:
ext.set('environment', hasProperty('env') ? env : 'dev')
- Gradle构建项目报错: Could not find method leftShift() for arguments
task hello << {
println 'Hello world!'
}
解决方法:去掉build.gradle文本中的<<
task hello {
println 'Hello world!'
}
- springboot+jsp页面不能访问
#修改本地启动的方式为:
mvn spring-boot:run
#或
gradlew bootRun
#在application.properties中增加配置:
spring.mvc.view.prefix:/WEB-INF/jsp/
spring.mvc.view.suffix:.jsp
- Gradle4.6之后的版本更新内容:
向Java项目添加注释处理器变得更加容易。只需将它们添加到annotationProcessor
配置中:
dependencies {
annotationProcessor 'com.google.dagger:dagger-compiler:2.8'
implementation 'com.google.dagger:dagger:2.8'
}
将lombok依赖项类型从更改compile
为annotationProcessor
,因此build.gradle
文件中的依赖项部分应如下所示:
dependencies {
compile('org.projectlombok:lombok:1.16.20')
annotationProcessor 'org.projectlombok:lombok:1.16.20'
// compile 'org.projectlombok:lombok:1.16.20' <-- this no longer works!
// other dependencies...
}
- 升级spring-boot-gradle-plugin的版本,从1.2.2升级为1.5.9
buildscript {
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.9.RELEASE")
}
}
-
springboot版本从1.2.2升级到1.5.9
-
gradle中的
mainClassName
不可用
异常:No such property: mainClassName for class
解决方案:
增加:
apply plugin: 'application'
FilterRegistrationBean
类从1.2.2版本到1.5.9版本路径修改
import org.springframework.boot.context.embedded.FilterRegistrationBean;
改为:
import org.springframework.boot.web.servlet.FilterRegistrationBean;
- @ConfigurationProperties注解中locations 参数不可用
@ConfigurationProperties(locations = "classpath:/config/application.properties", prefix = "test")
修改为:
@ConfigurationProperties(prefix = "test")
@PropertySource("classpath:/config/application.properties")
dao-datasource.xml
中writeDataSource bean中增加primary="true"
属性