Announcement Announcement Module
Collapse
No announcement yet.
Is a such thing to declare a Spring bean twice if I need to declare it in a XML file? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Is a such thing to declare a Spring bean twice if I need to declare it in a XML file?

    I was told that I need to declare a Spring bean with one of the annotation if I need to declare it in a XML. First, that is not how I understand about Spring. And second, I get an error with the approach. The words comes from a member of Spring team by the way.

  • #2
    Well actually it depends...

    If you want to use @Autowired and not component scanning you have to put annotations on your beans and also put the beans in xml else is nothing to inject. If you also use @Component (or one of the "sub"annotations) you need to put a context:component-scan in your xml to have your beans detected and configured.

    Comment

    Working...
    X