1chz / realworld-java21-springboot3

RealWorld backend API built using Java 21 and Spring Boot 3
https://www.realworld.how
MIT License
100 stars 42 forks source link

./gradlew bootRun does not work. Build failure #4

Closed bondar-artem closed 9 months ago

bondar-artem commented 9 months ago

Hi

I was trying to follow the readme, but unfortunately, I cannot run the app.

Executing the ./gradlew bootRun results in the error:

Execution failed for task ':bootRun'.
> Failed to calculate the value of task ':bootRun' property 'mainClass'.
> Main class name has not been configured and it could not be resolved from classpath

System: MaOS Sonoma 14.2 Java 21

image

1chz commented 9 months ago

Hello. It seems I missed updating the documentation while transitioning the project to a modular monolithic structure.

Please try entering ./gradlew :modular-application:bootRun

bondar-artem commented 9 months ago

Thank you! @shirohoo :) Could you help me with one more question, please? I am trying to run this backend with a fronted for the app, but having an integration issue when running both on the localhost. This is a frontend: https://github.com/gothinkster/angular-realworld-example-app Currently, it's configured to run against deployed API which is https://api.realworld.io/api

When I change the API URL in the application to http://localhost:8080/api, it does not work. The browser console shows a 200 status code, but no response body is returned to the application. I suspect it's related to CORS, but can't figure out how to fix this.

Could you provide a suggestion, please?

1chz commented 9 months ago

There was indeed a CORS problem. I changed the code and pushed a commit to the repository to resolve the issue. https://github.com/shirohoo/realworld-java21-springboot3/commit/e775e5505e2b46bcc38d4b9e92d019a3cfc08785

Thank you so much for your input.

One thing I am concerned about is that since this project focuses only on writing good server code, I did not expect to attach the client app directly to this project.

In particular, the server's exception handling specifications do not follow RealWorld's specifications, and I arbitrarily wrote them according to the https://datatracker.ietf.org/doc/html/rfc7807 protocol, so the client app probably does not work as expected for exception situations.