Spring管理的bean实例化时候和引用的时候的hashCode不一样
环境:
UserService
public UserService(){
System.out.println("UserService init...hashCode=" + this.hashCode() );
}
在Controller中调用:
@RequestMapping("/jcbao2")
@ResponseBody
public String jcbao() {
System.out.println("调用 : userService.hashCode=" + userService.hashCode());
return "hello jcbao2";
}
结果打出来的hashCode值不一样。这个是什么原因呢?
如果你对这篇文章有疑问,欢迎到本站 社区 发帖提问或使用手Q扫描下方二维码加群参与讨论,获取更多帮助。

发布评论
需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。