You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To summarize, the Bind annotation provides a straightforward way for mapping an abstraction (interface or abstract class) to its concrete implementation, simplifying the dependence configuration.
@@ -394,12 +394,12 @@ Whale offers the flexibility to append managed objects into DI container even af
394
394
@Test
395
395
publicvoid testAppendBeans(){
396
396
var context =Context.make(CONFIGS);
397
-
varfactory= context.createFactory();
398
-
factory.register(Person.class);
399
-
factory.register(Mobile.class);
400
-
factory.start(); //Container Initialized
397
+
varbinder= context.getBinder();
398
+
binder.register(Person.class);
399
+
binder.register(Mobile.class);
400
+
context.start(); //Container Initialized
401
401
402
-
factory.append(DemoServiceImpl.class);
402
+
binder.append(DemoServiceImpl.class);
403
403
404
404
var person = context.get(Person.class);
405
405
var mobile = context.get(Mobile.class);
@@ -482,6 +482,20 @@ public void init(){
482
482
```
483
483
Whale does not provide the finalizer annotation. You should implement the AutoCloseable interface. When the DI container is shutdown, the close method will be called automatically.
484
484
485
+
### E. Import external singleton object(Non-JSR330) as a managed bean into container:
0 commit comments