Now let's start the application and view the output. There are multiple ways to run the application:
- By using the Spring Boot Gradle task from the Terminal/command line
- By executing the main Java class, src/main/java/com/mycompany/store/StoreApp.java, from an IDE
- By executing the packaged application file using the java -jar command
Let's start the application using the Gradle task. If you want to run the application directly in the IDE, just open the main app file that we mentioned earlier (StoreApp.java), right-click it, and choose Run 'StoreApp'.
To start the application via Gradle, open a Terminal/command line and navigate to the application folder. Then, execute the Gradle command as follows (if you are on Windows, execute gradlew.bat). This will trigger the default task, that is, bootRun:
> cd online-store
> ./gradlew
Running...