Announcement Announcement Module
No announcement yet.
Bean not being wired into controller Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Bean not being wired into controller

    Hey all:

    I have a web controller which I configure in the controller-config.xml using

    <mvc:annotation-driven />
    <context:annotation-config />
    <context:component-scan base-package="com.ecommerce.web.controller" />

    The controller has the @Controller annotation like below.

    public class HomeController

    I have included the @Autowired annotation on the dependencies, but when I first start up the application I am unable to set any properties on the wired objects.

    For example, I have a storeProfile object which when in debug mode I see has multiple properties set as it should.
    But, when I try to set one of the storeProfile properties on an @Autowried bean it is still null or empty string!?

    If you look at the attached images it shows that after I step past the line this.storeProfileContext.setStoreProfile(storeProf ile) the debugger still shows the storeProfile property as null

    Actually, there are a couple dependencies which look like they are created (they are not null and the application functions), but I am unable to set anything on these objects.

    Any thoughts or ideas on what I might be missing or what the problem is would be appreciated!

    Attachment Attachment
    Attached Files