在hybris服务时,无法自动找不到类型的豆类

时间:2018-04-12 08:34:08

标签: autowired hybris

<!-- 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 ;

当我使用autorwired时,它说

could not autowire no beans of type found

我写resource or resource(name=totalCustomerService)

的时候

它给出了空指针。

这是serviceimpl

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 ;

2 个答案:

答案 0 :(得分: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">

答案 1 :(得分:0)

这是因为空白

class=" de.

这里