Skip to content

Commit

Permalink
Upgrade micronaut to v4.3.7 (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
skykanin authored Feb 26, 2024
1 parent 060fed5 commit 8ab7f0c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 31 deletions.
34 changes: 15 additions & 19 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
<jsonassert.version>1.5.1</jsonassert.version>
<logback.version>1.4.6</logback.version>
<lombok.version>1.18.30</lombok.version>
<micronaut.version>3.9.4</micronaut.version>
<micronaut.version>4.3.7</micronaut.version>
<micronaut.validation.version>4.4.0</micronaut.validation.version>
<rxjava-extras.version>0.2.2</rxjava-extras.version>
<tika.version>1.28.5</tika.version>
<tink.version>1.8.0</tink.version>
Expand Down Expand Up @@ -72,9 +73,9 @@
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-bom</artifactId>
<version>${micronaut.version}</version>
<groupId>io.micronaut.platform</groupId>
<artifactId>micronaut-platform</artifactId>
<version>4.3.0</version>
<scope>import</scope>
<type>pom</type>
</dependency>
Expand All @@ -85,21 +86,13 @@
<dependency>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-inject</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-validation</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-runtime</artifactId>
<version>${micronaut.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-http</artifactId>
<version>${micronaut.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -150,6 +143,10 @@
<artifactId>rxjava2-extras</artifactId>
<version>${rxjava-extras.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<dependency>
<groupId>com.univocity</groupId>
<artifactId>univocity-parsers</artifactId>
Expand Down Expand Up @@ -200,7 +197,6 @@
<scope>test</scope>
</dependency>
</dependencies>

<build>
<pluginManagement>
<plugins>
Expand Down Expand Up @@ -241,9 +237,9 @@
<version>${micronaut.version}</version>
</path>
<path>
<groupId>io.micronaut</groupId>
<groupId>io.micronaut.validation</groupId>
<artifactId>micronaut-validation</artifactId>
<version>${micronaut.version}</version>
<version>${micronaut.validation.version}</version>
</path>
</annotationProcessorPaths>
<compilerArgs>
Expand All @@ -270,9 +266,9 @@
<version>${micronaut.version}</version>
</path>
<path>
<groupId>io.micronaut</groupId>
<groupId>io.micronaut.validation</groupId>
<artifactId>micronaut-validation</artifactId>
<version>${micronaut.version}</version>
<version>${micronaut.validation.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
package no.ssb.dlp.pseudo.core.typeconverter;

import io.micronaut.context.annotation.Bean;
import io.micronaut.core.convert.ConversionContext;
import io.micronaut.core.convert.ConversionService;
import io.micronaut.core.convert.TypeConverter;
import lombok.RequiredArgsConstructor;
import jakarta.inject.Singleton;
import no.ssb.dlp.pseudo.core.PseudoSecret;

import java.nio.charset.StandardCharsets;
import java.util.Map;
import java.util.Optional;

public class PseudoSecretTypeConverter implements TypeConverter<Map, PseudoSecret> {
@Singleton
@Bean
public class PseudoSecretTypeConverter implements TypeConverter<Map<String, Object>, PseudoSecret> {

@Override
public Optional<PseudoSecret> convert(Map propertyMap, Class<PseudoSecret> targetType, ConversionContext context) {
public Optional<PseudoSecret> convert(
Map<String, Object> propertyMap,
Class<PseudoSecret> targetType,
ConversionContext context) {
PropertyAccessor props = new PropertyAccessor(propertyMap);
PseudoSecret.PseudoSecretBuilder builder = PseudoSecret.builder()
.name(props.optionalString("name"))
Expand All @@ -35,13 +41,9 @@ else if (propertyMap.containsKey("rawcontent")) {
: Optional.of(pseudoSecret);
}

@RequiredArgsConstructor
private static class PropertyAccessor {
private final Map propertyMap;

String optionalString(String key) {
return ConversionService.SHARED.convert(propertyMap.get(key), String.class).orElse(null);
private record PropertyAccessor(Map<String, Object> propertyMap) {
String optionalString(String key) {
return ConversionService.SHARED.convert(propertyMap.get(key), String.class).orElse(null);
}
}
}

}
}

0 comments on commit 8ab7f0c

Please sign in to comment.