开发者

How to inject the Repository services in the bootstrap phase

开发者 https://www.devze.com 2023-04-04 21:22 出处:网络
I have a class named \"NodeUtil\" and that class have a three services injected in the bootstrap phase but once i trying to Log the service.toString() the value that printed is

I have a class named "NodeUtil" and that class have a three services injected in the bootstrap phase but once i trying to Log the service.toString() the value that printed is proxy$.toString() .

I'm trying to initialize the services in the NodeUtil bean rather than initialize them using

Repository.getServiceRegistry(FacesContext ...).getSearchService()

I use the same thing in the file action-services-context.xml.

Can anyone tell me why this initiate an error and what the correct way.

Thanks


As @Artefacto said, there's no issue here. When using Spring, you get a reference to a Proxy class that wraps what you asked it to initialize. This has a number of (beneficial) effects, but definitely it's not an error.

You can see that proxy$.toString() as a proof that you really have a handle to an initialized instance of the class you need. I strongly suggest you to read more about how Spring IoC works.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号