This week's book giveaway is in the Java in General forum.
We're giving away four copies of Event Streams in Action and have Alexander Dean & Valentin Crettaz on-line!
See this thread for details.
Win a copy of Event Streams in Action this week in the Java in General forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

@Autowired problem

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Was wondering if someone can help me with an 'Injection of autowired dependencies failed':

INFO: Initializing Spring FrameworkServlet 'spring'

In ViewDVDController()

Oct 26, 2011 11:50:07 AM org.apache.catalina.core.ApplicationContext log
SEVERE: StandardWrapper.Throwable
org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'viewDVDController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationEapp structure.jpgxception: Could not autowire field: private springmvc.application.inventory.impl.InventoryMana gerImpl springmvc.presentation.ViewDVDController.manager; nested exception is org.springframework.beans.factory.NoSuchBeanDefini tionException: No matching bean of type [springmvc.application.inventory.impl.InventoryMana gerImpl] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Aut owired(required=true)}

InventoryManagerImpl class:



ViewDVDController:



web.xml:


spring.properties:



spring-servlet:



jdbc-context.xml:




applicationContext.xml:
app-structure.GIF
[Thumbnail for app-structure.GIF]
 
Ranch Hand
Posts: 686
Netbeans IDE Chrome Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have
@Autowired // ?
private InventoryManager manager;

but you have not wired in InventoryManagerImpl instance. You need to mark InventoryManagerImpl as @Resource or @Controller.

Hopefully you are asking Spring to scan the packages and look out for annotations
 
karl czukoski
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
InventoryManagerImpl is marked @Controller

jdbc-context.xml contains <tx:annotation-driven transaction-manager="transactionManager" />
 
Vyas Sanzgiri
Ranch Hand
Posts: 686
Netbeans IDE Chrome Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

karl czukoski wrote:InventoryManagerImpl is marked @Controller

jdbc-context.xml contains <tx:annotation-driven transaction-manager="transactionManager" />



Don't see it in the class you have posted above
 
karl czukoski
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I misunderstood

Now have:



but still the same error
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!