안녕하세요, 저는 Vaadin에 초보자입니다. 양식을 만들고 POJO 개체에 바인딩하려고합니다.Vaadin with SpringBoot
java.lang.IllegalStateException: Property type 'java.util.Collection' doesn't match the field type 'java.util.Set< dev.gva.model.Authority >'. Binding should be configured manually using converter.
기관 :
public class Authority{
private Long id;
private String authority;
getter/setters..
}
사용자 :
시도가 FormUser이 오류가 포함되어보기에 액세스 할 수...Some declaration
Binder<User> binder = new Binder<>(User.class);
@Autowired
public FormUser(UserRepository userRepository, AuthorityRepository authorityRepository){
this.userRepository = userRepository;
this.authorityRepository = authorityRepository;
authorities = new ListSelect<>("Authorities", authorityRepository.findAll());
authorities.setItemCaptionGenerator(Authority::getAuthority);
//Set items
username.setIcon(FontAwesome.USER);
password.setIcon(FontAwesome.USER_SECRET);
saveButton.addClickListener(e -> {
userRepository.save(user);
});
setSpacing(true);
addComponents(username, password, authorities, saveButton);
binder.bindInstanceFields(this);
}
0
public class User{
private Long id;
private Collection<Authority> authorities;
other fields, getters/setters...
}
이 변환기를 작성하는 방법은 무엇입니까? 감사합니다
'authorities.setConverter (새 변환기 <, 모음 () {/*...*/})'을 (를) 설정 했습니까? –
@ A.Meier 조만간 조언 드리겠습니다. – GVArt