如何访问对象的内容?

How to access contents of an object?

我已将 class 自动连接为 @Autowired(required=true) private CookieDao ewp;

我正在尝试使用 ewp 调用函数 ewp.getCookieEntry(id, name );

如何访问 ewp 的内容。因为它是一个对象,所以我得到 classname@hashcode 但在 .toString() 之后,我只得到 classname。

如果 ewp 是自动装配的,那么它和 CookieDao ewp = new CookieDao(); 一样吗?如果不是,那么它叫什么以及如何提取它的值?

我认为您需要使用 @Repository 将 CookieDao 注释为自动装配工作就好了,有关更多信息,请查看此答案:Understanding Spring @Autowired usage