Do you want to use IoC as a language feature, or native support?
For new Interface, custom language based on JVM implementation is actually possible.
In addition to the source code, add a configuration file control. Configuration file as preprocessing control. When compiling, first preprocess the pure source code file (the object has been injected). Compile the preprocessed source code file afterwards. The above is how static injection (compile-time injection) is handled.
In addition, obviously, from Spring, we can know that it is possible to use reflection to achieve the effect of dynamic injection, as long as we make corresponding changes in semantic analysis and write a usable IoC standard library.
It’s easy to say it, but it’s not easy to implement.
Since it is injected, why do you need new interface?
new interface has no meaning
Do you want to use IoC as a language feature, or native support?
For new Interface, custom language based on JVM implementation is actually possible.
In addition to the source code, add a configuration file control.
Configuration file as preprocessing control.
When compiling, first preprocess the pure source code file (the object has been injected).
Compile the preprocessed source code file afterwards.
The above is how static injection (compile-time injection) is handled.
In addition, obviously, from Spring, we can know that it is possible to use reflection to achieve the effect of dynamic injection, as long as we make corresponding changes in semantic analysis and write a usable IoC standard library.
It’s easy to say it, but it’s not easy to implement.