I'm writing a REST API in spring boot that generates a class, controller and repository at runtime. I'm using dev tools to recompile the class once the code is generated.
I have included the dev tools dependencies in my pom.xml and everything works fine on my local machine. However, once I have deployed to an Ubuntu server and I create a new class at runtime it generates an error when I try to hit the endpoint.
{
"timestamp": "2020-04-05T03:26:53.733+0000",
"status": 404,
"error": "Not Found",
"message": "No message available",
"path": "/api/reg"
}
When I shutdown the Tomcat server and re-run the application the previously generated class and its controller become available and am able to hit the endpoint.
So my question is; how can I make spring boot to re-compile and scan all the generated components once class is generated at runtime without having to shutdown the server?