0

Using the following @NodeEntity

@NodeEntity
public class Person extends BasePersistenceObject {

    @GraphId
    Long id;

    String fullName;

    @Indexed(unique=true)
    String email;

    String passwordHash = null;

    @JsonIgnore
    public String getPasswordHash() {
        return passwordHash;
    }

    ...
}

I'm still seeing the passwordHash in the JSON Response from the following controller method:

@RequestMapping(value = "/login", method=RequestMethod.POST)
public @ResponseBody Person login(@RequestBody Map<String, String> credentials, HttpServletRequest request) throws AuthorizationException {

    String email = credentials.get("email");
    String password = credentials.get("password");
    String ipAddress = request.getRemoteAddr();

    return authService.authenticate(email, password, ipAddress);

}
sparkyspider
  • 13,195
  • 10
  • 89
  • 133

1 Answers1

0

Spring Data Neo4J has nothing to do with JSON serialization, that's the responsibility of Spring MVC and Jackson or Gson, depending on what you use. So make sure, that Jackson is used for JSON serialization, otherwise the annotation wouldn't work.

dunni
  • 43,386
  • 10
  • 104
  • 99
  • I was under the impression that Spring Boot uses Jackson by default to do the marshalling. How do I check? – sparkyspider May 13 '15 at 13:47
  • By default it uses Jackson, that's correct. But it also supports Gson, so if Gson is on your classpath, it might use that. Check your dependency tree (`mvn dependency:tree`), if there is a Gson dependency somewhere. If you have spring-boot-starter-actuator on the classpath (and if it's a Spring boot application), you can also check the REST endpoints /autoconfig or /beans, if any Gson or Jackson bean is defined. – dunni May 13 '15 at 13:50