Spring Boot Setup
Spring Boot Setup
<b>Project Settings:
Add Dependencies:
Spring Web (starter-web): For building web, including RESTful, applications using
Spring MVC.
Lombok (lombok): To reduce boilerplate code.
Spring Boot Actuator (starter-actuator): To monitor and manage your application.
Spring Boot Test (starter-test): For writing unit and integration tests.
Click the Generate button. This will download a ZIP file containing your Spring
Boot project.
Ensure that the build.gradle file contains the necessary dependencies. It should
look like the following:
groovy
<b> code
plugins {
id 'org.springframework.boot' version '3.x.x'
id 'io.spring.dependency-management' version '1.1.0'
id 'java'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
implementation 'net.logstash.logback:logstash-logback-encoder:7.2'
implementation 'ch.qos.logback:logback-classic:1.4.12'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.1.0'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
tasks.named('test') {
useJUnitPlatform()
}
Step 4: Run the Project
To run the project, you can use the following command in the terminal:
bash
<b> code
./gradlew bootRun
This will start the Spring Boot application. You can then navigate to
http://localhost:8080 in your browser to test the app.
groovy
<b> code
http://localhost:8080/swagger-ui.html
This will open the Swagger UI where you can explore the API endpoints and
documentation for your Spring Boot application.
groovy
<b> code
http://localhost:8080/actuator/health
These steps should get your Spring Boot project up and running with the required
dependencies.
change to E drive: