Is it possible to substitute default Spring Framework's way of creating and managing objects via reflections with other dependency injection tool (that would be faster, because would avoid reflections), while still holding on Spring's rich API?
For example, I would like to have beans created by Dagger 2 or Tiger or Feather that would still be able to interact with Spring Data/Social/MVC.
https://github.com/google/dagger
https://github.com/google/tiger
https://github.com/zsoltherpai/feather
I know that someone is going to say "start worrying about performance when it will become problem" - well, I would say it's about time to start worrying about it right now.
In my option, it would allow Spring to embrace FaaS (Function as a Service). FaaS jvm is going to be shut down after serving it's call, so You either keep it running (like regular server) and pay for literally every millisecond or some calls may be delayed even few seconds (to boot everything up).
I have found two projects, that are trying to use Spring in FaaS environment and are tackling this problem, but in my option it's easier to remove problem (reflections) that try to overcome it with hacks.
https://github.com/markfisher/spring-cloud-function
https://github.com/kennyk65/spring-cloud-serverless
Or, maybe there is another way to solve this problem and efficiently use Spring in FaaS, that I am not aware of?
Related question: Running Spring Boot on Amazon Lambda
I have been trying to use minimal Spring Framework application (like 3-5 classes) and still it takes (sometimes) 5-15 seconds to handle first request (next are handled in 50-100ms), so minimizing isn't really working in this case.
I'm in the same boat, trying to finding a FaaS friendly DI framework for JVM. Since nothing can beat Spring ecosystem on JVM, it would be great if Spring had reflection-less mechanism and compile time DI. I could not find much on that front though.
Micronaut solves the exact same problem and looks interesting. It has an adapter layer for spring annotations. Micronaut is purpose built for faster start-ups using compile time DI.
Of course, this is good for newer applications but not for very large applications with lots of existing spring code-base.
Today, spring-fu could be an option to create spring application reflection-less approach.
According to its documentation:
Spring Fu is an incubator for JaFu (Java DSL) and KoFu (Kotlin DSL) designed to configure Spring Boot explicitly with code in a declarative way with great discoverability thanks to auto-complete. It provides fast startup (40% faster than regular auto-configuration on a minimal Spring MVC app), low memory consumption and is a good fit with GraalVM native thanks to its (almost) reflection-less approach.
Note: spring-fu is not supposed to be used in production.