spring-projects / spring-security-samples

1.46k stars 711 forks source link

Fix jackson issue on HelloSecurityExplicitITests #223

Closed canattofilipe closed 8 months ago

canattofilipe commented 8 months ago

This PR solves the following error when executing the test example.HelloSecurityExplicitITests.login :

org.springframework.web.client.UnknownContentTypeException: Could not extract response: no suitable HttpMessageConverter found for response type [class example.CustomUser] and content type [application/json]

    at org.springframework.web.client.HttpMessageConverterExtractor.extractData(HttpMessageConverterExtractor.java:124)
    at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:892)
    at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:790)
    at org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:404)
    at org.springframework.boot.test.web.client.TestRestTemplate.getForObject(TestRestTemplate.java:199)
    at example.HelloSecurityExplicitITests.login(HelloSecurityExplicitITests.java:41)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
marcusdacoregio commented 8 months ago

Hi, @canattofilipe. Thanks for the PR.

Can you please squash your commits and make sure to run ./gradlew format to align the code changes with the codestyle?

canattofilipe commented 8 months ago

Hi, @marcusdacoregio , smt got wrong during the squash, just opened another one -> https://github.com/spring-projects/spring-security-samples/pull/232