In my springboot project I have a module named
model
Here I have a class RealmRole:
public class RealmRole {
private String id;
private String name;
public RealmRole() {
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
return "RealmRole{" +
"id='" + id + '\'' +
", name='" + name + '\'' +
'}';
}
}
From a request I get a
List<RealmRole>
Now I want to filter a RealmRole by name:
realmRoleList.stream().filter(realmRole.getName().equals("user")).forEach(sout)
This causes the error:
Message: class java.util.LinkedHashMap cannot be cast to class de.test.userregistration.model.RealmRole (java.util.LinkedHashMap is in module java.base of loader 'bootstrap'; de.test.userregistration.model.RealmRole is in unnamed module of loader 'app')
Even if I just try:
realmRoleList.stream().forEach(sout)
I get the same error.
I've alread read some questions but I could not find an answer for this issue. I already removed devtools from pom.xml because I've read that this could lead to classloader problems.