facebook

How to LookUp a SpringBean from a Non Java Class ou

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #253033 Reply

    schanamolu
    Member

    Hi,

    I know industry standard is lookUp a SpringBean from either JSF Backing Bean or Struts Action Class.

    This is sample code for lookup from Jsf component

    ServletContext context = FacesUtils.getServletContext();
    this.appContext = WebApplicationContextUtils.getRequiredWebApplicationContext(context);
    this.userService = (UserService)this.lookupService(USER_SERVICE_BEAN_NAME);

    Can some one tell me how I Lookup spring Bean( SpringFramework) in a container from a Plain Java Class which is outside the container.

    Early Response would be apprciated.

    Thanks,
    Sreedhar

    #253170

    Riyad Kalla
    Member

    Sreedhar,
    Check the SpringFramework docs for specifics, but the “normal” way to do this is to use a Spring factory class that you tell it where the bean XML file is and it will read it and get the beans for you. There are 4 or 5 of them depending on the usage scenario (Web app, stand alone, ejb, etc.)

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: How to LookUp a SpringBean from a Non Java Class ou

You must be logged in to post in the forum log in