Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException:
Use component scanning as given below, if com.project.action.PasswordHintAction
is annotated with stereotype annotations
<context:component-scan base-package="com.project.action"/>
EDIT
I see your problem, in PasswordHintActionTest
you are autowiring PasswordHintAction
. But you did not create bean configuration for PasswordHintAction
to autowire. Add one of stereotype annotation(@Component, @Service, @Controller
) to PasswordHintAction
like
@Component
public class PasswordHintAction extends BaseAction {
private static final long serialVersionUID = -4037514607101222025L;
private String username;
or create xml configuration in applicationcontext.xml
like
<bean id="passwordHintAction" class="com.project.action.PasswordHintAction" />
You need to provide a candidate for autowire. That means that an instance of PasswordHint must be known to spring in a way that it can guess that it must reference it.
Please provide the class head of PasswordHint and/or the spring bean definition of that class for further assistance.
Try changing the name of
PasswordHintAction action;
to
PasswordHintAction passwordHintAction;
so that it matches the bean definition.