• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Changing System from xml to annotations -@Autowired not working

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I´m trying to change the way of bean injection in my system, from xml to annotations. Searching about it (even here in the forum), I was able to run my application without errors (I mean, stacktraces). The thing is, when I try to inject the bean, looks like the Spring Container. When I run some tests, I see that the object to be injected(a controller) is 'null'. I´ve tried so many things, with no success, so it seems something is missing. Below are my code and configurations. Oh, and right now I´m just trying to change a feature of the app, if it works, I´ll apply the changes to the rest of the app.


1.








Now my configurations(applicationContext.xml is divided in 2 parts, controladorContext.xml and daoContext.xml):




That´s it, I have no idea why that doesnt work. =/ Any help is much appreciated! =]

Thanks in advance!
 
ranger
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it just the top one that is not getting injected, and the two below it that also have Autowired are not.

I noticed the first one does not have an annotation at the class level, is there a <bean> tag in the xml for it to make it an actual Spring Bean that can then be autowired?

Mark
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic