This topic describes how to deploy a Spring Boot application to Function Compute. Function Compute provides a method different from traditional deployment methods. You can deploy a traditional Spring Boot application to Function Compute and use the application for production without performing operations such as purchasing a server. The deployed Spring Boot application can use the auto scaling, pay-as-you-go, and O&M-free features of Function Compute.


The following operations are complete:

The content about how to use Funcraft to migrate an application from a traditional framework is no longer maintained. We recommend that you use Serverless Devs to migrate relevant frameworks to Function Compute.

For more information about how to migrate Function Compute-related resources from Funcraft to Serverless Devs, see Migrate resources from Funcraft to Serverless Devs.

For more information about how to use Serverless Devs to migrate an application from a web framework, see Use Serverless Devs to migrate web frameworks.

We apologize for any inconvenience caused.

Background information

Spring Boot is a new open source and lightweight framework developed by the Pivotal team in 2013 and released in April 2014. Spring Boot is designed based on Spring 4.0. Spring Boot inherits the original excellent features of the Spring framework, and simplifies the entire construction and development process of Spring applications by simplifying configurations. In addition, Spring Boot resolves problems such as version conflicts and reference instability of dependent packages by integrating a large number of frameworks.


  1. Create a Spring Boot project. For more information, see Spring Quickstart Guide.
  2. Run the following command to open the created sample project or an existing project:
    cd <project-name>
  3. Run the on-premises project.
    • macOS and Linux
      ./mvnw spring-boot:run
    • Windows
      mvnw spring-boot:run
  4. In the root directory of the project, run the mvn package command to package files.
    The compilation output is similar to the following sample code.
    mvn package
    [INFO] Scanning for projects...
    [INFO] ----------------------< com.example:Spring-Boot >-----------------------
    [INFO] Building Spring-Boot 0.0.1-SNAPSHOT
    [INFO] --------------------------------[ jar ]---------------------------------
    [INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ Spring-Boot ---
    ... ... ...
    [INFO] Results:
    [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
    [INFO] --- maven-jar-plugin:3.1.2:jar (default-jar) @ Spring-Boot ---
    [INFO] Building jar: /Users/txd123/Desktop/Spring-Boot/target/Spring-Boot-0.0.1-SNAPSHOT.jar
    [INFO] --- spring-boot-maven-plugin:2.2.6.RELEASE:repackage (repackage) @ Spring-Boot ---
    [INFO] Replacing main artifact with repackaged archive
    [INFO] ------------------------------------------------------------------------
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time:  38.850 s
    [INFO] Finished at: 2020-03-31T15:09:34+08:00
    [INFO] ------------------------------------------------------------------------
  5. Run the fun deploy -y command to deploy the application to Function Compute.
    fun deploy -y
    current folder is not a fun project.
    Generating template.yml...
    Generate Fun project successfully!
    ========= Fun will use 'fun deploy' to deploy your application to Function Compute! =========
    using region: cn-qingdao
    using accountId: ***********3743
    using accessKeyId: ***********Ptgk
    using timeout: 60
    Collecting your services information, in order to caculate devlopment changes...
    Resources Changes(Beta version! Only FC resources changes will be displayed):
                   trigger httpTrigger deploy success
           function Spring-Boot deploy success
    service Spring-Boot deploy success
    Detect 'DomainName:Auto' of custom domain 'Domain'
    Request a new temporary domain ...
    The assigned temporary domain is, expired at 2020-04-10 15:19:56, limited by 1000 per day.
    Waiting for custom domain Domain to be deployed...
    custom domain Domain deploy success

    After the application is deployed, you can check logs to find the temporary domain name that is generated by Function Compute. You can use the temporary domain name to access the deployed application.

    Note The temporary domain name is used only for demonstration and development purposes. It is valid for a limited period of time. You must use a domain name that has obtained an Internet Content Provider (ICP) filing from Alibaba Cloud for production. For more information, see Configure a custom domain name.