Skip to content

Commit fa954eb

Browse files
committed
move to reactive, extract mongodb ex
1 parent ba77029 commit fa954eb

44 files changed

Lines changed: 1207 additions & 39 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎spring-5-mongodb/.gitignore‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#folders#
2+
.idea
3+
/target
4+
/neoDb*
5+
/data
6+
/src/main/webapp/WEB-INF/classes
7+
*/META-INF/*
8+
9+
# Packaged files #
10+
*.jar
11+
*.war
12+
*.ear

‎spring-5-mongodb/README.md‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
## Spring REST Example Project
2+
3+
### The Course
4+
The "REST With Spring" Classes: http://bit.ly/restwithspring
5+
6+
### Relevant Articles
7+
8+
- [Concurrent Test Execution in Spring 5](http://www.baeldung.com/spring-5-concurrent-tests)
9+
- [Introduction to the Functional Web Framework in Spring 5](http://www.baeldung.com/spring-5-functional-web)
10+
- [Exploring the Spring 5 MVC URL Matching Improvements](http://www.baeldung.com/spring-5-mvc-url-matching)
11+
- [Spring 5 WebClient](http://www.baeldung.com/spring-5-webclient)
12+
- [Spring 5 Functional Bean Registration](http://www.baeldung.com/spring-5-functional-beans)
13+
- [The SpringJUnitConfig and SpringJUnitWebConfig Annotations in Spring 5](http://www.baeldung.com/spring-5-junit-config)
14+
- [Spring Security 5 for Reactive Applications](http://www.baeldung.com/spring-security-5-reactive)
15+
- [Spring 5 Testing with @EnabledIf Annotation](https://github.com/eugenp/tutorials/tree/master/spring-5)
16+
- [Reactive WebSockets with Spring 5](http://www.baeldung.com/spring-5-reactive-websockets)
17+
- [Spring Boot Actuator](http://www.baeldung.com/spring-boot-actuators)
18+
- [Spring Webflux Filters](http://www.baeldung.com/spring-webflux-filters)
19+
- [Reactive Flow with MongoDB, Kotlin, and Spring WebFlux](http://www.baeldung.com/kotlin-mongodb-spring-webflux)
20+
- [Spring Data Reactive Repositories with MongoDB](http://www.baeldung.com/spring-data-mongodb-reactive)

‎spring-5-mongodb/pom.xml‎

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<groupId>com.baeldung</groupId>
7+
<artifactId>spring-5-mongodb</artifactId>
8+
<version>0.0.1-SNAPSHOT</version>
9+
<packaging>jar</packaging>
10+
<name>spring-5-mongodb</name>
11+
<description>spring 5 mongodb sample project</description>
12+
13+
<parent>
14+
<groupId>com.baeldung</groupId>
15+
<artifactId>parent-boot-2</artifactId>
16+
<version>0.0.1-SNAPSHOT</version>
17+
<relativePath>../parent-boot-2</relativePath>
18+
</parent>
19+
20+
<dependencies>
21+
<dependency>
22+
<groupId>org.springframework.boot</groupId>
23+
<artifactId>spring-boot-starter-validation</artifactId>
24+
</dependency>
25+
<dependency>
26+
<groupId>org.springframework.boot</groupId>
27+
<artifactId>spring-boot-starter-tomcat</artifactId>
28+
</dependency>
29+
<dependency>
30+
<groupId>org.springframework.boot</groupId>
31+
<artifactId>spring-boot-starter-webflux</artifactId>
32+
</dependency>
33+
<dependency>
34+
<groupId>org.projectreactor</groupId>
35+
<artifactId>reactor-spring</artifactId>
36+
<version>${reactor-spring.version}</version>
37+
</dependency>
38+
<!-- utils -->
39+
<dependency>
40+
<groupId>org.apache.commons</groupId>
41+
<artifactId>commons-lang3</artifactId>
42+
</dependency>
43+
44+
<!-- runtime and test scoped -->
45+
<dependency>
46+
<groupId>org.springframework</groupId>
47+
<artifactId>spring-test</artifactId>
48+
</dependency>
49+
<dependency>
50+
<groupId>org.springframework.boot</groupId>
51+
<artifactId>spring-boot-starter-test</artifactId>
52+
<scope>test</scope>
53+
</dependency>
54+
55+
<dependency>
56+
<groupId>org.apache.commons</groupId>
57+
<artifactId>commons-collections4</artifactId>
58+
<version>${commons-collections4.version}</version>
59+
<scope>test</scope>
60+
</dependency>
61+
<dependency>
62+
<groupId>org.projectlombok</groupId>
63+
<artifactId>lombok</artifactId>
64+
<scope>compile</scope>
65+
</dependency>
66+
67+
<dependency>
68+
<groupId>org.junit.jupiter</groupId>
69+
<artifactId>junit-jupiter-api</artifactId>
70+
</dependency>
71+
<dependency>
72+
<groupId>org.junit.jupiter</groupId>
73+
<artifactId>junit-jupiter-engine</artifactId>
74+
<scope>test</scope>
75+
</dependency>
76+
<dependency>
77+
<groupId>org.junit.platform</groupId>
78+
<artifactId>junit-platform-surefire-provider</artifactId>
79+
<version>${junit.platform.version}</version>
80+
<scope>test</scope>
81+
</dependency>
82+
<dependency>
83+
<groupId>org.junit.platform</groupId>
84+
<artifactId>junit-platform-runner</artifactId>
85+
<version>${junit.platform.version}</version>
86+
<scope>test</scope>
87+
</dependency>
88+
<dependency>
89+
<groupId>org.apache.commons</groupId>
90+
<artifactId>commons-lang3</artifactId>
91+
</dependency>
92+
93+
<dependency>
94+
<groupId>org.springframework.boot</groupId>
95+
<artifactId>spring-boot-starter-data-mongodb-reactive</artifactId>
96+
</dependency>
97+
<dependency>
98+
<groupId>de.flapdoodle.embed</groupId>
99+
<artifactId>de.flapdoodle.embed.mongo</artifactId>
100+
<scope>test</scope>
101+
</dependency>
102+
<dependency>
103+
<groupId>io.reactivex.rxjava2</groupId>
104+
<artifactId>rxjava</artifactId>
105+
<version>${rxjava-version}</version>
106+
</dependency>
107+
<dependency>
108+
<groupId>io.projectreactor</groupId>
109+
<artifactId>reactor-test</artifactId>
110+
<version>${project-reactor-test}</version>
111+
<scope>test</scope>
112+
</dependency>
113+
</dependencies>
114+
115+
<build>
116+
<plugins>
117+
<plugin>
118+
<groupId>org.springframework.boot</groupId>
119+
<artifactId>spring-boot-maven-plugin</artifactId>
120+
<configuration>
121+
<mainClass>com.baeldung.reactive.Spring5ReactiveApplication</mainClass>
122+
<layout>JAR</layout>
123+
</configuration>
124+
</plugin>
125+
126+
<plugin>
127+
<groupId>org.apache.maven.plugins</groupId>
128+
<artifactId>maven-surefire-plugin</artifactId>
129+
<configuration>
130+
<forkCount>3</forkCount>
131+
<reuseForks>true</reuseForks>
132+
<parallel>methods</parallel>
133+
<useUnlimitedThreads>true</useUnlimitedThreads>
134+
<excludes>
135+
<exclude>**/*IntegrationTest.java</exclude>
136+
<exclude>**/*IntTest.java</exclude>
137+
<exclude>**/*LiveTest.java</exclude>
138+
</excludes>
139+
</configuration>
140+
</plugin>
141+
</plugins>
142+
</build>
143+
144+
<properties>
145+
<junit.platform.version>1.0.0</junit.platform.version>
146+
<junit.jupiter.version>5.0.2</junit.jupiter.version>
147+
<maven-surefire-plugin.version>2.20</maven-surefire-plugin.version>
148+
<reactor-spring.version>1.0.1.RELEASE</reactor-spring.version>
149+
<rxjava-version>2.1.12</rxjava-version>
150+
<commons-collections4.version>4.1</commons-collections4.version>
151+
<project-reactor-test>3.1.6.RELEASE</project-reactor-test>
152+
<johnzon.version>1.1.3</johnzon.version>
153+
<jsonb-api.version>1.0</jsonb-api.version>
154+
<geronimo-json_1.1_spec.version>1.0</geronimo-json_1.1_spec.version>
155+
</properties>
156+
157+
</project>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package com.baeldung.reactive;
2+
3+
import com.mongodb.reactivestreams.client.MongoClient;
4+
import org.springframework.beans.factory.annotation.Autowired;
5+
import org.springframework.boot.SpringApplication;
6+
import org.springframework.boot.autoconfigure.SpringBootApplication;
7+
import org.springframework.context.annotation.Bean;
8+
import org.springframework.data.mongodb.core.ReactiveMongoTemplate;
9+
10+
@SpringBootApplication
11+
public class Spring5ReactiveApplication{
12+
13+
public static void main(String[] args) {
14+
SpringApplication.run(Spring5ReactiveApplication.class, args);
15+
}
16+
17+
@Autowired
18+
MongoClient mongoClient;
19+
20+
@Bean
21+
public ReactiveMongoTemplate reactiveMongoTemplate() {
22+
return new ReactiveMongoTemplate(mongoClient, "test");
23+
}
24+
25+
}

