Is this correct : If subclass overrides a method and changes the type of the resource injection, it will affect method of the superclass itself?However, injection of such resources follows the Java language overriding rules for the visibility of fields and methods. A method definition that overrides a method on a superclass defines the resource, if any, to be injected into that method. An overriding method may request injection of a different resource than is requested by the superclass, or it may request no injection even though the superclass method requests injection.
- Posts: 185
- Joined: Mon Jun 20, 2016 5:06 pm
- Site Admin
- Posts: 8913
- Joined: Fri Sep 10, 2010 9:26 pm
It is not really affecting the method of superclass. It is affecting the subclass method that is inherited by the subclass. If you use the superclass as a bean, then changes in the subclass will have no affect.
Users browsing this forum: No registered users and 2 guests