JAVA-4012: fix failing test (#10455)

This commit is contained in:
osser-sam 2021-02-03 01:16:00 +05:30 committed by GitHub
parent 7d78e63edf
commit cfbdbe1001
2 changed files with 2 additions and 24 deletions

View File

@ -1,11 +1,8 @@
package com.baeldung.zoneddatetime.config;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.convert.converter.Converter;
import org.springframework.data.mongodb.config.AbstractMongoClientConfiguration;
import org.springframework.data.mongodb.core.convert.MongoCustomConversions;
@ -13,12 +10,7 @@ import org.springframework.data.mongodb.repository.config.EnableMongoRepositorie
import com.baeldung.zoneddatetime.converter.ZonedDateTimeReadConverter;
import com.baeldung.zoneddatetime.converter.ZonedDateTimeWriteConverter;
import com.mongodb.ConnectionString;
import com.mongodb.MongoClientSettings;
import com.mongodb.client.MongoClient;
import com.mongodb.client.MongoClients;
@Configuration
@EnableMongoRepositories(basePackages = { "com.baeldung" })
public class MongoConfig extends AbstractMongoClientConfiguration {
@ -29,20 +21,6 @@ public class MongoConfig extends AbstractMongoClientConfiguration {
return "test";
}
@Override
public MongoClient mongoClient() {
final ConnectionString connectionString = new ConnectionString("mongodb://localhost:27017/test");
final MongoClientSettings mongoClientSettings = MongoClientSettings.builder()
.applyConnectionString(connectionString)
.build();
return MongoClients.create(mongoClientSettings);
}
@Override
public Collection<String> getMappingBasePackages() {
return Collections.singleton("com.baeldung");
}
@Override
public MongoCustomConversions customConversions() {
converters.add(new ZonedDateTimeReadConverter());

View File

@ -24,8 +24,8 @@
<constructor-arg ref="mongoConverter" />
</bean>
<mongo:mapping-converter id="mongoConverter" base-package="com.baeldung.converter">
<mongo:custom-converters base-package="com.baeldung.converter" />
<mongo:mapping-converter id="mongoConverter" base-package="com.baeldung.zoneddatetime.converter">
<mongo:custom-converters base-package="com.baeldung.zoneddatetime.converter" />
</mongo:mapping-converter>
</beans>