Announcement Announcement Module
Collapse
No announcement yet.
Autowiring not work in multi module project Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Autowiring not work in multi module project

    I have small problem with my multimodule maven project.
    I have project A with models, DAOs and services (and some controllers and tests for testing). Everything works fine in project A.
    Project B is another module in my application. I want to use objects from project A in project B but when I call service (from A in B), with (@)autowired DAO, the DAO been turns out to be null. The autowiring doesn't work. Have You ever met problem like this one?

    Best regards

    Krzysztof

  • #2
    You can do this by giving reference in the root.xml by:

    <context:component-scan base-package="com.xxx.xxxxx">
    <context:exclude-filter expression="org.springframework.stereotype.Control ler" type="annotation"/>
    </context:component-scan>

    <tx:annotation-driven/>

    <!-- Enable Auto wiring -->
    <context:component-scan base-package="com.xxx.xxxxxx" />

    Comment


    • #3
      Thank You mdsoneta very much! You post was very helpful!
      I made few mistakes:
      1) I hadn't component-scan in my root.xml
      2) I lost project A from my buildpatch
      3) I hadn't entities class map in my persistance.xml
      Thank You very much!

      Krzysztof

      Comment


      • #4
        Good to know that it was helpful

        Comment

        Working...
        X