To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.
Are you using spring-boot? If I understood correctly you are setting up an endpoint and then calling it in directly in the frontend. I wouldn't do that as it seems you could be, in a way, renouncing on the framework capabilities and exposing the application to a security risk. You should be able to properly bind the java side to a custom frontend component. Could you please tell me which is the use case ?