aspose file tools*
The moose likes Spring and the fly likes @Autowired problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "@Autowired problem" Watch "@Autowired problem" New topic
Author

@Autowired problem

karl czukoski
Greenhorn

Joined: Dec 30, 2010
Posts: 22
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:


[Thumbnail for app structure.GIF]

Vyas Sanzgiri
Ranch Hand

Joined: Jun 16, 2007
Posts: 686

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


===Vyas Sanzgiri===
My Blog
karl czukoski
Greenhorn

Joined: Dec 30, 2010
Posts: 22
InventoryManagerImpl is marked @Controller

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

Joined: Jun 16, 2007
Posts: 686

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

Joined: Dec 30, 2010
Posts: 22
I misunderstood

Now have:



but still the same error
 
Consider Paul's rocket mass heater.
 
subject: @Autowired problem