Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 695013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:54:57+00:00 2026-05-14T02:54:57+00:00

I have a portlet application. It is configured using Spring framework IoC container. I

  • 0

I have a portlet application. It is configured using Spring framework IoC container. I am using org.springframework.web.context.ContextLoaderListener to load my context.

I have an application context at root level (applicationContext.xml) and a portlet specific context (MyPortlet-portlet.xml).

I have a portlet of type org.springframework.web.portlet.DispatcherPortlet which is wired up to a Controller. In the Controller I want to access one of the beans (e.g. bean with id “myBean”) I have defined in my portlet specific context. I have tried

MyBean mybean = (MyBean)PortletApplicationContextUtils.getWebApplicationContext(
    getPortletContext()).getBean("myBean")

However only the beans in my application context are available here – none of my beans in my portlet specific context are available.

Is there a way to access the beans in my portlet specific context?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T02:54:57+00:00Added an answer on May 14, 2026 at 2:54 am

    Firstly, can’t you just wire in the bean to your controller in the normal way, rather than retrieving it programmatically?

    Failing that, you should realise that getWebApplicationContext() gets a reference to the root webapp context, not the servlet app context:

    Find the root WebApplicationContext
    for this portlet application, which is
    typically loaded via
    ContextLoaderListener or
    ContextLoaderServlet.

    If your controller needs a handle on its own context, then it should implement ApplicationContextAware or BeanFactoryAware, or it can use @Autowired ApplicationContext if you want to use autowiring.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been using the Windsor IoC Container for my web-based application, to resolve
I'm currently building a SmartGWT-based web application (using the Portlet Layout). So I have
I have web application developed using JSP and struts. I am just looking out
I am using spring mvc portlet for one of my applications. I have a
I have a portlet. Inside of this portlet I have Flex application that displays
I am using Eclipse 3.2.2 with WebSphere Portlet Factory Designer 6.0.2. I have a
I am currently working on a spring portlet mvc 3 project. I have a
I have a portlet that uses spring mvc and when the portal is in
Im new with liferay have a problem with portlet deployment using the plugins sdk,
Does someone know/have experience in showing Java web application generated UI in Sharepoint? We

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.