Skip to content

Commit 1f34e8d

Browse files
committed
Merge pull request #47654 from izeye
* pr/47654: Polish "Fix binding of spring.mongodb.representation.uuid" Fix binding of spring.mongodb.representation.uuid Closes gh-47654
2 parents 6cebe3a + 7bfeb7a commit 1f34e8d

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

module/spring-boot-mongodb/src/main/java/org/springframework/boot/mongodb/autoconfigure/MongoProperties.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,8 @@ public UuidRepresentation getUuid() {
218218
return this.uuid;
219219
}
220220

221-
public void setUuidRepresentation(UuidRepresentation uuidRepresentation) {
222-
this.uuid = uuidRepresentation;
221+
public void setUuid(UuidRepresentation uuid) {
222+
this.uuid = uuid;
223223
}
224224

225225
}

module/spring-boot-mongodb/src/test/java/org/springframework/boot/mongodb/autoconfigure/MongoAutoConfigurationTests.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import com.mongodb.client.internal.MongoClientImpl;
2727
import com.mongodb.connection.ClusterConnectionMode;
2828
import com.mongodb.connection.SslSettings;
29+
import org.bson.UuidRepresentation;
2930
import org.junit.jupiter.api.Test;
3031

3132
import org.springframework.boot.autoconfigure.AutoConfigurations;
@@ -231,6 +232,13 @@ void configuresCredentialsFromUriPropertyWithAuthDatabase() {
231232
});
232233
}
233234

235+
@Test
236+
void configureUUidRepresentation() {
237+
this.contextRunner.withPropertyValues("spring.mongodb.representation.uuid=standard")
238+
.run((context) -> assertThat(getSettings(context).getUuidRepresentation())
239+
.isEqualTo(UuidRepresentation.STANDARD));
240+
}
241+
234242
@Test
235243
void configuresSingleClient() {
236244
this.contextRunner.withUserConfiguration(FallbackMongoClientConfig.class)

0 commit comments

Comments
 (0)