Search code examples
springalfresco

How to inject the Repository services in the bootstrap phase


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.

  • I create a class.
  • I set setter methods.
  • I write a snipe of xml tag for NodeUtil Bean.

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

Thanks


Solution

  • 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.