Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
geramaya opened this issue Jan 13, 2021 · 3 comments
Closed

Comments

@geramaya
Copy link

geramaya commented Jan 13, 2021

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
Copy link
Contributor

Please create a small demo application and share it!

@MarcGiffing
Copy link
Owner

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
Copy link
Author

geramaya commented Jan 13, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants