org.springframework.beans.NotReadablePropertyException:

Tareq

コントローラーからこのようなBinderPlaceOrderオブジェクトを送信しています

model.addAttribute("addNewBinderPlaceOrder", new BinderPlaceOrder());

私のThymeleafページは、

<form class="addBinderPlaceOrderForm" role="form" action="#" th:action="@{/binderPlaceOrder/new-binderPlaceOrder}" th:object="${addNewBinderPlaceOrder}" method="post">      
  
  <div class="form-group">
        <label>Book</label>
        <select class="form-control" th:field="*{binderOrderItemDetails.book}">
            <option th:if="${book} == null" value=" " >Select Book</option>
            <option th:each="book : ${allBook}"
                    th:value="${book.id}"
                    th:text="${book.name}">
            </option>
        </select>
    </div> 
  
  <form>

これがコントローラーです、

@Controller
@RequestMapping("/binderPlaceOrder")
public class BinderPlaceOrderController{

@Autowired
BinderPlaceOrderService binderPlaceOrderService;

@Autowired
BookService bookService;

@RequestMapping(value="/new-binderPlaceOrder", method = RequestMethod.GET)
public String newBinderPlaceOrder(Model model){

    model.addAttribute("addNewBinderPlaceOrder", new BinderPlaceOrder());

    model.addAttribute("allBook", bookService.getAllBooks();

    model.addAttribute("addNewBinderOrderItemDetails", new BinderOrderItemDetails());

    return "user/binderPlaceOrder/new";
}
}

実行時に以下のエラーが発生します

org.springframework.beans.NotReadablePropertyException:Beanクラス[PublisherInventory.model.user.BinderPlaceOrder]の無効なプロパティ 'binderOrderItemDetails.book':Beanプロパティ 'binderOrderItemDetails.book'が読み取れないか、無効なゲッターメソッドがあります。ゲッターはセッターのパラメータータイプと一致しますか?

以下はクラスです。

すべてのクラスには、他のプロパティとともに独自のIdプロパティがあることに注意してください。読みやすくするために、これらは省略されています。

これがBinderPlaceOrderクラスです。

@Entity
public class BinderPlaceOrder implements Comparator<BinderPlaceOrder> {    

@OneToMany(mappedBy = "binderPlaceOrder", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
private List<BinderOrderItemDetails> binderOrderItemDetails;   

public List<BinderOrderItemDetails> getBinderOrderItemDetails() {
    return binderOrderItemDetails;
}

public void setBinderOrderItemDetails(List<BinderOrderItemDetails> binderOrderItemDetails) {
    this.binderOrderItemDetails = binderOrderItemDetails;
}

}

これがBinderOrderItemDetailsクラスです

@Entity
@Indexed
public class BinderOrderItemDetails {

@OneToOne(fetch = FetchType.EAGER,cascade = CascadeType.ALL)
@JoinColumn(name="bookId")
private Book book;

@ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
@JoinColumn(name="binderPlaceOrderId")
private BinderPlaceOrder binderPlaceOrder;       

public Book getBook() { return book; }

public void setBook(Book book) { this.book = book; }    

public BinderPlaceOrder getBinderPlaceOrder() { return binderPlaceOrder; }

public void setBinderPlaceOrder(BinderPlaceOrder binderPlaceOrder) {
 this.binderPlaceOrder = binderPlaceOrder; }    
}

これが本のクラスです

@Entity
@Indexed
public class Book implements Comparator<Book> {

@Column(name = "name")
@NotNull
@NotBlank 
private String name;

public String getName() {  return name; }
public void setName(String name) { this.name = name;}    
}

私が間違っていることや、それをどのように解決できるかを教えてください。

前もって感謝します。

クハジェヤン

@JBNizetが指摘したように、BinderPlaceOrderに

public List<BinderOrderItemDetails> getBinderOrderItemDetails() {
    return binderOrderItemDetails;
}

これはリストなので、

th:field="*{binderOrderItemDetails.book}"

正しくないでしょう、

ただし、最初の要素を挿入するとします。

