Skip to content

Commit 31a9b4c

Browse files
committed
Tightup implementation.
1 parent 0ebf685 commit 31a9b4c

File tree

4 files changed

+45
-35
lines changed

4 files changed

+45
-35
lines changed

essentialprogramming-jobs/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
<dependency>
114114
<groupId>org.jobrunr</groupId>
115115
<artifactId>jobrunr</artifactId>
116-
<version>5.1.6</version>
116+
<version>5.3.1</version>
117117
</dependency>
118118

119119
</dependencies>

essentialprogramming-util/pom.xml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,6 @@
1919

2020
<dependencies>
2121

22-
<!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
23-
<dependency>
24-
<groupId>javax.servlet</groupId>
25-
<artifactId>javax.servlet-api</artifactId>
26-
<version>4.0.0</version>
27-
<scope>provided</scope>
28-
</dependency>
29-
30-
<!-- https://mvnrepository.com/artifact/javax.ws.rs/javax.ws.rs-api -->
31-
<dependency>
32-
<groupId>javax.ws.rs</groupId>
33-
<artifactId>javax.ws.rs-api</artifactId>
34-
<version>2.1.1</version>
35-
</dependency>
36-
37-
3822
<!-- Spring -->
3923
<dependency>
4024
<groupId>org.springframework</groupId>

essentialprogramming-util/src/main/java/com/util/cloud/Environment.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,24 @@ public interface Environment {
1111

1212
Function<String, String> propertyLoader = (key) -> System.getenv().getOrDefault(key, System.getProperty(key));
1313

14+
/**
15+
* Return the value for the given key converted to the type of the default value.
16+
* If the value is null, defaultValue is returned.
17+
*/
1418
@SuppressWarnings("unchecked")
15-
static <T> T getProperty(String key, T fallback) {
16-
final String type = fallback != null ? fallback.getClass().getSimpleName().toUpperCase() : "STRING";
19+
static <T> T getProperty(String key, T defaultValue) {
20+
final String type = defaultValue != null
21+
? defaultValue.getClass().getSimpleName().toUpperCase()
22+
: "STRING";
23+
1724
final String value = propertyLoader.apply(key);
1825
final T returnValue = (T) Types.valueOf(type).getValue(value);
19-
20-
return Optional.ofNullable(returnValue).orElse(fallback);
26+
return Optional
27+
.ofNullable(returnValue)
28+
.orElse(defaultValue);
2129
}
2230

31+
2332
enum Types {
2433
STRING {
2534
public String getValue(String value) {

parent/pom.xml

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,31 @@
1919
<io.swagger.version>2.0.6</io.swagger.version>
2020
<com.fasterxml.jackson.version>2.12.5</com.fasterxml.jackson.version>
2121
<kotlin.version>1.3.10</kotlin.version>
22-
<org.springframework.version>5.2.20.RELEASE</org.springframework.version>
22+
<org.springframework.version>5.3.23</org.springframework.version>
2323
<org.spring-security.version>5.6.1</org.spring-security.version>
24-
<org.spring-data.version>2.3.9.RELEASE</org.spring-data.version>
24+
<org.spring-data.version>2.7.5</org.spring-data.version>
2525
<hibernate.version>5.6.9.Final</hibernate.version>
2626
<log4j.version>2.18.0</log4j.version>
2727
</properties>
2828

2929

3030
<dependencies>
3131

32+
<!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
33+
<dependency>
34+
<groupId>javax.servlet</groupId>
35+
<artifactId>javax.servlet-api</artifactId>
36+
<version>4.0.0</version>
37+
<scope>provided</scope>
38+
</dependency>
39+
40+
<!-- https://mvnrepository.com/artifact/javax.ws.rs/javax.ws.rs-api -->
41+
<dependency>
42+
<groupId>javax.ws.rs</groupId>
43+
<artifactId>javax.ws.rs-api</artifactId>
44+
<version>2.1.1</version>
45+
</dependency>
46+
3247
<!-- HikariCP -->
3348
<dependency>
3449
<groupId>com.zaxxer</groupId>
@@ -151,6 +166,20 @@
151166
<version>${com.fasterxml.jackson.version}</version>
152167
</dependency>
153168

169+
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.dataformat/jackson-dataformat-yaml -->
170+
<dependency>
171+
<groupId>com.fasterxml.jackson.dataformat</groupId>
172+
<artifactId>jackson-dataformat-yaml</artifactId>
173+
<version>${com.fasterxml.jackson.version}</version>
174+
</dependency>
175+
176+
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.jaxrs/jackson-jaxrs-json-provider -->
177+
<dependency>
178+
<groupId>com.fasterxml.jackson.jaxrs</groupId>
179+
<artifactId>jackson-jaxrs-json-provider</artifactId>
180+
<version>${com.fasterxml.jackson.version}</version>
181+
</dependency>
182+
154183
<!-- Project lombok -->
155184
<dependency>
156185
<groupId>org.projectlombok</groupId>
@@ -217,19 +246,7 @@
217246
<version>3.12.0</version>
218247
</dependency>
219248

220-
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.dataformat/jackson-dataformat-yaml -->
221-
<dependency>
222-
<groupId>com.fasterxml.jackson.dataformat</groupId>
223-
<artifactId>jackson-dataformat-yaml</artifactId>
224-
<version>2.12.5</version>
225-
</dependency>
226249

227-
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.jaxrs/jackson-jaxrs-json-provider -->
228-
<dependency>
229-
<groupId>com.fasterxml.jackson.jaxrs</groupId>
230-
<artifactId>jackson-jaxrs-json-provider</artifactId>
231-
<version>2.12.5</version>
232-
</dependency>
233250

234251
<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
235252
<dependency>

0 commit comments

Comments
 (0)