Skip to content

Developing a Spring Boot application

In this tutorial, you will learn how to create a Spring Boot application using Spring Initializr and add flake.nix for development.

  1. Go to Spring Initializr and configure your project. This example chooses Gradle (Kotlin) and the Java language. You can also add dependencies as needed. Click Generate to download the project as a ZIP file.

  2. Extract the ZIP file to your desired location:

    Terminal window
    unzip demo.zip
    cd demo
  1. Initialize the Java template from the root directory of the Spring Boot project:

    Terminal window
    nix flake init -t github:akirak/flake-templates#java
  2. Ensure the JDK version in your flake.nix matches your project requirement:

    jdk = pkgs.openjdk21_headless;
  3. Add .envrc:

    Terminal window
    use flake
  4. Allow direnv:

    Terminal window
    direnv allow