Guest User

Untitled

a guest
Nov 18th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.91 KB | None | 0 0
  1. org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myUserRepository': Could not resolve matching constructor (hint: specify index/type/name arguments for simple parameters to avoid type ambiguities)
  2. at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:137) ~[spring-boot-1.5.8.RELEASE.jar:1.5.8.RELEASE]
  3.  
  4. public interface myUserRepository extends ElasticsearchRepository<MyUser, String> {
  5.  
  6. Optional<MyUser> findById(final String id);
  7.  
  8. MyUser findByUsername(String username);
  9. }
  10.  
  11. @Document(indexName = "store", type = "MyUser")
  12. public class MyUser {
  13. @Id
  14. private String id;
  15. private String username;
  16. private String password;
  17. @Field( type = FieldType.Nested)
  18. private Set<Role> roles;
  19. private String name;
  20.  
  21. public MyUser() {
  22. }
  23.  
  24. public MyUser(final String username, final String password, final Set<Role> roles, final String name) {
  25. this.username = username;
  26. this.password = password;
  27. this.roles = roles;
  28. this.name = name;
  29. }
  30.  
  31. public String getId() {
  32. return id;
  33. }
  34.  
  35. public void setId(final String id) {
  36. this.id = id;
  37. }
  38.  
  39. public String getUsername() {
  40. return username;
  41. }
  42.  
  43. public void setUsername(final String username) {
  44. this.username = username;
  45. }
  46.  
  47. public String getPassword() {
  48. return password;
  49. }
  50.  
  51. public void setPassword(final String password) {
  52. this.password = password;
  53. }
  54.  
  55. public Set<Role> getRoles() {
  56. return roles;
  57. }
  58.  
  59. public void setRoles(final Set<Role> roles) {
  60. this.roles = roles;
  61. }
  62.  
  63. public String getName() {
  64. return name;
  65. }
  66.  
  67. public void setName(final String name) {
  68. this.name = name;
  69. }
  70. }
Add Comment
Please, Sign In to add comment