spring
车辙cz
程序员一枚,掘金小册:《SkyWalking 应用监控与链路跟踪》作者
展开
-
SpringWeb项目和SpringBoot微服务项目如何进行junit调试
spring web项目在junit测试类上添加 @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations={“classpath:/springContext.xml”}) 当然也可以选择添加其他的配置文件进行加载,例如: @ContextConfiguration(locations={“classpa原创 2017-12-01 16:50:25 · 2646 阅读 · 0 评论 -
理解spring中AutoWire,Reource,以及Service等注解
在Spring中由于xml配置的不方便,我们一般会采用注解提高开发速度。这次重点讲几个注解。Service注解: 在不指定bean的Id时,bean的Id首字母小写。例如:LoginService,他创建的bean就是loginService,当然也可以指定bean的Id。 这种场景一般是有多个Service实现了某个接口,那么注入的时候就不能用AutoWire了,而是用Resource(nam原创 2017-12-01 17:06:40 · 1173 阅读 · 0 评论