This is my first Spring app. Used SpringBOOT, Maven, SpringMVC, Thymeleaf, SpringJPA, MySQL.

Please tell me the code works fine with methods predefined in the Repository interface (CrudRepository or PagingAndSortingRepository), but when I try to create my query, the project does not compile with an error:

Error creating bean with name 'itemRepository': Invocation of init method failed; nested exception is org.springframework.data.mapping.PropertyReferenceException: No property found! Did you mean 'state'

ItemRepository.java

import com.heiko.to_do_list.model.Item; import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.stereotype.Repository; import java.util.List; @Repository public interface ItemRepository extends PagingAndSortingRepository<Item, Integer> { List<Item> findByStatus(boolean stateVal); } 

ItemController.java

 import com.heiko.to_do_list.model.Item; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.ModelAndView; import java.text.ParseException; import java.text.SimpleDateFormat; @Controller public class ItemController { @Autowired private ItemRepository dao; private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm"); @RequestMapping(value = "/", method = RequestMethod.GET) public String ListItems(Model model) { model.addAttribute("items", dao.findAll()); return "items/list"; } } 

added to the recources folder, spring-config.xml

 <?xml version="1.0" encoding="UTF-8"?> <beans:beans xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.springframework.org/schema/data/jpa" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd"> <repositories base-package="com.heiko.to_do_list.controller" /> </beans:beans> 

Does not help.

GIT Link: Git

Closed due to the fact that off-topic by Nofate member 23 Nov '16 at 12:33 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • "The question is caused by a problem that is no longer reproduced or typed . Although similar questions may be relevant on this site, solving this question is unlikely to help future visitors. You can usually avoid similar questions by writing and researching a minimum program to reproduce the problem before publishing the question. " - Nofate
If the question can be reformulated according to the rules set out in the certificate , edit it .

    1 answer 1

    No property status found for type Item! Did you mean 'state'

    Approximate translation:

    The required property in the Item type was not found! Perhaps you meant 'state'.

    In other words, you don't have a status field in the Item class, but there is a state , which you should use.
    How do you think Spring will decide which field to use? He defines it by name.

    Replace findByStatus(...) with findByState(...) .

    • Thank you so much! Everything is the same, eyes zamylilis the simplest mistake did not see: ( - Yuri Heiko