-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* create mongodb reactive driven adapter automatically for reactive projects * create mongodb reactive driven adapter automatically for reactive projects
- Loading branch information
1 parent
2333e5c
commit b19b205
Showing
27 changed files
with
288 additions
and
34 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
package=co.com.bancolombia | ||
systemProp.version=1.6.3 | ||
systemProp.version=1.6.4 |
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
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
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
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
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
9 changes: 9 additions & 0 deletions
9
src/main/resources/driven-adapter/mongo-reactive/build.gradle.mustache
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,9 @@ | ||
dependencies { | ||
implementation project(':model') | ||
implementation 'org.springframework.boot:spring-boot-starter-data-mongodb-reactive' | ||
implementation 'org.reactivecommons.utils:object-mapper-api:{{objectMapperVersion}}' | ||
runtime 'de.flapdoodle.embed:de.flapdoodle.embed.mongo' // TODO: remove this dependency to connect to real database | ||
testCompile 'org.reactivecommons.utils:object-mapper:{{objectMapperVersion}}' | ||
} |
20 changes: 20 additions & 0 deletions
20
src/main/resources/driven-adapter/mongo-reactive/config/db-secret.java.mustache
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,20 @@ | ||
package {{package}}.mongo.config; | ||
|
||
{{#include-secret}} | ||
import lombok.Data; | ||
{{/include-secret}} | ||
{{^include-secret}} | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
{{/include-secret}} | ||
|
||
{{#include-secret}} | ||
@Data | ||
{{/include-secret}} | ||
{{^include-secret}} | ||
@Builder | ||
@Getter | ||
{{/include-secret}} | ||
public class MongoDBSecret { | ||
private {{^include-secret}}final {{/include-secret}}String uri; | ||
} |
40 changes: 40 additions & 0 deletions
40
src/main/resources/driven-adapter/mongo-reactive/config/mongo-config.java.mustache
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,40 @@ | ||
package {{package}}.config; | ||
|
||
{{#include-secret}} | ||
import co.com.bancolombia.commons.secretsmanager.exceptions.SecretException; | ||
import co.com.bancolombia.commons.secretsmanager.manager.GenericManager; | ||
import org.springframework.beans.factory.annotation.Value; | ||
{{/include-secret}} | ||
import {{package}}.mongo.config.MongoDBSecret; | ||
import org.springframework.boot.autoconfigure.mongo.MongoClientFactory; | ||
import org.springframework.boot.autoconfigure.mongo.MongoProperties; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.core.env.Environment; | ||
|
||
@Configuration | ||
public class MongoConfig { | ||
{{#include-secret}} | ||
@Bean | ||
public MongoDBSecret dbSecret(@Value("${aws.secretName}") String secret, GenericManager manager) | ||
throws SecretException { | ||
return manager.getSecretModel(secret, MongoDBSecret.class); | ||
} | ||
{{/include-secret}} | ||
{{^include-secret}} | ||
@Bean | ||
public MongoDBSecret dbSecret(Environment env) { | ||
return MongoDBSecret.builder() | ||
.uri(env.getProperty("spring.data.mongo.uri")) | ||
.build(); | ||
} | ||
{{/include-secret}} | ||
|
||
@Bean | ||
public MongoClientFactory mongoProperties(MongoDBSecret secret, Environment env) { | ||
MongoProperties properties = new MongoProperties(); | ||
properties.setUri(secret.getUri()); | ||
return new MongoClientFactory(properties, env); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/resources/driven-adapter/mongo-reactive/definition.json
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,13 @@ | ||
{ | ||
"folders": [ | ||
"infrastructure/driven-adapters/mongo-repository/src/test/java/{{packagePath}}/mongo/helper" | ||
], | ||
"files": { | ||
"driven-adapter/mongo-reactive/config/mongo-config.java.mustache": "applications/app-service/src/main/java/{{packagePath}}/config/MongoConfig.java", | ||
"driven-adapter/mongo-reactive/config/db-secret.java.mustache": "infrastructure/driven-adapters/mongo-repository/src/main/java/{{packagePath}}/mongo/config/MongoDBSecret.java", | ||
"driven-adapter/mongo-reactive/helper/adapter-operations.java.mustache": "infrastructure/driven-adapters/mongo-repository/src/main/java/{{packagePath}}/mongo/helper/AdapterOperations.java", | ||
"driven-adapter/mongo-reactive/mongo-repository.java.mustache": "infrastructure/driven-adapters/mongo-repository/src/main/java/{{packagePath}}/mongo/MongoDBRepository.java", | ||
"driven-adapter/mongo-reactive/mongo-repository-adapter.java.mustache": "infrastructure/driven-adapters/mongo-repository/src/main/java/{{packagePath}}/mongo/MongoRepositoryAdapter.java", | ||
"driven-adapter/mongo-reactive/build.gradle.mustache": "infrastructure/driven-adapters/mongo-repository/build.gradle" | ||
} | ||
} |
Oops, something went wrong.