Skip to content

Commit fcf65d3

Browse files
committed
Merge branch 'release/1.0.1'
2 parents 5115437 + 825e71b commit fcf65d3

File tree

19 files changed

+339
-25
lines changed

19 files changed

+339
-25
lines changed

.github/workflows/development.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Development branches
22

3+
permissions:
4+
contents: read
5+
36
on:
47
push:
58
branches:
@@ -21,10 +24,10 @@ jobs:
2124
run: echo ${{ github.ref }}
2225

2326
# Setup JDK and Maven
24-
- name: Set up JDK 17
27+
- name: Set up JDK
2528
uses: actions/setup-java@v4
2629
with:
27-
java-version: 17
30+
java-version-file: .java-version
2831
distribution: zulu
2932
cache: maven
3033

.github/workflows/master.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Produces and releases artifacts
22

3+
permissions:
4+
contents: read
5+
36
on:
47
push:
58
branches:
@@ -17,10 +20,10 @@ jobs:
1720
- name: Set up JDK
1821
uses: actions/setup-java@v4
1922
with:
20-
java-version: 17
23+
java-version-file: .java-version
2124
cache: maven
2225
distribution: zulu
23-
server-id: ossrh
26+
server-id: central
2427
server-username: OSS_CENTRAL_USERNAME # env variable for Maven Central
2528
server-password: OSS_CENTRAL_PASSWORD # env variable for Maven Central
2629

@@ -41,10 +44,11 @@ jobs:
4144

4245
# Publish release
4346
- name: Deploy a new release version to Maven Central
44-
run: ./mvnw clean deploy -B -DskipTests -DskipExamples -Prelease -Dgpg.keyname="${{ secrets.GPG_KEYNAME }}" -Dgpg.passphrase="${{ secrets.GPG_PASSPHRASE }}" -ntp
47+
run: ./mvnw clean deploy -B -ntp -DskipTests -DskipExamples -Prelease -Dgpg.keyname="${{ secrets.GPG_KEYNAME }}"
4548
env:
4649
OSS_CENTRAL_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
4750
OSS_CENTRAL_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
51+
MAVEN_GPG_PASSPHRASE: "${{ secrets.GPG_PASSPHRASE }}"
4852

4953
# - name: Upload coverage information
5054
# uses: codecov/codecov-action@v2

.github/workflows/release-notes.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
# Trigger the workflow on milestone events
1+
name: Milestone Closure
2+
3+
permissions:
4+
contents: write
5+
26
on:
37
milestone:
48
types: [closed]
5-
name: Milestone Closure
9+
610
jobs:
711
create-release-notes:
812
runs-on: ubuntu-latest

README.md

