Announcement Announcement Module
Collapse
No announcement yet.
BeanFactory getBean ? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • BeanFactory getBean ?

    hi,
    I would like to get the object of a bean from a class that I will call every time I upload a jsp. I would like something like that:

    public class GenerateJS {

    public String generate(String className){

    .......
    Object obj = BeanFactory().getBean("myBean"));
    ...............
    }
    }


    thank you for any help.

  • #2
    I'm not sure what the question is here, what is it you are struggling with?

    Comment


    • #3
      I also have no clue, but maybe it's WebApplicationContextUtils. get[Required]WebApplicationContext(servletContext)?

      Joerg

      Comment


      • #4
        thx for the reply, I will explain in detail my problem, I would like to retrieve any bean when the server is on from a java class. I don't have any idea how to do it ? BeanFactory or applicationContext ?

        Comment


        • #5
          It's a better idea to inject dependencies instead, but if you do want to look them up, have a read of this section in the reference manual.
          http://static.springframework.org/sp...and-singletons

          Comment

          Working...
          X