【问题标题】:could not autowire no beans of type found, for service in hybris无法自动装配没有找到类型的 bean,用于 hybris 中的服务
【发布时间】:2018-09-22 07:40:47
【问题描述】:
<!-- Total Customer service dao facade-->
<bean id="totalCustomersDao"
      class="de.hybris.training.core.dao.impl.TotalCustomersDaoImpl">
    <property name="flexibleSearchService" ref="flexibleSearchService"/>
</bean>

<bean id="totalCustomerService" class=" de.hybris.training.core.impl.TotalCustomerServiceImpl">
    <property name="totalCustomersDao" ref="totalCustomersDao"/>
</bean>

<bean id="totalCustomerFacade" class="de.hybris.training.core.facade.impl.TotalCustomerFacadeImpl">
    <property name="totalCustomerService" ref="totalCustomerService"/>
</bean>

<bean id="usersFindJob" class=" de.hybris.training.core.job.UsersFindJob"
      parent="abstractJobPerformable" >

</bean>

这是 xml。

这是门面类

public class TotalCustomerFacadeImpl implements TotalCustomerFacade {

//TODO autowired or resoucre not work

    private TotalCustomerService totalCustomerService ;

    private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(UsersFindJob.class);

    public TotalCustomerService getTotalCustomerService() {
        return totalCustomerService;
    }

    public void setTotalCustomerService(TotalCustomerService totalCustomerService) {
        this.totalCustomerService = totalCustomerService;
    }

在这里

   private TotalCustomerService totalCustomerService ;

当我把autowired,它说

could not autowire no beans of type found

当我写resource or resource(name=totalCustomerService)

它给出空指针。

这是服务实现

public class TotalCustomerServiceImpl implements TotalCustomerService {
    private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(UsersFindJob.class);

    @Autowired
    private TotalCustomersDao totalCustomersDao;

    public TotalCustomersDao getTotalCustomersDao() {
        return totalCustomersDao;
    }


    public void setTotalCustomersDao(TotalCustomersDao totalCustomersDao) {
        this.totalCustomersDao = totalCustomersDao;
    }  public List<CustomerModel> getAllCustomersNames (String name) {     LOG.info("***********************************");
        LOG.info("***********************************");
        LOG.info("*************************getAllCustomersNames::");
        LOG.info("***********************************");
        LOG.info("***********************************");


        List<CustomerModel> customerModels = totalCustomersDao.findAllCustomersFromDao( name);

        return customerModels;

    }

这些是接口

public interface TotalCustomerService {

        List<CustomerModel> getAllCustomersNames (String name);


    }

public interface TotalCustomerFacade {



    List<String> findCustomerContainingName(String firstName);


}

我该如何解决这个问题?

路径都在里面

de.hybris.training.core

分开

  • 立面
  • 服务

我能做什么?我需要去那个服务。我试过很多次。添加了自动连线。删除,让它没有任何注释但仍然相同。

这也没用

@Autowired
@Qualifier("totalCustomerService")
    private TotalCustomerService totalCustomerService ;

【问题讨论】:

    标签: autowired hybris


    【解决方案1】:

    删除空格! class=" de.hybris.training

    改变

    <bean id="totalCustomerService" class=" de.hybris.training.core.impl.TotalCustomerServiceImpl">
    

    <bean id="totalCustomerService" class="de.hybris.training.core.impl.TotalCustomerServiceImpl">
    

    【讨论】:

      【解决方案2】:

      这是因为空格

      class=" de.
      

      这里

      【讨论】:

        猜你喜欢
        • 2019-09-16
        • 2017-02-17
        • 2014-10-06
        • 2020-01-31
        • 1970-01-01
        • 2022-01-09
        • 1970-01-01
        • 1970-01-01
        • 2016-09-30
        相关资源
        最近更新 更多