Skip to content

Commit

Permalink
migration guide - static configuration methods removed (javalin#254)
Browse files Browse the repository at this point in the history
  • Loading branch information
RaniAgus authored Jan 4, 2024
1 parent 838094e commit 12ceba7
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions pages/docs/migration-guide-5-6.md
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,34 @@ ctx.async({ config ->
{% endcapture %}
{% include macros/docsSnippet.html java=java kotlin=kotlin %}

## Static configuration methods have been removed
In Javalin 5, there were some classes which had their own static methods for configuration:

{% capture java %}
JavalinRenderer.register(myFileRenderer);
JavalinValidation.register(Custom.class, Custom::parse);
{% endcapture %}
{% capture kotlin %}
JavalinRenderer.register(myFileRenderer)
JavalinValidation.register(Custom.class, Custom::parse)
{% endcapture %}
{% include macros/docsSnippet.html java=java kotlin=kotlin %}

We've moved all these to the config for Javalin 6:
{% capture java %}
var app = Javalin.create(config -> {
config.fileRenderer(myFileRenderer);
config.validation.register(Custom.class, Custom::parse);
});
{% endcapture %}
{% capture kotlin %}
val app = Javalin.create { config ->
config.fileRenderer(myFileRenderer)
config.validation.register(Custom.class, Custom::parse)
}
{% endcapture %}
{% include macros/docsSnippet.html java=java kotlin=kotlin %}

## Changes to private config
In Javalin 5, you could access Javalin's private config through `app.cfg`,
this has been change to `app.unsafeConfig()` in Javalin 6, in order to make it clear that it's not
Expand Down

0 comments on commit 12ceba7

Please sign in to comment.