Home > Back-end >  Spring Boot how to implement interface automatically instantiated?
Spring Boot how to implement interface automatically instantiated?

Time:10-08



UserMapper here as a mapper interfaces, but in the UserService can instantiate, and don't need the @autowired, compiled to run there are no mistakes, don't know why this is,

In addition, if coupled with @autowired, instead, the IDEA will be prompted to "Could not autowire. No beans of 'UserMapper type found.", but does not affect the operation.

The younger brother who was recently in contact with the boot, a great god,

CodePudding user response:

UserMapper will generate implementation agent spirng using aop through JDK with directly, no need to worry

CodePudding user response:

http://blog.csdn.net/je_ge/article/details/53313982

CodePudding user response:

By spring construction methods to instantiate objects automatically by constructor injection parameters, if you write a constructor to remove single variable injection, the @autowired is is the constructor because only automatic injection
  • Related