-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from maoudia/feature/upgrade-records-config
Switch to Java Records configuration
- Loading branch information
Showing
7 changed files
with
190 additions
and
115 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
bulk-update-with-spring-data-mongodb-reactive/.run/Application.run.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="Application" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" nameIsGenerated="true"> | ||
<option name="ACTIVE_PROFILES" value="dev" /> | ||
<envs> | ||
<env name="spring.profiles.active" value="test" /> | ||
<env name="reactor.schedulers.defaultBoundedElasticOnVirtualThreads" value="true" /> | ||
</envs> | ||
<module name="bulk-update-with-spring-data-mongodb-reactive" /> | ||
<option name="SPRING_BOOT_MAIN_CLASS" value="com.maoudia.tutorial.Application" /> | ||
<method v="2"> | ||
<option name="Make" enabled="true" /> | ||
</method> | ||
</configuration> | ||
</component> |
23 changes: 23 additions & 0 deletions
23
bulk-update-with-spring-data-mongodb-reactive/.run/CollectionServiceTest.run.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="CollectionServiceTest" type="JUnit" factoryName="JUnit" nameIsGenerated="true"> | ||
<module name="bulk-update-with-spring-data-mongodb-reactive" /> | ||
<extension name="coverage"> | ||
<pattern> | ||
<option name="PATTERN" value="com.maoudia.tutorial.*" /> | ||
<option name="ENABLED" value="true" /> | ||
</pattern> | ||
</extension> | ||
<option name="PACKAGE_NAME" value="com.maoudia.tutorial" /> | ||
<option name="MAIN_CLASS_NAME" value="com.maoudia.tutorial.CollectionServiceTest" /> | ||
<option name="METHOD_NAME" value="" /> | ||
<option name="TEST_OBJECT" value="class" /> | ||
<option name="VM_PARAMETERS" /> | ||
<envs> | ||
<env name="spring.profiles.active" value="test" /> | ||
<env name="reactor.schedulers.defaultBoundedElasticOnVirtualThreads" value="true" /> | ||
</envs> | ||
<method v="2"> | ||
<option name="Make" enabled="true" /> | ||
</method> | ||
</configuration> | ||
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,87 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-parent</artifactId> | ||
<version>3.1.5</version> | ||
<relativePath/> <!-- lookup parent from repository --> | ||
</parent> | ||
<groupId>com.maoudia</groupId> | ||
<artifactId>bulk-update-with-spring-data-mongodb-reactive</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<name>Bulk Update with Spring data MongoDB Reactive</name> | ||
<description>Bulk Update with Spring data MongoDB Reactive</description> | ||
<properties> | ||
<java.version>21</java.version> | ||
</properties> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-data-mongodb-reactive</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-webflux</artifactId> | ||
</dependency> | ||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-parent</artifactId> | ||
<version>3.2.2</version> | ||
<relativePath/> <!-- lookup parent from repository --> | ||
</parent> | ||
<groupId>com.maoudia</groupId> | ||
<artifactId>bulk-update-with-spring-data-mongodb-reactive</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<name>Bulk Update with Spring data MongoDB Reactive</name> | ||
<description>Bulk Update with Spring data MongoDB Reactive</description> | ||
<properties> | ||
<java.version>21</java.version> | ||
<netty-resolver-dns-native-macos.version>4.1.76.Final</netty-resolver-dns-native-macos.version> | ||
</properties> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-webflux</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-data-mongodb-reactive</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-validation</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-configuration-processor</artifactId> | ||
<optional>true</optional> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.projectreactor</groupId> | ||
<artifactId>reactor-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.testcontainers</groupId> | ||
<artifactId>junit-jupiter</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.testcontainers</groupId> | ||
<artifactId>mongodb</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.projectreactor</groupId> | ||
<artifactId>reactor-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.testcontainers</groupId> | ||
<artifactId>junit-jupiter</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.testcontainers</groupId> | ||
<artifactId>mongodb</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<profiles> | ||
<profile> | ||
<id>macos-arm</id> | ||
<activation> | ||
<os> | ||
<family>mac</family> | ||
<arch>aarch64</arch> | ||
</os> | ||
</activation> | ||
<dependencies> | ||
<dependency> | ||
<groupId>io.netty</groupId> | ||
<artifactId>netty-resolver-dns-native-macos</artifactId> | ||
<version>${netty-resolver-dns-native-macos.version}</version> | ||
<classifier>osx-aarch_64</classifier> | ||
</dependency> | ||
</dependencies> | ||
</profile> | ||
</profiles> | ||
</project> |
92 changes: 46 additions & 46 deletions
92
...e-with-spring-data-mongodb-reactive/src/main/java/com/maoudia/tutorial/AppProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,52 @@ | ||
package com.maoudia.tutorial; | ||
|
||
import jakarta.validation.constraints.NotBlank; | ||
import jakarta.validation.constraints.NotNull; | ||
import jakarta.validation.constraints.Positive; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.boot.context.properties.bind.DefaultValue; | ||
import org.springframework.validation.annotation.Validated; | ||
|
||
import java.net.URI; | ||
|
||
/** | ||
* Configuration properties for the application. | ||
* These properties are bound from the application.yml (or application.properties) file using the specified prefix. | ||
*/ | ||
@ConfigurationProperties(prefix = "app") | ||
public class AppProperties{ | ||
private int bulkSize; | ||
private int bufferMaxSize; | ||
private String collectionName; | ||
private String enrichingKey; | ||
private String enrichingUri; | ||
|
||
public int getBulkSize() { | ||
return bulkSize; | ||
} | ||
|
||
public void setBulkSize(final int bulkSize) { | ||
this.bulkSize = bulkSize; | ||
} | ||
|
||
public int getBufferMaxSize() { | ||
return bufferMaxSize; | ||
} | ||
|
||
public void setBufferMaxSize(final int bufferMaxSize) { | ||
this.bufferMaxSize = bufferMaxSize; | ||
} | ||
|
||
public String getCollectionName() { | ||
return collectionName; | ||
} | ||
|
||
public void setCollectionName(final String collectionName) { | ||
this.collectionName = collectionName; | ||
} | ||
|
||
public String getEnrichingKey() { | ||
return enrichingKey; | ||
} | ||
|
||
public void setEnrichingKey(final String enrichingKey) { | ||
this.enrichingKey = enrichingKey; | ||
} | ||
|
||
public String getEnrichingUri() { | ||
return enrichingUri; | ||
} | ||
|
||
public void setEnrichingUri(final String enrichingUri) { | ||
this.enrichingUri = enrichingUri; | ||
} | ||
@Validated | ||
public record AppProperties( | ||
|
||
/* | ||
* The bulk size configuration. | ||
*/ | ||
@DefaultValue("128") | ||
@Positive | ||
int bulkSize, | ||
|
||
/* | ||
* The maximum buffer size configuration. | ||
*/ | ||
@DefaultValue("1024") | ||
@Positive | ||
int bufferMaxSize, | ||
|
||
/* | ||
* The name of the collection. | ||
*/ | ||
@NotBlank | ||
String collectionName, | ||
|
||
/* | ||
* The key used for enriching. | ||
*/ | ||
@NotBlank | ||
String enrichingKey, | ||
|
||
/* | ||
* The URI used for enriching. | ||
*/ | ||
@NotNull | ||
URI enrichingUri | ||
) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters