我被赋予了处理现有AngularJS SPA(应用B)的任务。此应用使用来自其他应用(应用B)的代码从数据库中获取信息。都; app A和app B使用相同的数据库。目标是修改应用程序B以从其他数据库获取客户,位置和码头。我的目标是仍然使用app A使用的一些相同代码,并为app B创建新代码,然后访问新数据库以获取信息。
当我尝试启动应用程序(Eclipse Oxigen)时,我得到BeanFactory抛出的异常。
org.springframework.beans.factory.UnsatisfiedDependencyException:创建名称为' contextServiceImpl的bean时出错:通过字段' customersRepo' 表示不满意的依赖关系嵌套异常是org.springframework.beans.factory.NoSuchBeanDefinitionException:没有类型' com.csoln.lv.data.cld.dao.CustomersRepo' 的限定bean:至少预期1豆,有资格作为autowire候选人。依赖注释:{@ org.springframework.beans.factory.annotation.Autowired(required = true)}
我怀疑bean没有在Spring Context中定义,但我不知道如何定义它。我已经尝试过在其他帖子上找到的建议,但没有任何效果。我将在下面发布代码和相关文件......
请记住,我是Spring,REstful Services等的新手。我希望你能帮我解决这个错误。提前谢谢。
服务文件
package com.csoln.lv.service;
import java.util.List;
import java.util.Map;
import com.csoln.lv.cld.bo.CustomerBo;
import com.csoln.lv.cld.bo.DockBo;
import com.csoln.lv.cld.bo.LocationBo;
public interface ContextService {
public List<CustomerBo> getCustomersFiltered();
public Map<String, CustomerBo> getCustomerMapFiltered();
public CustomerBo getCustomer(Integer id);
public List<CustomerBo> getAllCustomers();
public List<CustomerBo> getCustomers();
public Map<String, CustomerBo> getCustomerMap();
public Map<Integer, CustomerBo> getCustomerMapById();
public List<LocationBo> getLocationsFiltered(CustomerBo customer);
public Map<String, LocationBo> getLocationMapFiltered(CustomerBo customer);
public Map<Integer, LocationBo> getLocationMapByIdFiltered(CustomerBo customer);
public LocationBo getLocation(Integer customerId, Integer id);
public List<LocationBo> getAllLocations(CustomerBo customer);
public List<LocationBo> getLocations(CustomerBo customer);
public List<DockBo> getDocksFiltered(LocationBo location);
public Map<String, DockBo> getDockMapFiltered(LocationBo location);
public Map<Integer, DockBo> getDockMapByIdFiltered(LocationBo location);
public DockBo getDock(Integer customerId, Integer locationId, Integer id);
public List<DockBo> getAllDocks(LocationBo location);
public List<DockBo> getDocks(LocationBo location);
public List<DockBo> getSubDocks(DockBo dock);
public Map<String, DockBo> getSubDockMap(DockBo dock);
public Map<Integer, DockBo> getSubDockMapById(DockBo dock);
}
服务IMPL
package com.csoln.lv.service;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service;
// For Liveview
import com.csoln.lv.cld.bo.CustomerBo;
import com.csoln.lv.cld.bo.DockBo;
import com.csoln.lv.cld.bo.LocationBo;
import com.csoln.lv.data.cld.dao.CustomersRepo;
import com.csoln.lv.data.cld.dao.DocksRepo;
import com.csoln.lv.data.cld.dao.LocationsRepo;
import com.csoln.lv.data.dom.Customers;
import com.csoln.lv.data.dom.Docks;
import com.csoln.lv.data.dom.Locations;
import com.csoln.lv.data.id.DockId;
import com.csoln.lv.data.id.LocationId;
@Service
@SuppressWarnings("unchecked")
public class ContextServiceImpl implements ContextService {
private static Logger log = Logger.getLogger(ContextServiceImpl.class);
@Autowired
private CustomersRepo customersRepo;
@Autowired
private LocationsRepo locationsRepo;
@Autowired
private DocksRepo docksRepo;
private String customerPrefix = "C_";
private String locationPrefix = "L_";
private String dockPrefix = "D_";
/* (non-Javadoc)
* @see com.csoln.service.data.ContextService#getCustomers()
*/
@Override
public List<CustomerBo> getCustomersFiltered() {
List<String> filter = this.getGrantedAuthorities(this.customerPrefix);
List<CustomerBo> customers = new ArrayList<>();
List<CustomerBo> clients = this.getCustomers(true);
if( clients != null && filter != null && clients.size() > 0 && filter.size() > 0 ) {
Stream<CustomerBo> stream = clients.stream().filter( entry -> filter.contains(entry.getId().toString()));
customers = stream.collect(Collectors.toList());
}
if( log.isDebugEnabled() ) {
log.debug(clients);
}
return customers;
}
/* (non-Javadoc)
* @see com.csoln.service.data.ContextService#getCustomerMap()
*/
@Override
public Map<String, CustomerBo> getCustomerMapFiltered() {
List<CustomerBo> customers = this.getCustomersFiltered();
Map<String, CustomerBo> clients = new HashMap<>();
if( customers != null && customers.size() > 0 ) {
customers.forEach(c -> clients.put(c.getAbbreviation(), c));
}
if( log.isDebugEnabled() ) {
log.debug(clients);
}
return clients;
}
/* (non-Javadoc)
* @see com.csoln.service.ContextService#getCustomer(java.lang.Integer)
*/
@Override
public CustomerBo getCustomer(Integer id) {
return new CustomerBo().toBo(this.customersRepo.findOne(id));
}
/* (non-Javadoc)
* @see com.csoln.service.ContextService#getCustomers()
*/
@Override
public List<CustomerBo> getAllCustomers() {
List<CustomerBo> customers = this.getCustomers(false);
return customers;
}
@Override
public List<CustomerBo> getCustomers() {
List<CustomerBo> customers = this.getCustomers(true);
return customers;
}
private List<CustomerBo> getCustomers(Boolean active) {
Example<Customers> example = null;
List<Customers> entities = null;
if( active ) {
Customers probe = new Customers();
probe.setActiveEntry(active);
example = Example.of(probe);
entities = this.customersRepo.findAll(example, new Sort(Direction.ASC, "shortName"));
} else {
entities = this.customersRepo.findAll(new Sort(Direction.ASC, "shortName"));
}
List<CustomerBo> customers = new ArrayList<>();
if( entities != null && entities.size() > 0 ) {
entities.forEach(c -> {
customers.add(new CustomerBo().toBo(c));
});
}
return customers;
}
/* (non-Javadoc)
* @see com.csoln.service.data.ContextService#getCustomerMapById()
*/
public Map<Integer, CustomerBo> getCustomerMapById() {
SortedMap<Integer, CustomerBo> clients = new TreeMap<>();
List<CustomerBo> customers = this.getAllCustomers();
if( customers != null && !customers.isEmpty() ) {
customers.forEach(c -> clients.put(c.getId(), c) );
}
if( log.isDebugEnabled() ) {
log.debug(clients);
}
return clients;
}
/* (non-Javadoc)
* @see com.csoln.service.data.ContextService#getCustomerMapByAbbreviation()
*/
@Override
public Map<String, CustomerBo> getCustomerMap() {
SortedMap<String, CustomerBo> clients = new TreeMap<>();
List<CustomerBo> customers = this.getAllCustomers();
if( customers != null && !customers.isEmpty() ) {
customers.forEach(c -> clients.put(c.getAbbreviation(), c));
}
if( log.isDebugEnabled() ) {
log.debug(clients);
}
return clients;
}
/* (non-Javadoc)
* @see com.csoln.service.data.ContextService#getLocations(com.csoln.web.bean.CustomerBean)
*/
@Override
public List<LocationBo> getLocationsFiltered(CustomerBo customer) {
List<String> filter = this.getGrantedAuthorities(this.locationPrefix + customer.getId() + "_");
List<LocationBo> locations = new ArrayList<>();
List<LocationBo> ls = this.getLocations(customer);
if( ls != null && !ls.isEmpty() ) {
locations = ls.stream().filter( l-> filter.contains(l.getId().toString())).collect(Collectors.toList());
Collections.sort(locations, (l1, l2) -> (l1.getId() < l2.getId())?1:0);
}
if( log.isDebugEnabled() ) {
}
return locations;
}
/* (non-Javadoc)
* @see com.csoln.service.data.ContextService#getLocationMap(com.csoln.web.bean.CustomerBean)
*/
@Override
public Map<String, LocationBo> getLocationMapFiltered(CustomerBo customer) {
Map<String, LocationBo> locations = new TreeMap<>();
List<LocationBo> locs = this.getLocationsFiltered(customer);
if( locs != null && !locs.isEmpty() ) {
locs.forEach(l -> locations.put(l.getAbbreviation(), l));
}
log.debug(locations);
return locations;
}
/* (non-Javadoc)
* @see com.csoln.service.data.ContextService#getLocationMapById(com.csoln.web.bean.CustomerBean, java.lang.String)
*/
@Override
public Map<Integer, LocationBo> getLocationMapByIdFiltered(CustomerBo customer) {
Map<Integer, LocationBo> locations = new TreeMap<>();
List<LocationBo> locs = this.getLocationsFiltered(customer);
if( locs != null && !locs.isEmpty() ) {
locs.forEach(l -> locations.put(l.getId(), l));
}
log.debug(locations);
return locations;
}
@Override
public LocationBo getLocation(Integer customerId, Integer id) {
LocationId locId = new LocationId(customerId, id);
return new LocationBo().toBo(this.locationsRepo.findOne(locId));
}
/* (non-Javadoc)
* @see com.csoln.service.ContextService#getLocations(com.csoln.common.bo.CustomerBo)
*/
@Override
// @Cacheable(cacheNames = "context", key="#root.target+#root.methodName+#customer")
public List<LocationBo> getAllLocations(CustomerBo customer) {
List<LocationBo> locations = this.getLocations(customer, false);
return locations;
}
@Override
public List<LocationBo> getLocations(CustomerBo customer) {
List<LocationBo> locations = this.getLocations(customer, true);
return locations;
}
private List<LocationBo> getLocations(CustomerBo customer, Boolean active) {
Locations probe = new Locations(customer.getId());
if( active ) {
probe.setActiveEntry(active);
}
List<Locations> entities = this.locationsRepo.findAll(Example.of(probe), new Sort(Direction.ASC, "shortName"));
List<LocationBo> locations = new ArrayList<>();
if( entities != null && entities.size() > 0 ) {
entities.forEach( l->{
locations.add(new LocationBo().toBo(l));
});
}
return locations;
}
/* (non-Javadoc)
* @see com.csoln.service.data.ContextService#getDocks(com.csoln.web.bean.LocationBean)
*/
@Override
public List<DockBo> getDocksFiltered(LocationBo location) {
List<String> filter = this.getGrantedAuthorities(this.dockPrefix + location.getCustomerId() + "_" + location.getId() + "_");
List<DockBo> docs = this.getDocks(location);
List<DockBo> docks = new ArrayList<>();
if( docs != null && filter != null && !docs.isEmpty() ) {
docks = docs.stream().filter( d-> filter.contains(d.getId().toString())).collect(Collectors.toList());
Collections.sort(docks, (d1, d2) -> (d1.getId() < d2.getId())?1:0);
}
if( log.isDebugEnabled() ) {
log.debug(docks);
}
return docks;
}
/* (non-Javadoc)
* @see com.csoln.service.data.ContextService#getDockMap(com.csoln.web.bean.LocationBean)
*/
@Override
public Map<String, DockBo> getDockMapFiltered(LocationBo location) {
Map<String, DockBo> docks = new TreeMap<>();
List<DockBo> dcks = this.getDocksFiltered(location);
if( dcks != null & !dcks.isEmpty() ) {
dcks.forEach(d -> docks.put(d.getAbbreviation(), d));
}
if( log.isDebugEnabled() ) {
log.debug(docks);
}
return docks;
}
/* (non-Javadoc)
* @see com.csoln.service.data.ContextService#getDockMapById(com.csoln.web.bean.LocationBean, java.lang.String)
*/
@Override
public Map<Integer, DockBo> getDockMapByIdFiltered(LocationBo location) {
Map<Integer, DockBo> docks = new TreeMap<>();
List<DockBo> dcks = this.getDocksFiltered(location);
if( dcks != null & !dcks.isEmpty() ) {
dcks.forEach(d -> docks.put(d.getId(), d));
}
if( log.isDebugEnabled() ) {
log.debug(docks);
}
return docks;
}
@Override
public DockBo getDock(Integer customerId, Integer locationId, Integer id) {
DockId dockId = new DockId(customerId, locationId, id);
return new DockBo().toBo(this.docksRepo.findOne(dockId));
}
/* (non-Javadoc)
* @see com.csoln.service.ContextService#getDocks(com.csoln.common.bo.LocationBo)
*/
@Override
// @Cacheable(cacheNames = "context", key="#root.target+#root.methodName+#location")
public List<DockBo> getAllDocks(LocationBo location) {
List<DockBo> docks = this.getDocksIfActive(location.getCustomerId(), location.getId(), false);
return docks;
}
@Override
public List<DockBo> getDocks(LocationBo location) {
List<DockBo> docks = this.getDocksIfActive(location.getCustomerId(), location.getId(), true);
return docks;
}
private List<DockBo> getDocksIfActive(Integer customerId, Integer locationId, Boolean active) {
List<DockBo> docks = new ArrayList<>();
List<Docks> entities = null;
Docks probe = new Docks(customerId, locationId);
if( active ) {
probe.setActiveEntry(active);
}
entities = this.docksRepo.findAll(Example.of(probe), new Sort(Direction.ASC, "shortName"));
List<DockBo> subdocks = new ArrayList<>();
if( entities != null && entities.size() > 0 ) {
entities.forEach( d-> {
subdocks.addAll(getSubDocks(new DockBo().toBo(d)));
docks.add(new DockBo().toBo(d));
});
}
subdocks.forEach(sd -> {
docks.remove(sd);
});
return docks;
}
/* (non-Javadoc)
* @see com.csoln.service.data.ContextService#getSubDocks(com.csoln.web.bean.DockBean)
*/
@Override
// @Cacheable(cacheNames = "context", key="#root.target+#root.methodName+#dock")
public List<DockBo> getSubDocks(DockBo dock) {
List<DockBo> docks = new ArrayList<>();
List<Docks> dcs = this.docksRepo.findSubDocksForDock(dock.getCustomerId(), dock.getLocationId(), dock.getId());
if( dcs != null ) {
dcs.forEach(d ->docks.add(new DockBo().toBo(d)));
}
return docks;
}
/* (non-Javadoc)
* @see com.csoln.service.data.ContextService#getSubDockMap(com.csoln.web.bean.DockBean)
*/
@Override
public Map<String, DockBo> getSubDockMap(DockBo dock) {
Map<String, DockBo> docks = new TreeMap<>();
List<DockBo> dcs = this.getSubDocks(dock);
if( dcs != null ) {
dcs.forEach(d ->docks.put(d.getAbbreviation(), d));
}
return docks;
}
/* (non-Javadoc)
* @see com.csoln.service.data.ContextService#getSubDockMapById(com.csoln.web.bean.DockBean, java.lang.String)
*/
@Override
public Map<Integer, DockBo> getSubDockMapById(DockBo dock) {
Map<Integer, DockBo> docks = new TreeMap<>();
List<DockBo> dcs = this.getSubDocks(dock);
if( dcs != null ) {
dcs.forEach(d ->docks.put(d.getId(), d));
}
return docks;
}
private List<String> getGrantedAuthorities(String prefix) {
List<String> filter = new ArrayList<>();
Collection<SimpleGrantedAuthority> authorities = (Collection<SimpleGrantedAuthority>) SecurityContextHolder.getContext().getAuthentication().getAuthorities();
Stream<SimpleGrantedAuthority> filtered = authorities.stream().filter(a -> a.getAuthority().startsWith(prefix));
filtered.forEach(a -> filter.add(a.getAuthority().replace(prefix, "")));
log.debug("Filtered by User: " + filter);
return filter;
}
/**
* @return the customerPrefix
*/
public String getCustomerPrefix() {
return customerPrefix;
}
/**
* @param customerPrefix the customerPrefix to set
*/
public void setCustomerPrefix(String customerPrefix) {
this.customerPrefix = customerPrefix;
}
/**
* @return the locationPrefix
*/
public String getLocationPrefix() {
return locationPrefix;
}
/**
* @param locationPrefix the locationPrefix to set
*/
public void setLocationPrefix(String locationPrefix) {
this.locationPrefix = locationPrefix;
}
/**
* @return the dockPrefix
*/
public String getDockPrefix() {
return dockPrefix;
}
/**
* @param dockPrefix the dockPrefix to set
*/
public void setDockPrefix(String dockPrefix) {
this.dockPrefix = dockPrefix;
}
}
THE DAO
package com.csoln.lv.data.cld.dao;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import com.csoln.lv.data.dom.Customers;
import com.csoln.data.repository.SyncRepository;
public interface CustomersRepo extends JpaRepository<Customers, Integer>, SyncRepository<Customers> {
public List<Customers> findByAbbreviationAndActiveEntryTrue(String abbreviation);
public List<Customers> findByIdInAndActiveEntryTrue(List<Integer> customerIds);
@Query("SELECT new Customers(id, abbreviation, shortName, longName) FROM Customers WHERE activeEntry = true ORDER BY abbreviation ASC")
public List<Customers> findDisplayInfo();
@Query("SELECT new Customers(id, abbreviation, shortName, longName) FROM Customers WHERE id IN :customerIds AND activeEntry = true")
public List<Customers> findDisplayInfoByIdIn(@Param("customerIds") List<Integer> customerIds);
@Query("SELECT new Customers(id, abbreviation, shortName, longName) FROM Customers WHERE abbreviation IN :abbreviations AND activeEntry = true")
public List<Customers> findDisplayInfoByAbbrIn(@Param("abbreviations") List<String> abbreviations);
}
客户
package com.csoln.lv.data.dom;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.Id;
import javax.persistence.Table;
import org.springframework.data.domain.Persistable;
import com.csoln.data.common.AbstractAbbreviation;
import com.csoln.data.listener.SimpleSequenceId;
import com.csoln.data.listener.SimpleSequenceIdListener;
import com.fasterxml.jackson.annotation.JsonIgnore;
/**
* @author eduardo.serrano
*
*/
@Entity
@Table(name = Customers.TABLE)
@EntityListeners(SimpleSequenceIdListener.class)
public class Customers extends AbstractAbbreviation implements Persistable<Integer>, SimpleSequenceId {
public static final String TABLE = "customers";
private static final long serialVersionUID = -8559335312619610990L;
@Id
private Integer id;
public Customers() {
super();
}
public Customers(Integer id, String abbreviation, String shortName, String longName) {
super();
this.id = id;
this.setAbbreviation(abbreviation);
this.setShortName(shortName);
this.setLongName(longName);
}
/**
* @return the id
*/
public Integer getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Integer id) {
this.id = id;
}
/* (non-Javadoc)
* @see org.springframework.data.domain.Persistable#isNew()
*/
@Override
@JsonIgnore
public boolean isNew() {
return this.id == null;
}
/* (non-Javadoc)
* @see com.csoln.data.common.AbstractAuditable#toString()
*/
@Override
public String toString() {
return new StringBuilder("\n\r\t\t" + this.getClass().getName() + " - ID: " + this.id + ", " +super.toString()).toString();
}
}
THE BO
package com.csoln.lv.cld.bo;
import com.csoln.lv.data.dom.Customers;
import com.csoln.bo.common.AuditableBo;
public class CustomerBo extends AuditableBo<CustomerBo, Customers> {
private static final long serialVersionUID = 6234658974110288240L;
private Integer id;
private String abbreviation;
private String code;
private String label;
private Boolean activeEntry;
public CustomerBo() {
super();
}
public CustomerBo(Integer id, String abbreviation, String code, String label) {
super();
this.id = id;
this.abbreviation = abbreviation;
this.code = code;
this.label = label;
}
/**
* @return the id
*/
public Integer getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return the abbreviation
*/
public String getAbbreviation() {
return abbreviation;
}
public CustomerBo setAbbreviation(String abbreviation) {
this.abbreviation = abbreviation;
return this;
}
/**
* @return the code
*/
public String getCode() {
return code;
}
public CustomerBo setCode(String code) {
this.code = code;
return this;
}
/**
* @return the label
*/
public String getLabel() {
return label;
}
public CustomerBo setLabel(String label) {
this.label = label;
return this;
}
/**
* @return the activeEntry
*/
public Boolean getActiveEntry() {
return activeEntry;
}
/**
* @param activeEntry the activeEntry to set
*/
public void setActiveEntry(Boolean activeEntry) {
this.activeEntry = activeEntry;
}
@SuppressWarnings("unchecked")
@Override
public <B extends CustomerBo> B toBo(Customers domain) {
if( domain != null ) {
super.toBo(domain);
this.id = domain.getId();
this.abbreviation = domain.getAbbreviation();
this.code = domain.getShortName();
this.label = domain.getLongName();
this.activeEntry = domain.getActiveEntry();
}
return (B) this;
}
public Customers toDomain() {
Customers domain = new Customers();
domain = super.toDomain(domain);
domain.setId(id);
domain.setAbbreviation(abbreviation);
domain.setLongName(this.label);
domain.setShortName(this.code);
domain.setActiveEntry(activeEntry);
return domain;
}
@Override
public boolean equals(Object obj) {
boolean equals = false;
if( obj instanceof CustomerBo ) {
CustomerBo i = (CustomerBo)obj;
equals = (id == i.getId());
}
return equals;
}
@Override
public int hashCode() {
return 4000;
}
}
错误
SEVERE: Exception sending context initialized event to listener instance of class [org.springframework.web.context.ContextLoaderListener]
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'contextServiceImpl': Unsatisfied dependency expressed through field 'customersRepo'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.csoln.lv.data.cld.dao.CustomersRepo' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.csoln.lv.data.cld.dao.CustomersRepo' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
XML SPRING上下文件
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:cache="http://www.springframework.org/schema/cache"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<context:annotation-config></context:annotation-config>
<bean class="com.csoln.context.CsolnContext" />
<import resource="classpath:/props-context.xml"/>
<import resource="classpath:/config/data-context.xml" />
<import resource="classpath:/config/livedock-data-context.xml" />
<import resource="classpath:/config/security-context.xml" />
<import resource="classpath:/config/cache-context.xml" />
<context:component-scan base-package="
com.csoln.lookup,
com.csoln.lv.service">
</context:component-scan>
<bean class="com.csoln.service.ContextServiceImpl" />
<bean class="com.csoln.service.CodeServiceImpl" />
<bean class="com.csoln.service.ReferenceServiceImpl" />
<bean id="jsonProvider" class="com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider" />
</beans>
答案 0 :(得分:0)
这是因为您的ComponentScan没有看到您声明@Service的包。发布Spring Context。
答案 1 :(得分:0)
您错过了@Repository
CustomersRepo
注释