这是错误:
WARN [localhost-startStop-1] [CloseAwareApplicationContext]异常 在上下文初始化期间遇到 - 取消刷新 尝试:org.springframework.beans.factory.BeanCreationException: 创建名称为' totalCustomersDao'的bean时出错在课堂上定义 path resource [trainingcore-spring.xml]:设置属性时出错 值;嵌套异常是 org.springframework.beans.NotWritablePropertyException:无效 property' modelService'豆类 [de.hybris.training.core.dao.impl.TotalCustomersDaoImpl]:Bean property' modelService'不可写或具有无效的setter 方法。 setter的参数类型是否与返回类型匹配 吸气鬼? WARN [localhost-startStop-1] [CloseAwareApplicationContext]在上下文中遇到异常 初始化 - 取消刷新尝试: org.springframework.beans.factory.BeanCreationException:错误 用名称' totalCustomersDao'创建bean在类路径中定义 resource [trainingcore-spring.xml]:设置属性值时出错; 嵌套异常是 org.springframework.beans.NotWritablePropertyException:无效 property' modelService'豆类 [de.hybris.training.core.dao.impl.TotalCustomersDaoImpl]:Bean property' modelService'不可写或具有无效的setter 方法。 setter的参数类型是否与返回类型匹配 吸气鬼?错误[localhost-startStop-1] [HybrisContextFactory]初始化全局应用程序上下文时出错! org.springframework.beans.factory.BeanCreationException:错误 用名称' totalCustomersDao'创建bean在类路径中定义 resource [trainingcore-spring.xml]:设置属性值时出错; 嵌套异常是 org.springframework.beans.NotWritablePropertyException:无效 property' modelService'豆类 [de.hybris.training.core.dao.impl.TotalCustomersDaoImpl]:Bean property' modelService'不可写或具有无效的setter 方法。 setter的参数类型是否与返回类型匹配 吸气鬼?
trainingcore.spring.xml
<!-- Total Customer service dao facade-->
<alias alias="totalCustomersDao" name="totalCustomersDao"/>
<bean id="totalCustomersDao"
class="de.hybris.training.core.dao.impl.TotalCustomersDaoImpl"
parent="abstractItemDao" >
<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>
TotalCustomersDaoImpl
public class TotalCustomersDaoImpl implements TotalCustomersDao { private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(UsersFindJob.class);
private static final String query =
"SELECT *" +
"FROM {" + CustomerModel._TYPECODE + "}"+
"WHERE p_name LIKE "
+ "'%" + CustomerModel.NAME+"+%'";
private DefaultFlexibleSearchService flexibleSearchService;
public List<CustomerModel> findAllCustomersFromDao(String name) {
LOG.info("***********************************");
LOG.info("***********************************");
LOG.info("*************************findAllCustomersFromDao**********");
LOG.info("***********************************");
LOG.info("***********************************");
final Map<String, Object> params = new HashMap<String, Object>();
params.put(CustomerModel.NAME, name);
FlexibleSearchQuery fQuery = new FlexibleSearchQuery(query);
if (params != null) {
fQuery.addQueryParameters(params);
}
final SearchResult<CustomerModel> result = flexibleSearchService.search(fQuery);
return result.getResult();
}
public void setFlexibleSearchService(DefaultFlexibleSearchService flexibleSearchService) {
this.flexibleSearchService = flexibleSearchService;
}
public DefaultFlexibleSearchService getFlexibleSearchService() {
return flexibleSearchService;
}
}
TotalCustomerFacadeImpl
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;
}
@Override
public List<String> findCustomerContainingName(String firstName) {
List<CustomerModel> customerModels;
List<String> customerFirstNames = new ArrayList<>();
LOG.info("***********************************");
LOG.info("***********************************");
LOG.info("*************************findCustomerContainingName**********");
LOG.info("***********************************");
LOG.info("***********************************");
customerModels = totalCustomerService.getAllCustomersNames(firstName);
LOG.info("***********************************");
LOG.info("***********************************");
LOG.info("*************************2findCustomerContainingName**********");
LOG.info("***********************************");
LOG.info("***********************************");
for (int i = 0; i < customerModels.size(); i++) {
final String fName = splitName(customerModels.get(i).getName())[0];
customerFirstNames.add(fName);//adding first name
}
return customerFirstNames;
}
TotalCustomerServiceImpl
public class TotalCustomerServiceImpl implements TotalCustomerService {
private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(UsersFindJob.class);
private TotalCustomersDao totalCustomersDao;
public TotalCustomersDao getTotalCustomersDao() {
return totalCustomersDao;
}
public void setTotalCustomersDao(TotalCustomersDao totalCustomersDao) {
this.totalCustomersDao = totalCustomersDao;
}
错误说Bean property 'modelService' is not writable or has an invalid setter method.
我还没有使用modelservice
。
对于Dao和服务类,我在XML和JAVA中有真正的名字。在IntelliJ的想法中,当我点击XML时,我可以去我期望的java类。
答案 0 :(得分:0)
问题是,您已在XML中为id text found
a simultaneous there the 0
b simultaneous there 0
c mul why the 0
d mul the 1
e simul a b c 1
f a c b 0
声明data=pd.DataFrame({"id":("a","b","c","d","e","f"), "text":("simultaneous there the","simultaneous there","mul why the","mul the","simul a b c","a c b")})
list_of_word=["mul the","a b c"]
pattern = '|'.join(list_of_word)
data['found'] = data['text'].apply(lambda x: sum(i in list_of_test_2 for i in x.split()))
data['found']=np.where(data['found']>0,1,0)
data
###Output generated###
id text found
a simultaneous there the 0
b simultaneous there 0
c mul why the 0
d mul the 0
e simul a b c 0
f a c b 0
,而在另一方面,您尚未实施parent="abstractItemDao"
类。
换句话说,您的类没有任何在您的XML bean定义中实际定义的modelService属性,它会导致modelService的NotWritablePropertyException
如果您根本不想使用AbstractItemDao类中的任何内容,则可以从totalCustomersDao
声明中删除AbstractItemDao
。
parent="abstractItemDao"
或
在totalCustomersDao
<alias alias="totalCustomersDao" name="totalCustomersDao"/>
<bean id="totalCustomersDao"
class="de.hybris.training.core.dao.impl.TotalCustomersDaoImpl">
<property name="flexibleSearchService" ref="flexibleSearchService"/>
</bean>
课程
AbstractItemDao