Comments (3)
Your second example hits close to how you can solve this:
SessionFactory sf = new SessionFactoryImpl(mySchema, mysqlDialect, myDatasource);
auto container = DependencyContainer.getInstance();
container.register!(SessionFactory).existingInstance(sf);
See TUTORIAL.md (Dependency scopes) for more details.
Constructor injection is on my list of features I want to look at in the future as well as simplified integration with libraries which weren't made with dependency injection in mind.
from poodinis.
thanks, I ended up spotting that in one of the unit tests and tried it out and found that I couldn't use it with my version of dmd. So I've now updated to dmd v2.069.2 but that breaks hibernated, so I'm now waiting to see if they release a new update.
My day job is mostly Java with Spring, so I'd really like to be able to use more of the convenient features I'm used to having.
As well as constructor injection I'd really like to have the ability to essentially do an annotated app context. So Configuration, Value, and Bean or something similar with the Service and Component annotations.
Jpa style orm is my main need though. Do you have any plans to do something like: poodinis-orm?
from poodinis.
Annotated context configuration and eventually auto-scanning are on my list of things I will look at in the future. Unfortunately D's runtime (and compile-time) reflection capabilities are not as flexible as that of Java's so anything meta-programming related takes some more effort to work out.
I have no plans for integration with (jpa-like) ORM frameworks as of yet since my primary use only involves integration within my own frameworks. Whenever I have to integrate with an external library I write a service around it.
from poodinis.
Related Issues (20)
- Deprecation warning shown: "<symbol> is not visible from module context" HOT 2
- problem with registering existingInstance after updating to 7.0.0 HOT 4
- @PostConstruct ? HOT 1
- Post construction method HOT 3
- Visibility deprecation warnings when having imports in class HOT 2
- Access violation in poodinis.container.getExistingRegistration HOT 2
- Can't define a static @property DependencyContainer HOT 2
- unittest doesnt compile HOT 4
- Value injection does not work with structs HOT 8
- feature request: context parameter HOT 4
- Value injection, structs and constructors don't work together HOT 3
- Should interfaces work as components? HOT 2
- Better error message for: register does not match any template declaration HOT 1
- Hunt-Framework broken with Poodinis 8.1.0-beta.3 HOT 3
- Private type detection failed HOT 3
- fix "multiple ! arguments are not allowed" on constructor argument injection HOT 1
- Documentation unclear whether DependencyContainer.resolve objects are shared or not HOT 3
- @Component annotated method in ApplicationContext cannot be used with Interfaces HOT 1
- no longer builds with LDC HOT 1
- typo in TUTORIAL HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from poodinis.