У меня возникло исключение в фазе фазы при попытке построить мой проект.Spring Maven - Не удалось загрузить ApplicationContext NoSuchBeanDefinitionException: Нет квалификационного компонента типа
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException:
No qualifying bean of type [java.lang.String] found for dependency:
expected at least 1 bean which qualifies as autowire candidate for this dependency.
Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true),
@org.springframework.beans.factory.annotation.Qualifier(value=findUserByLogin)}
Проект состоит с 4-х модулей:
AdviceExchange
├── domain
├── dao
├── service
├── web
DAO классы (здесь происходят броски исключение)
package com.dozortsev.adviceexchange.dao;
import com.dozortsev.adviceexchange.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import static java.lang.String.format;
import static org.springframework.transaction.annotation.Propagation.MANDATORY;
@Transactional(propagation = MANDATORY)
@Repository
public class UserDaoImpl extends GenericDaoImpl<Long, User> implements UserDao {
@Autowired
private String findUserByLogin; // Spring can't Autowired this String
public UserDaoImpl() {
this.entityClass = User.class;
}
@Override public User findByLogin(String login) {
try {
log.info(format("Finding %s by Login: %s", getEntityClass(), login));
User user = (User) getCurrentSession().createSQLQuery(findUserByLogin)
.addEntity(getEntityClass()).setString("login", login)
.uniqueResult();
if (user != null) {
log.info("Successful found");
return user;
}
log.info(format("%s not exist", getEntityClass()));
} catch (Exception e) {
log.error("Error: ", e);
}
return null;
}
}
Что случилось с моим ApplicationContext? Пожалуйста, помогите мне решить эту проблему.
Пожалуйста, сократите свой вопрос, просто включив соответствующий код. Не нужно сбрасывать все, что не имеет отношения к вопросу – arahant