MarcGiffing / wicket-spring-boot

Spring Boot starter for Apache Wicket
151 stars 61 forks source link

No static content resource handling with spring boot works by default #174

Closed geramaya closed 3 years ago

geramaya commented 3 years ago

Hey all,

I use wicket-spring-boot with the normal spring boot setup. I can't provide static content with the optional static content feature from spring boot (https://www.baeldung.com/spring-mvc-static-resources). I used the basic project https://spring.io/guides/gs/serving-web-content/ and created at src/main/resources > static as a new folder with a simple index.html (helllo world) inside.

I had seen this on the browser with http://localhost:[port]/index.html > works!

If I combine a simple spring-boot project with wicket-spring-boot, so I can't see my index.html as static resource. I got a WhiteLabelError (/error page). If I make a mistake or not, so I would ask for a simple project as proove of concept for this issue.

For further question don't hestiate to contact me. Thx in advance Daniel

Wicket: 8.x spring-boot: 2.1.7 OpenJdk 11+

martin-g commented 3 years ago

Please create a small demo application and share it!

MarcGiffing commented 3 years ago

What is the HTTP Status code on the Whitelabel Error Page? 404? Maybe you have Spring security enabled and you got 403? I've already tried it with the provied demo application and it worked without any further configuration.

geramaya commented 3 years ago

hey all, I create a wicket-spring-boot from the scratch. My spring-boot and wicket-spring-boot app works with static content. I detected a misconfigured issue with my application.yml. I have to check this out. As workaround I use java configuration like this:

@EnableWebMvc @Configuration public class FooConfiguration implements WebMvcConfigurer { @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/content/**").addResourceLocations("classpath:/static/"); } }

Thx for help!

So I think, you can close the issue :)

test project:

https://github.com/geramaya/wicket-spring-boot-simple

open browser with http://localhost:9090/home http://localhost:9090/static.html