升级细节。弹簧引导:2.2.7-发布到2.4.6级: 4.10.3至6.9.2
build.gradle
plugins{
id 'org.springframework.boot' version '2.4.6'
id 'io.spring.dependency-management' version '1.0.11.RELESE'
id 'java'
}
sourceCompatibility ='1.8'
dependency-management{
import {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:2020.0.4"
}
}
dependencies{
implmentation 'org.springframework.boot:spring-boot-starter-data-jdbc'
implmentation 'org.springframework.boot:spring-boot-starter-web'
implmentation 'org.springframework.kafka:spring-kafka'
implmentation 'org.projectlombok.lombok'
testImplmentation 'org.springframework.boot:spring-boot-starter-test'
implmentation 'org.springframework.cloud:spring-cloud-starter-config'
implmentation 'org.springframework.cloud:spring-cloud-starter-bootstrap'
compile 'org.springframework.boot:spring-boot-starter-webflux'
implmentation 'org.springframework.boot:spring-boot-starter-data-jpa'
compile(group: 'org.springframework.boot', name: 'spring-boot-configuaration-processor')
compile(group: 'com.microsoft.sqlserver', name: 'mssql-jdbc' version: '8.3.1.jre8-preview')
runtimeOnly 'com.microsoft.sqlserver:mysql-jdbc'
implmentation 'io.springfox:springfox-swagger2:2.9.2'
implmentation 'io.springfox:springfox-swagger-ui:2.9.2'
compile 'org.springframework.boot:spring-boot-starter-actuator'
compile 'org.projectreactor:reactor-spring'
implmentation 'io.micrometer:micrometer-registry-prometheus'
implmentation 'javax.mail:mail:1.4'
testImplmentation 'junit:junit'
annotationProcessor 'org.projectlombok:lombok'
}
wrapper{
distribuationUrl = "https://services.gradle.org/distributions/gradle-6.9.2-bin"
}
主修班:
@SpringBootApplication(exclude={DataSourceAutoConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class,HibernateJpaAutoConfiguration.class})
@EnableKafka
@EnableScheduling
public class SpringBootMainClassApplication {
public static void main(String[] args) {
SpringApplication.run(SpringBootMainClassApplication.class, args);
}
}
application.properties
server.port=8080
错误:“ApplicationContextException:由于缺少ServletWebServerFactory bean无法启动ServletWebServerFactory”。
将以下属性添加到application.properties后运行良好的代码。
spring.main.web-application-type=none
应用程序作为控制台应用程序运行良好,而不需要将Spring.main.web应用程序类型=none更改为带有旧版本spring 2.2.7版本的属性,您能帮助我们在不添加新属性的情况下运行应用程序吗?
发布于 2022-04-21 16:56:21
它运转得很好,好像你有很多错误。
请使用这个等级,永远爱你的代码,因为它可能就像一幅画:)
plugins {
id "io.spring.dependency-management" version "1.0.11.RELEASE"
id "org.springframework.boot" version "2.4.6"
id "java"
}
sourceCompatibility ='1.8'
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
mavenCentral()
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:2020.0.4"
}
}
dependencies
{
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-data-jdbc'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web'
implementation group: 'org.springframework.kafka', name: 'spring-kafka'
implementation 'io.springfox:springfox-swagger2:2.9.2'
implementation 'io.springfox:springfox-swagger-ui:2.9.2'
implementation 'org.springframework.cloud:spring-cloud-starter-config'
implementation 'org.springframework.cloud:spring-cloud-starter-bootstrap'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'io.micrometer:micrometer-registry-prometheus'
implementation 'javax.mail:mail:1.4'
compileOnly group: 'org.projectlombok', name: 'lombok', version: '1.18.24'
compileOnly group: 'org.springframework.boot', name: 'spring-boot-configuaration-processor'
compileOnly group: 'com.microsoft.sqlserver', name: 'mssql-jdbc', version: '8.3.1.jre8-preview'
compileOnly 'org.springframework.boot:spring-boot-starter-webflux'
compileOnly 'org.springframework.boot:spring-boot-starter-actuator'
compileOnly 'org.projectreactor:reactor-spring'
runtimeOnly 'com.microsoft.sqlserver:mysql-jdbc'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'junit:junit'
annotationProcessor 'org.projectlombok:lombok'
}
https://stackoverflow.com/questions/71956396
复制相似问题