我一直在寻找几天,与可能发生的冲突或我在将 spring 引导放入项目时所做的错误配置相关的问题。
当代码中不存在 (@Validated) 时,所有依赖项通常都会被注入 (@Autowired),因此它被插入,一切都停止被 spring 注入。
gradle.properties
SPRING_BOOT_VERSION=2.0.3.RELEASE
SPRING_CLOUD_VERSION=Finchley.RELEASE
我试过这个版本:
SPRING_BOOT_VERSION=2.1.0.M2
依赖 build.gradle
buildscript {
ext {
springBootVersion = SPRING_BOOT_VERSION
springCloudVersion = SPRING_CLOUD_VERSION
}
repositories {
jcenter()
mavenLocal()
mavenCentral()
maven { url 'https://plugins.gradle.org/m2/' }
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
}
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}",
"org.owasp:dependency-check-gradle:3.2.1"
}
}
dependencies {
compile "org.springframework.boot:spring-boot-starter-actuator",
"org.springframework.boot:spring-boot-starter-webflux",
"org.springframework.boot:spring-boot-starter-validation",
"org.springframework.boot:spring-boot-starter-logging",
"org.springframework.boot:spring-boot-starter-jetty",
"org.springframework.boot:spring-boot-starter-cache",
"org.springframework.boot:spring-boot-starter-jdbc",
"org.springframework.boot:spring-boot-starter-web",
"org.springframework.boot:spring-boot-starter-aop",
"org.springframework:spring-context",
"io.springfox:springfox-swagger2:2.9.0",
"io.springfox:springfox-swagger-ui:2.9.0"
compile "org.eclipse.jetty:jetty-alpn-conscrypt-server",
"org.eclipse.jetty.http2:http2-server",
"org.owasp:dependency-check-gradle:3.2.1",
"org.codehaus.groovy:groovy-all:2.4.15",
"org.liquibase:liquibase-core:3.6.1"
compileOnly "org.projectlombok:lombok:1.18.0"
runtime "mysql:mysql-connector-java:5.1.34"
}
郎朗坤
相关分类