As per spring documentation it has been mentioned
it is by design
I want to understand the possible thinking behind this design.
It's because Autowiring
is just an alternative for referencing your existing beans in ApplicationContext. It expects a bean or a class, primitive is not a class and it differs from Object. Which is why you can't Autowire
primitive types. You can use wrapper classes of the primitive types such as Integer, Double etc... to be able to use Autowiring for such types because you are now referring to a class.