Skip to content

Commit 32fcf5b

Browse files
committed
updated to spring boot 2.5.0
1 parent 1a0e55d commit 32fcf5b

File tree

8 files changed

+58
-18
lines changed

8 files changed

+58
-18
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Extendable store types. JDBC store as default.
1212
<dependency>
1313
<groupId>com.ttulka.spring.boot.configstore</groupId>
1414
<artifactId>configuration-properties-store-jdbc-spring-boot-starter</artifactId>
15-
<version>1.2.6</version>
15+
<version>1.3.0</version>
1616
</dependency>
1717
```
1818

api/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>com.ttulka.spring.boot.configstore</groupId>
88
<artifactId>configuration-properties-store-parent</artifactId>
9-
<version>1.2.6-SNAPSHOT</version>
9+
<version>1.3.0-SNAPSHOT</version>
1010
<relativePath>../pom.xml</relativePath>
1111
</parent>
1212
<artifactId>configuration-properties-store-api</artifactId>

examples/sample-app/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
<parent>
77
<groupId>org.springframework.boot</groupId>
88
<artifactId>spring-boot-starter-parent</artifactId>
9-
<version>2.4.6</version>
9+
<version>2.5.0</version>
1010
</parent>
1111
<groupId>com.ttulka.spring.configstore</groupId>
1212
<artifactId>sample-app</artifactId>
13-
<version>1.2.6-SNAPSHOT</version>
13+
<version>1.3.0-SNAPSHOT</version>
1414

1515
<dependencies>
1616
<dependency>

jdbc-store/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>com.ttulka.spring.boot.configstore</groupId>
88
<artifactId>configuration-properties-store-parent</artifactId>
9-
<version>1.2.6-SNAPSHOT</version>
9+
<version>1.3.0-SNAPSHOT</version>
1010
<relativePath>../pom.xml</relativePath>
1111
</parent>
1212
<artifactId>configuration-properties-store-jdbc</artifactId>
@@ -19,7 +19,7 @@
1919
<dependency>
2020
<groupId>com.ttulka.spring.boot.configstore</groupId>
2121
<artifactId>configuration-properties-store-api</artifactId>
22-
<version>1.2.6-SNAPSHOT</version>
22+
<version>1.3.0-SNAPSHOT</version>
2323
</dependency>
2424
<dependency>
2525
<groupId>org.springframework</groupId>

pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66

77
<groupId>com.ttulka.spring.boot.configstore</groupId>
88
<artifactId>configuration-properties-store-parent</artifactId>
9-
<version>1.2.6-SNAPSHOT</version>
9+
<version>1.3.0-SNAPSHOT</version>
1010
<packaging>pom</packaging>
1111

1212
<name>Configuration Properties Store for Spring Boot - Parent</name>
1313
<description>Mutable persistent configuration properties that survive an application restart.</description>
1414
<url>https://github.com/ttulka/spring-boot-configuration-properties-store</url>
1515

1616
<properties>
17-
<spring.boot.version>2.4.6</spring.boot.version>
17+
<spring.boot.version>2.5.0</spring.boot.version>
1818
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1919
</properties>
2020

@@ -65,7 +65,7 @@
6565
<plugin>
6666
<groupId>org.codehaus.mojo</groupId>
6767
<artifactId>versions-maven-plugin</artifactId>
68-
<version>2.7</version>
68+
<version>2.8.1</version>
6969
</plugin>
7070
</plugins>
7171
</build>
@@ -77,7 +77,7 @@
7777
<plugins>
7878
<plugin>
7979
<artifactId>maven-javadoc-plugin</artifactId>
80-
<version>3.2.0</version>
80+
<version>3.3.0</version>
8181
<executions>
8282
<execution>
8383
<id>attach-javadocs</id>
@@ -101,7 +101,7 @@
101101
</plugin>
102102
<plugin>
103103
<artifactId>maven-gpg-plugin</artifactId>
104-
<version>1.6</version>
104+
<version>3.0.1</version>
105105
<executions>
106106
<execution>
107107
<id>sign-artifacts</id>

starter-base/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>com.ttulka.spring.boot.configstore</groupId>
88
<artifactId>configuration-properties-store-parent</artifactId>
9-
<version>1.2.6-SNAPSHOT</version>
9+
<version>1.3.0-SNAPSHOT</version>
1010
<relativePath>../pom.xml</relativePath>
1111
</parent>
1212
<artifactId>configuration-properties-store-spring-boot-starter-base</artifactId>
@@ -19,7 +19,7 @@
1919
<dependency>
2020
<groupId>com.ttulka.spring.boot.configstore</groupId>
2121
<artifactId>configuration-properties-store-api</artifactId>
22-
<version>1.2.6-SNAPSHOT</version>
22+
<version>1.3.0-SNAPSHOT</version>
2323
</dependency>
2424
<dependency>
2525
<groupId>org.springframework.boot</groupId>

starter-base/src/main/java/org/springframework/boot/context/properties/ConversionServiceRetriever.java

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
package org.springframework.boot.context.properties;
22

3+
import java.util.List;
34
import lombok.RequiredArgsConstructor;
45
import org.springframework.context.ApplicationContext;
56
import org.springframework.core.convert.ConversionService;
7+
import org.springframework.core.convert.ConverterNotFoundException;
8+
import org.springframework.core.convert.TypeDescriptor;
9+
import org.springframework.lang.Nullable;
10+
import org.springframework.util.Assert;
611

712
/**
813
* Provides an access to {@link ConversionServiceDeducer} to retrieve {@link ConversionService}.
@@ -13,6 +18,41 @@ public class ConversionServiceRetriever {
1318
private final ApplicationContext applicationContext;
1419

1520
public ConversionService getConversionService() {
16-
return new ConversionServiceDeducer(this.applicationContext).getConversionService();
21+
return new ComposedConversionService(
22+
new ConversionServiceDeducer(this.applicationContext).getConversionServices());
23+
}
24+
25+
@RequiredArgsConstructor
26+
private class ComposedConversionService implements ConversionService {
27+
28+
private final List<ConversionService> conversionServices;
29+
30+
@Override
31+
public boolean canConvert(@Nullable Class<?> sourceType, Class<?> targetType) {
32+
return conversionServices.stream()
33+
.anyMatch(cs -> cs.canConvert(sourceType, targetType));
34+
}
35+
36+
@Override
37+
public boolean canConvert(@Nullable TypeDescriptor sourceType, TypeDescriptor targetType) {
38+
return conversionServices.stream()
39+
.anyMatch(cs -> cs.canConvert(sourceType, targetType));
40+
}
41+
42+
@Override
43+
public <T> T convert(@Nullable Object source, Class<T> targetType) {
44+
Assert.notNull(targetType, "Target type to convert to cannot be null");
45+
return (T) convert(source, TypeDescriptor.forObject(source), TypeDescriptor.valueOf(targetType));
46+
}
47+
48+
@Override
49+
public Object convert(@Nullable Object source, @Nullable TypeDescriptor sourceType, TypeDescriptor targetType) {
50+
Assert.notNull(targetType, "Target type to convert to cannot be null");
51+
return conversionServices.stream()
52+
.filter(cs -> cs.canConvert(sourceType, targetType))
53+
.findAny()
54+
.map(cs -> cs.convert(source, sourceType, targetType))
55+
.orElseThrow(() -> new ConverterNotFoundException(sourceType, targetType));
56+
}
1757
}
1858
}

starter-jdbc/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>com.ttulka.spring.boot.configstore</groupId>
88
<artifactId>configuration-properties-store-parent</artifactId>
9-
<version>1.2.6-SNAPSHOT</version>
9+
<version>1.3.0-SNAPSHOT</version>
1010
<relativePath>../pom.xml</relativePath>
1111
</parent>
1212
<artifactId>configuration-properties-store-jdbc-spring-boot-starter</artifactId>
@@ -19,17 +19,17 @@
1919
<dependency>
2020
<groupId>com.ttulka.spring.boot.configstore</groupId>
2121
<artifactId>configuration-properties-store-api</artifactId>
22-
<version>1.2.6-SNAPSHOT</version>
22+
<version>1.3.0-SNAPSHOT</version>
2323
</dependency>
2424
<dependency>
2525
<groupId>com.ttulka.spring.boot.configstore</groupId>
2626
<artifactId>configuration-properties-store-spring-boot-starter-base</artifactId>
27-
<version>1.2.6-SNAPSHOT</version>
27+
<version>1.3.0-SNAPSHOT</version>
2828
</dependency>
2929
<dependency>
3030
<groupId>com.ttulka.spring.boot.configstore</groupId>
3131
<artifactId>configuration-properties-store-jdbc</artifactId>
32-
<version>1.2.6-SNAPSHOT</version>
32+
<version>1.3.0-SNAPSHOT</version>
3333
</dependency>
3434
<dependency>
3535
<groupId>org.springframework.boot</groupId>

0 commit comments

Comments
 (0)