Skip to content

Project template for bootstrapping Spring Boot starter

License

petromir/spring-boot-starter-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

spring-boot-starter-template

A simplified way to bootstrap and configure your Spring Boot starter project.

Click on the green Use This Template button and start building your awesome Spring Boot starter.

🤩 Highlights

Add what this starter is about along with other important details

  • The project uses Java 21 and Spring Boot 3.5.X
  • SNAPSHOT versions are not allowed during release builds (i.e., the ones with non-SNAPSHOT version, e.g. 1.0.0)
  • Dependabot is configured to update Maven dependencies
  • Configuration metadata is provided

📋 Prerequisites

  1. Install SDKMAN
  2. Initialize SDKMAN environment
sdk env install

💡Usage

Configuration

Properties

Use a prefix to distinguish your properties from the default ones or the ones provided by other libraries.

Name Description Default Value Constraints
libraries.template.property This property is supposed to control starter behavior 1 Positive value

Each property could be provided as an environment variable relying on the Spring environment variable management.
For example, providing LIBRARIES_TEMPLATE_PROPERTY has the same effect as specifying libraries.template.property in the application.yaml file

You can configure the starter by providing the above properties inside application.yaml file:

libraries:
  template:
    property: 42

Code

Explain how to use the exposed beans

Dependency management

With BOM

If you have (and you should) an internal bom then add it to your project pom.xml file first by:

<dependenciyManagement>
    <dependencies>
        <dependency>
            <groupId>com.petromirdzhunev</groupId>
            <artifactId>template-spring-boot-starter</artifactId>
            <version>${internal-bom.version}</version>
            <type>bom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependenciyManagement>

Then add this starter without a version

<dependencies>
    <dependency>
        <groupId>com.petromirdzhunev</groupId>
        <artifactId>template-spring-boot-starter</artifactId>
    </dependency>
</dependencies>

Without BOM

<dependencies>
    <dependency>
        <groupId>com.petromirdzhunev</groupId>
        <artifactId>template-spring-boot-starter</artifactId>
        <version>${template-spring-boot-starter.version}</version>
    </dependency>
</dependencies>

🛠 Development

Build and install SNAPSHOT versions to the local repository

Switch to SNAPSHOT version

mvnd versions:set -DnewVersion=$(mvnd -B help:evaluate -Dexpression=project.version -DforceStdout | grep -E "^[0-9]+\.[0-9]+\.[0-9]+")-SNAPSHOT

Install SNAPSHOT version to the local repository

mvnd -B clean install

Point to the SNAPSHOT version

Adjust the version in the project where this starter is used.

<dependencies>
    <dependency>
        <groupId>com.petromirdzhunev.libraries</groupId>
        <artifactId>json-spring-boot-starter</artifactId>
        <version>${template-spring-boot-starter.version}-SNAPSHOT</version>
    </dependency>
</dependencies>

Revert to a non-SNAPSHOT version

After the development is finished, you can revert to non-SNAPSHOT version by:

mvnd versions:revert -Dincludes=com.petromirdzhunev:template-spring-boot-starter

🗓️ Changelog

CHANGELOG.md follows a Keep A Changelog format. Anything that leads to breaking changes should be prefixed with [BREAKING CHANGE]

🙌 Contributing

See CONTRIBUTING.md

✔️ TODO:

  • Define CONTRIBUTING.md
  • Provide a real example of a bean exposed by the autoconfiguration along with tests.
  • Add publishing to Maven central repository
    • Documentation
    • Add GitHub action

About

Project template for bootstrapping Spring Boot starter

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Contributors 2

  •  
  •  

Languages