- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我接到的任务是开发现有的 AngularJS SPA(应用程序 B)。此应用程序使用另一个应用程序(应用程序 B)中的代码从数据库获取信息。两个都;应用程序 A 和应用程序 B 使用相同的数据库。目标是修改应用程序 B 以从不同的数据库获取客户、位置和 jetty 。我的目标是仍然使用应用程序 A 使用的一些相同代码,并为应用程序 B 创建新代码,然后访问新数据库以获取信息。
当我尝试启动应用程序 (Eclipse Oxigen) 时,BeanFactory 抛出异常。
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)}
我怀疑 Spring Context 中没有定义该 bean,但我不知道如何定义它。我已经尝试过其他帖子中的建议,但没有任何效果。接下来我将发布代码和相关文件...
请记住,我对 Spring、REStful 服务等还很陌生。我希望你能帮助我解决这个错误。预先感谢您。
服务文件
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);
}
<小时/>
服务实现
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;
}
}
<小时/>
道
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();
}
}
<小时/>
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>
最佳答案
这是因为您的 ComponentScan 没有看到您声明 @Service 的包。发布 Spring 上下文。
关于java - 我收到 BeanFactory 错误 : NoSuchBeanDefinitionException and I can't figure out how to solve it,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47961936/
我对这个错误很困惑: Cannot implicitly convert type 'System.Func [c:\Program Files (x86)\Reference Assemblies\
考虑这段代码: pub trait Hello { fn hello(&self); } impl Hello for Any { fn hello(&self) {
问题很简单。是否可以构造这样一个类型 T,对于它下面的两个变量声明会产生不同的结果? T t1 = {}; T t2{}; 我已经研究 cppreference 和标准一个多小时了,我了解以下内容:
Intellij idea 给我这个错误:“Compare (T, T) in Comparator cannot be applied to (T, T)” 对于以下代码: public class
任何人都可以告诉我 : n\t\t\t\t\n\t\t\t 在以下来自和 dwr 服务的响应中的含义和用途是什么. \r\n\t\t\t \r\n\t\t\t
让 T 成为一个 C++ 类。 下面三个指令在行为上有什么区别吗? T a; T a(); T a = T(); T 为不带参数的构造函数提供了显式定义这一事实是否对问题有任何改变? 后续问题:如果
Rust中的智能指针是什么 智能指针(smart pointers)是一类数据结构,是拥有数据所有权和额外功能的指针。是指针的进一步发展 指针(pointer)是一个包含内存地
比如我有一个 vector vector > v={{true,1},{true,2},{false,3},{false,4},{false,5},{true,6},{false,7},{true,8
我有一个来自 .xls 电子表格的数据框,我打印了 print(df.columns.values) 列,输出包含一个名为:Poll Responses\n\t\t\t\t\t。 我查看了 Excel
This question already has answers here: What are good reasons for choosing invariance in an API like
指针类型作为类型前缀与在类型前加斜杠作为后缀有什么区别。斜线到底是什么意思? 最佳答案 语法 T/~ 和 T/& 基本上已被弃用(我什至不确定编译器是否仍然接受它)。在向新向量方案过渡的初始阶段,[T
我正在尝试找到一种方法来获取模板参数的基类。 考虑以下类: template class Foo { public: Foo(){}; ~Foo(){};
这是一个让我感到困惑的小问题。我不知道如何描述它,所以只看下面的代码: struct B { B() {} B(B&) { std::cout ::value #include
为什么有 T::T(T&) 而 T::T(const T&) 更适合 copy ? (大概是用来实现move语义的???) 原始描述(被melpomene证明是错误的): 在C++11中,支持了一种新
在 Java 7 中使用 eclipse 4.2 并尝试实现 List 接口(interface)的以下方法时,我收到了警告。 public T[] toArray(T[] a) { ret
假设有三个函数: def foo[T](a:T, b:T): T = a def test1 = foo(1, "2") def test2 = foo(List(), ListBuffer()) 虽
我对柯里化(Currying)和非柯里化(Currying)泛型函数之间类型检查的差异有点困惑: scala> def x[T](a: T, b: T) = (a == b) x: [T](a: T,
考虑一个类A,我如何编写一个具有与相同行为的模板 A& pretty(A& x) { /* make x pretty */ return x; } A pretty(A&& x) {
Eclipse 表示由于泛型类型橡皮擦,类型参数不允许使用 instanceof 操作。 我同意在运行时不会保留任何类型信息。但是请考虑以下类的通用声明: class SomeClass{ T
在 C++14 中: 对于任何整数或枚举类型 T 以及对于任何表达式 expr: 有没有区别: struct S { T t { expr }; }; 和 struct S { T t = { exp
我是一名优秀的程序员,十分优秀!