File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
src/test/java/org/soujava/demos/mongodb/document Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change
1
+ package org .soujava .demos .mongodb .document ;
2
+
3
+ import jakarta .annotation .Priority ;
4
+ import jakarta .enterprise .context .ApplicationScoped ;
5
+ import jakarta .enterprise .inject .Alternative ;
6
+ import jakarta .enterprise .inject .Produces ;
7
+ import jakarta .interceptor .Interceptor ;
8
+ import org .eclipse .jnosql .communication .Settings ;
9
+ import org .eclipse .jnosql .databases .mongodb .communication .MongoDBDocumentConfiguration ;
10
+ import org .eclipse .jnosql .databases .mongodb .communication .MongoDBDocumentManager ;
11
+
12
+ import java .util .function .Supplier ;
13
+
14
+ @ ApplicationScoped
15
+ @ Alternative
16
+ @ Priority (Interceptor .Priority .APPLICATION )
17
+ public class ManagerSupplier implements Supplier <MongoDBDocumentManager > {
18
+
19
+ @ Produces
20
+ public MongoDBDocumentManager get () {
21
+ Settings settings = Settings .builder ().put ("credential" , "value" ).build ();
22
+ MongoDBDocumentConfiguration configuration = new MongoDBDocumentConfiguration ();
23
+ var factory = configuration .apply (settings );
24
+ return factory .apply ("database" );
25
+ }
26
+ }
You can’t perform that action at this time.
0 commit comments