spring-5-reactive/src/main/java/com/baeldung/reactive/model/Account.java renamed to spring-5-mongodb/src/main/java/com/baeldung/reactive/model/Account.java

File renamed without changes.

spring-5-reactive/src/main/java/com/baeldung/reactive/repository/AccountCrudRepository.java renamed to spring-5-mongodb/src/main/java/com/baeldung/reactive/repository/AccountCrudRepository.java

File renamed without changes.

spring-5-reactive/src/main/java/com/baeldung/reactive/repository/AccountMongoRepository.java renamed to spring-5-mongodb/src/main/java/com/baeldung/reactive/repository/AccountMongoRepository.java

File renamed without changes.

spring-5-reactive/src/main/java/com/baeldung/reactive/repository/AccountRxJavaRepository.java renamed to spring-5-mongodb/src/main/java/com/baeldung/reactive/repository/AccountRxJavaRepository.java

File renamed without changes.

spring-5-reactive/src/main/java/com/baeldung/reactive/template/AccountTemplateOperations.java renamed to spring-5-mongodb/src/main/java/com/baeldung/reactive/template/AccountTemplateOperations.java

File renamed without changes.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
logging.level.root=INFO
2+
3+
management.endpoints.web.exposure.include.=*
4+
5+
info.app.name=Spring Boot 2 actuator Application

0 commit comments

Comments
 (0)