2020
10-10
10-10
Spring中@Autowire注入的深入讲解
一直在思考spring的@Autowire注入属性时到底是按类型注入还是按名称注入,今天写了一个测试来证明一下。定义接口TestServicepublicinterfaceTestService{voidtest();}定义接口实现:TestServiceImpl1和TestServiceImpl2@ServicepublicclassTestServiceImpl1implementsTestService{publicvoidtest(){System.out.println(1111);}}@ServicepublicclassTestServiceImpl2implementsTestService{publicvoidtest...
继续阅读 >