Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

@Autowired problem

 
karl czukoski
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]
 
Vyas Sanzgiri
Ranch Hand
Posts: 686
Chrome Netbeans IDE 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
Chrome Netbeans IDE 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic