| author | karlerickson |
|---|---|
| ms.author | v-shilichen |
| ms.service | azure-spring-apps |
| ms.topic | include |
| ms.date | 08/19/2025 |
| ms.update-cycle | 1095-days |
Use the following steps to create the project:
-
Use the following command to generate a sample project from
start.spring.iowith the recommended dependencies for Azure Spring Apps:curl https://start.spring.io/starter.tgz -d dependencies=web -d baseDir=demo -d bootVersion=3.0.0 -d javaVersion=17 -d type=maven-project -d groupId=com.example -d artifactId=demo -d name=demo -d packageName=com.example.demo -d packaging=jar | tar -xzvf - -
Create a web controller for your web application by adding the file src/main/java/com/example/demo/HelloController.java with the following contents:
package com.example.demo; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RequestMapping; @RestController public class HelloController { @RequestMapping("/") public String index() { return "Hello World"; } }
-
Use the following Maven command to build the project:
./mvnw clean package -
Run the sample project locally by using the following command:
./mvnw spring-boot:run