1.修改build.gradle文件,增加spring boot依赖
plugins {
id 'java'
id 'org.springframework.boot' version '2.3.7.RELEASE'
}
group 'org.chuck'
version '0.0.1'
java {
sourceCompatibility = JavaVersion.VERSION_1_8
}
repositories {
maven{ url'http://maven.aliyun.com/nexus/content/groups/public/'}
mavenCentral()
}
dependencies {
implementation platform('org.springframework.boot:spring-boot-dependencies:2.3.7.RELEASE')
implementation 'org.springframework.boot:spring-boot-starter'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
}
2. 增加 application.yml
spring:
application:
name: test
server:
port: 8100
servlet:
context-path: /${spring.application.name}
参考:https://docs.gradle.org/current/samples/sample_building_spring_boot_web_applications.html

本文指导如何在IntelliJ IDEA中通过Gitee和Gradle初始化一个Spring Boot项目。首先,更新build.gradle文件添加Spring Boot依赖。接着,创建application.yml配置文件,以便为项目配置Spring Boot。
1002

被折叠的 条评论
为什么被折叠?



