Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException:

前端 未结 2 1014
轻奢々
轻奢々 2020-12-28 16:55

I am creating web application using Spring, Hibernate, Struts, and Maven.

I get the below error when I run mvn clean install command:

o         


        
2条回答
  •  萌比男神i
    2020-12-28 17:30

    Use component scanning as given below, if com.project.action.PasswordHintAction is annotated with stereotype annotations

    
    

    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

    
    

提交回复
热议问题