Lines changed: 67 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,20 @@ A collection of Spring-Boot supporting tools.
77
[![sponsored](https://img.shields.io/badge/sponsoredBy-Holisticon-RED.svg)](https://holisticon.de/)
88
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.toolisticon.spring/spring-conditions/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.toolisticon.spring/spring-conditions)
99

10+
## Import
11+
12+
Import the BOM into your Maven project.
13+
14+
```xml
15+
<dependency>
16+
<groupId>io.toolisticon.spring</groupId>
17+
<artifactId>spring-boot-bom</artifactId>
18+
<version>1.0.1</version>
19+
<scope>import</scope>
20+
<type>pom</type>
21+
</dependency>
22+
```
23+
1024
## Spring-Boot Conditions
1125

1226
Provides useful Spring-Boot conditions.
@@ -21,8 +35,59 @@ Provides useful Spring-Boot conditions.
2135

2236
<dependency>
2337
<groupId>io.toolisticon.spring</groupId>
24-
<artifactId>spring-conditions</artifactId>
25-
<version>1.0.0</version>
38+
<artifactId>spring-boot-conditions</artifactId>
2639
</dependency>
40+
```
2741

42+
## YAML property source factory
43+
44+
Allows to define default properties as part of the starter using supplied YAML file.
45+
46+
### Usage
47+
48+
```xml
49+
<dependency>
50+
<groupId>io.toolisticon.spring</groupId>
51+
<artifactId>spring-boot-properties</artifactId>
52+
</dependency>
2853
```
54+
55+
Define properties
56+
57+
```kotlin
58+
@ConfigurationProperties("myprops")
59+
data class MyProperties(
60+
val foo: String,
61+
val zee: Int,
62+
val baz: Boolean
63+
)
64+
65+
```
66+
67+
Define configuration:
68+
69+
```kotlin
70+
71+
@EnableConfigurationProperties(MyProperties::class)
72+
@PropertySource(
73+
name = "myDefaultProperties",
74+
value = ["classpath:/application-my-default.yaml"],
75+
factory = YamlPropertySourceFactory::class
76+
)
77+
class MyConfiguration
78+
79+
```
80+
81+
Put a `application-my-default.yaml` into `src/main/resources`:
82+
83+
```yaml
84+
myprops:
85+
foo: "bar"
86+
zee: 42
87+
baz: true
88+
```
89+
90+
91+
# License
92+
93+
This library is published under the Apache 2.0 license.

bom/pom.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>io.toolisticon.spring</groupId>
77
<artifactId>spring-boot-support</artifactId>
8-
<version>1.0.0</version>
8+
<version>1.0.1</version>
99
</parent>
1010

1111
<artifactId>spring-boot-support-bom</artifactId>
@@ -19,6 +19,11 @@
1919
<artifactId>spring-boot-conditions</artifactId>
2020
<version>${project.version}</version>
2121
</dependency>
22+
<dependency>
23+
<groupId>${project.groupId}</groupId>
24+
<artifactId>spring-boot-properties</artifactId>
25+
<version>${project.version}</version>
26+
</dependency>
2227
</dependencies>
2328
</dependencyManagement>
2429
</project>

pom.xml

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,21 @@
55
<parent>
66
<groupId>io.toolisticon.maven.parent</groupId>
77
<artifactId>maven-parent-kotlin-base</artifactId>
8-
<version>2025.2.1</version>
8+
<version>2025.7.2</version>
99
<relativePath/>
1010
</parent>
1111

1212
<groupId>io.toolisticon.spring</groupId>
1313
<artifactId>spring-boot-support</artifactId>
14-
<version>1.0.0</version>
14+
<version>1.0.1</version>
1515
<name>Spring-Boot Support Root</name>
1616
<description>Spring-Boot useful support tools and classses.</description>
1717
<url>https://github.com/toolisticon/spring-boot-support/</url>
1818
<packaging>pom</packaging>
1919

2020
<modules>
2121
<module>spring-boot-conditions</module>
22+
<module>spring-boot-properties</module>
2223
<module>bom</module>
2324
</modules>
2425

@@ -27,7 +28,7 @@
2728
<dependency>
2829
<groupId>org.springframework.boot</groupId>
2930
<artifactId>spring-boot-dependencies</artifactId>
30-
<version>3.4.3</version>
31+
<version>3.5.3</version>
3132
<scope>import</scope>
3233
<type>pom</type>
3334
</dependency>
@@ -77,6 +78,13 @@
7778
<plugin>
7879
<groupId>org.jetbrains.kotlin</groupId>
7980
<artifactId>kotlin-maven-plugin</artifactId>
81+
<configuration>
82+
<compilerPlugins>
83+
<plugin>spring</plugin>
84+
<plugin>no-arg</plugin>
85+
<plugin>all-open</plugin>
86+
</compilerPlugins>
87+
</configuration>
8088
</plugin>
8189
<plugin>
8290
<groupId>org.apache.maven.plugins</groupId>
@@ -103,17 +111,6 @@
103111
<tag>HEAD</tag>
104112
</scm>
105113

106-
<distributionManagement>
107-
<snapshotRepository>
108-
<id>ossrh</id>
109-
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
110-
</snapshotRepository>
111-
<repository>
112-
<id>ossrh</id>
113-
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
114-
</repository>
115-
</distributionManagement>
116-
117114
<developers>
118115
<developer>
119116
<id>jangalinski</id>

spring-boot-conditions/pom.xml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>io.toolisticon.spring</groupId>
77
<artifactId>spring-boot-support</artifactId>
8-
<version>1.0.0</version>
8+
<version>1.0.1</version>
99
</parent>
1010

1111
<artifactId>spring-boot-conditions</artifactId>
@@ -28,5 +28,16 @@
2828
<artifactId>slf4j-api</artifactId>
2929
<scope>provided</scope>
3030
</dependency>
31+
32+
<dependency>
33+
<groupId>org.springframework.boot</groupId>
34+
<artifactId>spring-boot-test</artifactId>
35+
<scope>test</scope>
36+
</dependency>
37+
<dependency>
38+
<groupId>org.slf4j</groupId>
39+
<artifactId>slf4j-simple</artifactId>
40+
<scope>test</scope>
41+
</dependency>
3142
</dependencies>
3243
</project>

spring-boot-conditions/src/test/java/.gitkeep

Whitespace-only changes.

spring-boot-conditions/src/test/kotlin/.gitkeep

Whitespace-only changes.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package io.toolisticon.spring.condition
2+
3+
import com.sun.tools.javac.util.AbstractDiagnosticFormatter
4+
import io.toolisticon.spring.condition.fixture.MyComponent
5+
import io.toolisticon.spring.condition.fixture.MyTestConfiguration
6+
import io.toolisticon.spring.condition.fixture.SimpleConfiguration
7+
import org.assertj.core.api.Assertions.assertThat
8+
import org.junit.jupiter.api.Test
9+
import org.springframework.boot.context.annotation.UserConfigurations
10+
import org.springframework.boot.test.context.runner.ApplicationContextRunner
11+
12+
class ConditionalOnMissingQualifiedBeanTest {
13+
14+
private val contextRunner = ApplicationContextRunner()
15+
16+
@Test
17+
fun `should load qualified default bean`() {
18+
contextRunner
19+
.withConfiguration(UserConfigurations.of(MyTestConfiguration::class.java))
20+
.run {
21+
assertThat(it.getBean(MyComponent::class.java)).isNotNull
22+
val component: MyComponent = it.getBean(MyComponent::class.java)
23+
assertThat(component.qualifier).isEqualTo("qualifier1")
24+
}
25+
}
26+
27+
@Test
28+
fun `should load user qualified bean`() {
29+
contextRunner
30+
.withConfiguration(UserConfigurations.of(SimpleConfiguration::class.java))
31+
.withConfiguration(UserConfigurations.of(MyTestConfiguration::class.java))
32+
.run {
33+
assertThat(it.getBean(MyComponent::class.java)).isNotNull
34+
val component: MyComponent = it.getBean(MyComponent::class.java)
35+
assertThat(component.qualifier).isEqualTo("qualifier2")
36+
}
37+
}
38+
39+
}

0 commit comments

Comments
 (0)