7

Looking at my web application, it looks like the default autowiring is by name. I did not use the autowire keyword in any XML files, but it's still autowiring. Based on this link, it looks like no autowiring should happen in this case.

Why is this happening? Can we set it at a global level somewhere in the project?

riddle_me_this
  • 8,575
  • 10
  • 55
  • 80
M Sach
  • 33,416
  • 76
  • 221
  • 314

3 Answers3

3

The default autowiring in spring is by type

Igorock
  • 2,691
  • 6
  • 28
  • 39
2

As this link describes

Default, no auto wiring, set it manually via “ref” attribute. In case of autodetect – If a default constructor is found, use “autowired by constructor”; Otherwise, use “autowire by type”.

M Sach
  • 33,416
  • 76
  • 221
  • 314
0

For xml based configuration, the default autowiring mode is - 'no' That means, we need to manually provide the reference of the required bean to be injected.

For java based configuration, using @Autowired annotation, the default autowiring mode is - 'byType'

Shailesh Saxena
  • 3,472
  • 2
  • 18
  • 28