Understanding REST configuration files that change

If the application server is operating in development mode, the REST API framework monitors the file system for changes to configuration files. The REST framework checks every API request to determine if the request requires a reload of the REST servlet configuration. If the framework detects a configuration change, the framework reloads all of the following items:
  • Swagger schemas
  • JSON schemas
  • Integration mappings
  • GraphQL filters
  • File published-apis.yaml

The framework also reloads these configuration files after any refresh of the Gosu type system, which a hot swap of Gosu classes generally triggers. By combining dynamic reload of schema files with using the DCEVM to hot swap classes, it is possible to do much of your API development without having to restart the application server. As the REST framework instantiates the API handler classes on every API request as well, the only states that persist across API requests are the static variables that you define in the handler classes.

Notes

  1. The file system watcher looks only for changes to files in directories that are present at server start up. The watcher does not watch for changes to files in directories added to the file system after the server starts.
  2. The file system watcher groups together the file changes that it finds once every five seconds. Thus, it is possible for the watcher to not be aware of a recent change to a configuration file. If you change a schema file and the next API request does not seem to reflect the change, retry the request in a few seconds.