I have a spring web application. I defined a bean controller that accepts a bean property as a property. The bean service also accepts Tao. Tao is verified and working fine. Now the problem is with the service. In fact, I would take care of the setters!
what is the problem?
Bean controller:
<bean id="listTypeController" class="me.web.servlet.controller.ListTypeController"> <property name="typeService" ref="typeService" /> </bean>
Service bean:
<bean id="typeService"class="me.general.service.impl.TypeServiceImpl"> <property name="genericDao" ref="genericDao" /> <property name="typeDao" ref="typeDao" /> </bean>
Class of service:
public class TypeServiceImpl implements TypeService { private TypeDao typeDao; private GenericDao genericDao; public TypeDao getTypeDao() { return typeDao; } public GenericDao getGenericDao() { return genericDao; } public void setTypeDao(TypeDao typeDao) { this.typeDao = typeDao; } public void setGenericDao(GenericDao genericDao) { this.genericDao = genericDao; } }
List controller:
public class ListTypeController { public static final String SEARCH_TYPE_FORM_ATTRIBUTE_NAME = "SearchTypeForm"; private TypeService typeService; @ModelAttributeSEARCH_TYPE_FORM_ATTRIBUTE_NAME) public SearchTypeForm createForm() { SearchTypeForm form = new SearchTypeForm(); form.setPageSize(SystemConfiguration.getCurrentConfiguration().getDefaultPageSize()); form.setActive(Boolean.TRUE); return form; } @RequestMapping("/administration/types") public String listTypes(@ModelAttribute(SEARCH_TYPE_FORM_ATTRIBUTE_NAME) SearchTypeForm form, Model model) { Page<Type> all = typeService.findTypes(form); model.addAttribute("all", all); return "/master/general/List"; } public void setTypeServic(TypeService typeService) { this.typeService = typeService; } }
Error:
Invalid property 'typeService' of bean class [me.web.servlet.controller.ListTypeController]: Bean property 'typeService' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
source share