 th:field="${binderOrderItemDetails[0].book}"

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

org.springframework.beans.NotReadablePropertyException:-ドロップダウンフォーム

分類Dev

org.springframework.beans.NotReadablePropertyException:Beanクラスの無効なプロパティ

分類Dev

org.apache.jasper.JasperException:org.springframework.beans.NotReadablePropertyException:Beanクラスの無効なプロパティ「アドレス」

分類Dev

例外org.springframework.beans.factory.UnsatisfiedDependencyException

分類Dev

org.springframework.beans.factory.CannotLoadBeanClassException:

分類Dev

org.springframework.beans.factory.UnsatisfiedDependencyException 1

分類Dev

org.springframework.beans.factory.UnsatisfiedDependencyException org.springframework.beans.factory.NoUniqueBeanDefinitionException

分類Dev

org.springframework.beans.factory.BeanCreationException問題

分類Dev

NoSuchMethodError:org.springframework.beans.factory.config.ConfigurableListableBeanFactory

分類Dev

java.lang.NoClassDefFoundError:org / springframework / beans / factory / config / EmbeddedValueResolver

分類Dev

java.lang.NoClassDefFoundError:org / springframework / Beans / factory / Aware

分類Dev

ApplicationContext beanfactory org.springframework.beans.factory.NoSuchBeanDefinitionException:

分類Dev

org.springframework.beans.factory.CannotLoadBeanClassException:クラスが見つからない

分類Dev

org.springframework.beans.factory.annotation.AnnotatedBeanDefinition.setRole(I)V @EnableKafka

分類Dev

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer'

分類Dev

java.lang.NoSuchMethodError:org.springframework.beans.factory.annotation.AnnotatedBeanDefinition.setRole(I)V

分類Dev

スレッド「メイン」の例外org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException

分類Dev

スレッド「メイン」の例外org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException

分類Dev

スレッド「メイン」の例外org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException

分類Dev

スレッド「メイン」の例外org.springframework.beans.factory.NoSuchBeanDefinitionException

分類Dev

Spring 3 MVC + Hibernate3.5.x統合-org.springframework.beans.factory.BeanCreationException

分類Dev

Tomcatはorg.springframework.beans.factory.CannotLoadBeanClassExceptionを提供します:

分類Dev

<<Spring Boot 1.1.6>> Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException

分類Dev

org.springframework.beans.factory.BeanCreationException while trying to use the @Autowired annotation

分類Dev

Occured org.springframework.beans.factory.BeanCreationException for existed class in my Spring project

分類Dev

Error booting: org.springframework.beans.factory.BeanCreationException: Error creating bean with name

分類Dev

Error booting: org.springframework.beans.factory.BeanCreationException: Error creating bean with name

分類Dev

org.springframework.beans.factory.BeanCreationExceptionを修正する方法

分類Dev

アノテーション:{@ org.springframework.beans.factory.annotation.Autowired(required = true)}

Related 関連記事

  1. 1

    org.springframework.beans.NotReadablePropertyException:-ドロップダウンフォーム

  2. 2

    org.springframework.beans.NotReadablePropertyException:Beanクラスの無効なプロパティ

  3. 3

    org.apache.jasper.JasperException:org.springframework.beans.NotReadablePropertyException:Beanクラスの無効なプロパティ「アドレス」

  4. 4

    例外org.springframework.beans.factory.UnsatisfiedDependencyException

  5. 5

    org.springframework.beans.factory.CannotLoadBeanClassException:

  6. 6

    org.springframework.beans.factory.UnsatisfiedDependencyException 1

  7. 7

    org.springframework.beans.factory.UnsatisfiedDependencyException org.springframework.beans.factory.NoUniqueBeanDefinitionException

  8. 8

    org.springframework.beans.factory.BeanCreationException問題

  9. 9

    NoSuchMethodError:org.springframework.beans.factory.config.ConfigurableListableBeanFactory

  10. 10

    java.lang.NoClassDefFoundError:org / springframework / beans / factory / config / EmbeddedValueResolver

  11. 11

    java.lang.NoClassDefFoundError:org / springframework / Beans / factory / Aware

  12. 12

    ApplicationContext beanfactory org.springframework.beans.factory.NoSuchBeanDefinitionException:

  13. 13

    org.springframework.beans.factory.CannotLoadBeanClassException:クラスが見つからない

  14. 14

    org.springframework.beans.factory.annotation.AnnotatedBeanDefinition.setRole(I)V @EnableKafka

  15. 15

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer'

  16. 16

    java.lang.NoSuchMethodError:org.springframework.beans.factory.annotation.AnnotatedBeanDefinition.setRole(I)V

  17. 17

    スレッド「メイン」の例外org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException

  18. 18

    スレッド「メイン」の例外org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException

  19. 19

    スレッド「メイン」の例外org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException

  20. 20

    スレッド「メイン」の例外org.springframework.beans.factory.NoSuchBeanDefinitionException

  21. 21

    Spring 3 MVC + Hibernate3.5.x統合-org.springframework.beans.factory.BeanCreationException

  22. 22

    Tomcatはorg.springframework.beans.factory.CannotLoadBeanClassExceptionを提供します:

  23. 23

    <<Spring Boot 1.1.6>> Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException

  24. 24

    org.springframework.beans.factory.BeanCreationException while trying to use the @Autowired annotation

  25. 25

    Occured org.springframework.beans.factory.BeanCreationException for existed class in my Spring project

  26. 26

    Error booting: org.springframework.beans.factory.BeanCreationException: Error creating bean with name

  27. 27

    Error booting: org.springframework.beans.factory.BeanCreationException: Error creating bean with name

  28. 28

    org.springframework.beans.factory.BeanCreationExceptionを修正する方法

  29. 29

    アノテーション:{@ org.springframework.beans.factory.annotation.Autowired(required = true)}

ホットタグ

アーカイブ