Announcement Announcement Module
No announcement yet.
dispatcher-servlet.xml vs applicationContext-security.xml Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • dispatcher-servlet.xml vs applicationContext-security.xml

    dispatcher-servlet.xml vs applicationContext-security.xml

    I have a Java Spring MVC Project and at the service level I had a object needs some config information like user name, hostname and password. Originally, I put the configurations into the applicationContext-security.xml and expected to have it loaded into the Service Object as a bean. I made a bean with the three properties in it and then put the xml into the applicationContext-security.xml and put @Autowire into my service but my service could not find the values.

    In order to make my class work, I moved the xml configurations from the applicationContext-security.xml to the dispatcher-servlet.xm and like magic it all started to work. The big question is that why did the configurations have to go into the dispatcher-servlet.xm and not the applicationContext-security.xml?

    Please help me out.. I am lost in the woods.. thanks

  • #2
    Post your configuration and code. My suspicion is you have component-scanning and your service is detected twice.