File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Application Frameworks and the fly likes Load the beanrefContext.xml in web Application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Load the beanrefContext.xml in web Application" Watch "Load the beanrefContext.xml in web Application" New topic
Author

Load the beanrefContext.xml in web Application

RaviNada Kiran
Ranch Hand

Joined: Jan 30, 2009
Posts: 528

Hello All,

i am a newbie to Spring Framework.

I have a beanrefContext.xml configured .

Can anybody please tell me how can i load this beanrefContext.xml into my Application .

Thanks in advance.


If you want something you never had do something which you had never done
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17260
    
    6

RaviNada Kiran wrote:
Hello All,

i am a newbie to Spring Framework.

I have a beanrefContext.xml configured .

Can anybody please tell me how can i load this beanrefContext.xml into my Application .

Thanks in advance.


What is in that file? Is that the file that you use to get Beans into EJBs? I forgot?

Where do you want that xml loaded. In the ApplicationContext when you create it? Then isn't it just passed as a parameter to the constructor of ApplicationContext, or if in a web environment, then added as a context-param for the ContextLoaderListener?

Thanks

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
RaviNada Kiran
Ranch Hand

Joined: Jan 30, 2009
Posts: 528
Mark Spritzler wrote:
RaviNada Kiran wrote:
if in a web environment, then added as a context-param for the ContextLoaderListener?


Hi Mark , thanks for your valuable answer . For this i did these

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationcontext.xml</param-value>
</context-param>

and i declared a ContextLoaderListener in my web.xml

<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>


what i want to ask is these above two steps are sufficient ?? so that with the help of predefined annotated tags we can gain access to the resources defined inside the applicationcontext.xml
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17260
    
    6

Those two lines loads an ApplicationContext into the WebContext so that your Web apps/Controllers have access to beans defined in your applicationContext.xml

But what do you have in
beanrefContext.xml

That you mentioned. I believe that is the name of the file that you use when you want an EJB to have access to an ApplicationContext object.

Mark
RaviNada Kiran
Ranch Hand

Joined: Jan 30, 2009
Posts: 528
Thanks Mark

This beanref ml file would be loading applicationcontext.xml file in its constructor.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17260
    
    6

RaviNada Kiran wrote:Thanks Mark

This beanref ml file would be loading applicationcontext.xml file in its constructor.


And xml file doesn't have a constructor, so I don't understand what you mean. Maybe post some code.

Are you using EJBs?

Thanks

Mark
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Load the beanrefContext.xml in web Application