In this blog, we will show you how to create the Spring-Boot wireframe and initial folder structure for your project.
Bootstrapping with Spring-Boot:
Bootstrapping with Spring-Boot: Let’s get started! Open your browser and go to https://start.spring.io. This is from where we would bootstrap. Select Project, language and any release version of Spring-Boot. TS360 uses Gradle, Java with Spring-Boot 2.x. Now fill up the project meta data, packaging and Java version. So, my screen now looks like this:
Click on GENERATE button. This would download the project zip file to your personal computer. Unzip the file in any desired location.
Opening your project in IntelliJ:
Now open the project in your IntelliJ editor. In your editor, click on File menu -> Open -> Go to your folder location -> Select build.gradle.
You may see a pop-up like below. Select Open as Project.
DemoApplication class in src/main/java/com/example/demo folder is the runner class with main method in Spring. This gets triggered when you run any other class with Junit.
DemoApplicationTests class is by default created and it looks like below:
package com.example.demo;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class DemoApplicationTests {
@Test
void contextLoads() {
}
}
You would also see the file application.properties which is empty. You can use it to provide your app data and source it using @PropertySources spring annotation. More on that would be in a later blog.