Oi pessoal,
O spring carrega o programa normalmente e as tabelas do H2 são criadas e preenchidas corretamente, porém quando eu tento consumir a api com GET ocorre o estouro de pilha.
Apliquei o @JsonIgnore em TODOS os mapeamentos jpa pois estava achando que se tratava de referência cíclica mas o resultado no postman foi o mesmo abaixo:
"timestamp": "2020-05-07T22:47:35.243+0000",
"status": 500,
"error": "Internal Server Error",
"message": "No message available",
"trace": "java.lang.StackOverflowError\r\n\tat org.hibernate.loader.plan.build.internal.returns.AbstractExpandingFetchSource.getFetches(AbstractExpandingFetchSource.java:75)\r\n\tat org.hibernate.loader.plan.build.internal.returns.AbstractCompositeEntityIdentifierDescription.hasFetches(AbstractCompositeEntityIdentifierDescription.java:40)\r\n\tat org.hibernate.loader.plan.exec.process.internal.AbstractRowReader.resolveEntityKey(AbstractRowReader.java:146)\r\n\tat org.hibernate.loader.plan.exec.process.internal.AbstractRowReader.resolveEntityKey(AbstractRowReader.java:147)\r\n\tat",
"erro repete várias vezes",
“org.hibernate.loader.plan.exec.process.internal.AbstractRowReader.resolveEntityKey(AbstractRowReader.java:161)\r\n”,
“path”: “/passageiros/1”,
Console do spring após a requisição:
“at org.hibernate.loader.plan.exec.process.internal.AbstractRowReader.resolveEntityKey(AbstractRowReader.java:161) ~[hibernate-core-5.4.12.Final.jar:5.4.12.Final]
at org.hibernate.loader.plan.exec.process.internal.AbstractRowReader.resolveEntityKey(AbstractRowReader.java:147) ~[hibernate-core-5.4.12.Final.jar:5.4.12.Final]
at org.hibernate.loader.plan.exec.process.internal.AbstractRowReader.resolveEntityKey(AbstractRowReader.java:161) ~[hibernate-core-5.4.12.Final.jar:5.4.12.Final]
at org.hibernate.loader.plan.exec.process.internal.AbstractRowReader.resolveEntityKey(AbstractRowReader.java:147) ~[hibernate-core-5.4.12.Final.jar:5.4.12.Final]”
CONTINUA REPETINDO…
"at org.hibernate.loader.plan.exec.process.internal.AbstractRowReader.resolveEntityKey(AbstractRowReader.java:147) ~[hibernate-core-5.4.12.Final.jar:5.4.12.Final]
at org.hibernate.loader.plan.exec.process.internal.AbstractRowReader.resolveEntityKey(AbstractRowReader.java:161) ~[hibernate-core-5.4.12.Final.jar:5.4.12.Final]
at org.hibernate.loader.plan.exec.process.internal.AbstractRowReader.resolveEntityKey(AbstractRowReader.java:147) ~[hibernate-core-5.4.12.Final.jar:5.4.12.Final]
2020-05-07 20:39:17.298 DEBUG 32132 — [nio-8081-exec-1] o.s.web.servlet.DispatcherServlet : “ERROR” dispatch for GET “/error”, parameters={}
2020-05-07 20:39:17.305 DEBUG 32132 — [nio-8081-exec-1] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController#error(HttpServletRequest)
2020-05-07 20:39:17.443 DEBUG 32132 — [nio-8081-exec-1] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Using ‘application/json’, given [/] and supported [application/json, application/+json, application/json, application/+json]
2020-05-07 20:39:17.445 DEBUG 32132 — [nio-8081-exec-1] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Writing [{timestamp=Thu May 07 20:39:17 BRT 2020, status=500, error=Internal Server Error, message=No message (truncated)…]
2020-05-07 20:39:17.648 DEBUG 32132 — [nio-8081-exec-1] o.s.web.servlet.DispatcherServlet : Exiting from “ERROR” dispatch, status 500"