I would like to server static content from my Helidon MP server. But I only get No handler found for path: /static/index.html
.
I have configured the static resources in src/main/resources/META-INF/microprofile-config.properties
:
server.static.classpath.location=/static
And I start my server with:
Server.builder().config(Config.create()).build().start();
I guess I have to add an JaxRsApplication? But how do I do that?
I figured out it does work when I use the io.helidon.microprofile.cdi.Main
but I want to manually create the server.
This is a config issue, you are using io.helidon.Config.create()
which doesn't support microprofile-config.properties
.
If you use Server.create().start()
, microprofile-config.properties
will work out-of-the-box.
If you want to pass your own instance of config, you can do it like this:
Server.builder().config(ConfigProvider.getConfig()).build().start();
This has the same effect as Server.create()
.
If you want to use the Helidon config API, you can convert an instance of org.eclipse.microprofile.config.Config
to io.helidon.config.Config
like this:
io.helidon.config.mp.MpConfig.toHelidonConfig(ConfigProvider.getConfig())