Skip to content

Latest commit

 

History

History
53 lines (38 loc) · 1.55 KB

File metadata and controls

53 lines (38 loc) · 1.55 KB
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:

  1. Use the following command to generate a sample project from start.spring.io with 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 -
  2. 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";
         }
    }
  3. Use the following Maven command to build the project:

    ./mvnw clean package
    
  4. Run the sample project locally by using the following command:

    ./mvnw spring-boot:run