Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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)
- at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:137) ~[spring-boot-1.5.8.RELEASE.jar:1.5.8.RELEASE]
- public interface myUserRepository extends ElasticsearchRepository<MyUser, String> {
- Optional<MyUser> findById(final String id);
- MyUser findByUsername(String username);
- }
- @Document(indexName = "store", type = "MyUser")
- public class MyUser {
- @Id
- private String id;
- private String username;
- private String password;
- @Field( type = FieldType.Nested)
- private Set<Role> roles;
- private String name;
- public MyUser() {
- }
- public MyUser(final String username, final String password, final Set<Role> roles, final String name) {
- this.username = username;
- this.password = password;
- this.roles = roles;
- this.name = name;
- }
- public String getId() {
- return id;
- }
- public void setId(final String id) {
- this.id = id;
- }
- public String getUsername() {
- return username;
- }
- public void setUsername(final String username) {
- this.username = username;
- }
- public String getPassword() {
- return password;
- }
- public void setPassword(final String password) {
- this.password = password;
- }
- public Set<Role> getRoles() {
- return roles;
- }
- public void setRoles(final Set<Role> roles) {
- this.roles = roles;
- }
- public String getName() {
- return name;
- }
- public void setName(final String name) {
- this.name = name;
- }
- }
Add Comment
Please, Sign In to add comment