Skip to content

toolisticon/spring-boot-support

Repository files navigation

Spring-Boot Support

A collection of Spring-Boot supporting tools.

incubating Build Status sponsored Maven Central

Import

Import the BOM into your Maven project.

<dependency>
  <groupId>io.toolisticon.spring</groupId>
  <artifactId>spring-boot-bom</artifactId>
  <version>1.0.1</version>
  <scope>import</scope>
  <type>pom</type>
</dependency>

Spring-Boot Conditions

Provides useful Spring-Boot conditions.

Supported conditions

  • @ConditionalOnMissingQualifiedBean

Usage

<dependency>
  <groupId>io.toolisticon.spring</groupId>
  <artifactId>spring-boot-conditions</artifactId>
</dependency>

YAML property source factory

Allows to define default properties as part of the starter using supplied YAML file.

Usage

<dependency>
  <groupId>io.toolisticon.spring</groupId>
  <artifactId>spring-boot-properties</artifactId>
</dependency>

Define properties

@ConfigurationProperties("myprops")
data class MyProperties(
  val foo: String,
  val zee: Int,
  val baz: Boolean
)

Define configuration:

@EnableConfigurationProperties(MyProperties::class)
@PropertySource(
  name = "myDefaultProperties",
  value = ["classpath:/application-my-default.yaml"],
  factory = YamlPropertySourceFactory::class
)
class MyConfiguration 

Put a application-my-default.yaml into src/main/resources:

myprops:
  foo: "bar"
  zee: 42
  baz: true

License

This library is published under the Apache 2.0 license.