[JAVA-32759] Split-or-move-spring-boot-persistence-mongodb (#16392)
This commit is contained in:
parent
2685d31fd1
commit
684ee81ed1
|
@ -69,6 +69,7 @@
|
|||
<module>spring-boot-persistence-mongodb</module>
|
||||
<module>spring-boot-persistence-mongodb-2</module>
|
||||
<module>spring-boot-persistence-mongodb-3</module>
|
||||
<module>spring-boot-persistence-mongodb-4</module>
|
||||
<module>spring-data-arangodb</module>
|
||||
<!--<module>spring-data-cassandra</module>--> <!-- failing after upgrading to jdk17. JDK 17 compatibility in progress CASSANDRA-16895 -->
|
||||
<module>spring-data-cassandra-test</module>
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
# Relevant Articles
|
||||
|
||||
- [ZonedDateTime with Spring Data MongoDB](https://www.baeldung.com/spring-data-mongodb-zoneddatetime)
|
||||
- [A Guide to @DBRef in MongoDB](https://www.baeldung.com/spring-mongodb-dbref-annotation)
|
||||
- More articles: [[<--prev]](../spring-boot-persistence-mongodb-3)
|
|
@ -0,0 +1,34 @@
|
|||
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>spring-boot-persistence-mongodb-4</artifactId>
|
||||
<name>spring-boot-persistence-mongodb-4</name>
|
||||
<description>This is simple boot application for Spring boot persistence mongodb test</description>
|
||||
|
||||
<parent>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>parent-boot-2</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../../parent-boot-2</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<!-- MongoDB -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-mongodb</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.flapdoodle.embed</groupId>
|
||||
<artifactId>de.flapdoodle.embed.mongo</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -1,5 +1,6 @@
|
|||
package com.baeldung.mongodb.dbref;
|
||||
|
||||
import com.baeldung.mongodb.dbref.repository.PersonRepository;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -7,8 +8,6 @@ import org.springframework.boot.ApplicationArguments;
|
|||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.baeldung.mongodb.dbref.repository.PersonRepository;
|
||||
|
||||
@Component
|
||||
public class DbRefTester implements ApplicationRunner {
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
package com.baeldung.mongodb.dbref.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.mongodb.core.mapping.DBRef;
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Document(collection = "Person")
|
||||
public class Person {
|
||||
|
|
@ -1,8 +1,7 @@
|
|||
package com.baeldung.mongodb.dbref.repository;
|
||||
|
||||
import org.springframework.data.mongodb.repository.MongoRepository;
|
||||
|
||||
import com.baeldung.mongodb.dbref.model.Person;
|
||||
import org.springframework.data.mongodb.repository.MongoRepository;
|
||||
|
||||
public interface PersonRepository extends MongoRepository<Person, String> {
|
||||
|
|
@ -1,15 +1,14 @@
|
|||
package com.baeldung.zoneddatetime.config;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.baeldung.zoneddatetime.converter.ZonedDateTimeReadConverter;
|
||||
import com.baeldung.zoneddatetime.converter.ZonedDateTimeWriteConverter;
|
||||
import org.springframework.core.convert.converter.Converter;
|
||||
import org.springframework.data.mongodb.config.AbstractMongoClientConfiguration;
|
||||
import org.springframework.data.mongodb.core.convert.MongoCustomConversions;
|
||||
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
|
||||
|
||||
import com.baeldung.zoneddatetime.converter.ZonedDateTimeReadConverter;
|
||||
import com.baeldung.zoneddatetime.converter.ZonedDateTimeWriteConverter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@EnableMongoRepositories(basePackages = { "com.baeldung" })
|
||||
public class MongoConfig extends AbstractMongoClientConfiguration {
|
|
@ -1,7 +1,6 @@
|
|||
package com.baeldung.zoneddatetime.repository;
|
||||
|
||||
import com.baeldung.zoneddatetime.model.Action;
|
||||
import org.springframework.data.mongodb.repository.MongoRepository;
|
||||
|
||||
import com.baeldung.zoneddatetime.model.Action;
|
||||
|
||||
public interface ActionRepository extends MongoRepository<Action, String> { }
|
|
@ -0,0 +1 @@
|
|||
spring.application.name=spring-boot-persistence-mongodb-4
|
|
@ -1,11 +1,11 @@
|
|||
package com.baeldung.mongodb.dbref;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.baeldung.mongodb.dbref.model.Person;
|
||||
import com.baeldung.mongodb.dbref.model.Pet;
|
||||
import com.baeldung.mongodb.dbref.repository.PersonRepository;
|
||||
import com.mongodb.BasicDBObjectBuilder;
|
||||
import com.mongodb.DBObject;
|
||||
import com.mongodb.DBRef;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -14,12 +14,11 @@ import org.springframework.data.mongodb.core.MongoTemplate;
|
|||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import com.baeldung.mongodb.dbref.model.Person;
|
||||
import com.baeldung.mongodb.dbref.model.Pet;
|
||||
import com.baeldung.mongodb.dbref.repository.PersonRepository;
|
||||
import com.mongodb.BasicDBObjectBuilder;
|
||||
import com.mongodb.DBObject;
|
||||
import com.mongodb.DBRef;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
|
@ -1,5 +1,8 @@
|
|||
package com.baeldung.zoneddatetime;
|
||||
|
||||
import com.baeldung.zoneddatetime.config.MongoConfig;
|
||||
import com.baeldung.zoneddatetime.model.Action;
|
||||
import com.baeldung.zoneddatetime.repository.ActionRepository;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
|
@ -10,10 +13,6 @@ import org.springframework.data.mongodb.core.MongoOperations;
|
|||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import com.baeldung.zoneddatetime.config.MongoConfig;
|
||||
import com.baeldung.zoneddatetime.model.Action;
|
||||
import com.baeldung.zoneddatetime.repository.ActionRepository;
|
||||
|
||||
import java.time.ZoneOffset;
|
||||
import java.time.ZonedDateTime;
|
||||
|
|
@ -0,0 +1 @@
|
|||
spring.mongodb.embedded.version=4.4.9
|
|
@ -4,8 +4,6 @@
|
|||
- [Spring Boot Integration Testing with Embedded MongoDB](http://www.baeldung.com/spring-boot-embedded-mongodb)
|
||||
- [Upload and Retrieve Files Using MongoDB and Spring Boot](https://www.baeldung.com/spring-boot-mongodb-upload-file)
|
||||
- [GridFS in Spring Data MongoDB](http://www.baeldung.com/spring-data-mongodb-gridfs)
|
||||
- [ZonedDateTime with Spring Data MongoDB](https://www.baeldung.com/spring-data-mongodb-zoneddatetime)
|
||||
- [A Guide to @DBRef in MongoDB](https://www.baeldung.com/spring-mongodb-dbref-annotation)
|
||||
- [Import Data to MongoDB From JSON File Using Java](https://www.baeldung.com/java-import-json-mongodb)
|
||||
- [Spring Data MongoDB – Configure Connection](https://www.baeldung.com/spring-data-mongodb-connection)
|
||||
- More articles: [[next-->]](../spring-boot-persistence-mongodb-2)
|
||||
|
|
Loading…
Reference in New Issue