Answer the question
In order to leave comments, you need to log in
What should be done to make Spring boot display dynamically loaded images?
Hello everybody.
There is an application on Spring Boot, MVC with a hello world level web interface. When launched, it normally displays those images that were in the war file and refuses to display those that are loaded dynamically through the browser. HTTP status 404 for browser downloads. I tried to write a separate controller for pictures. Didn't help (perhaps spelled wrong). The method annotated with @PostConstruct works. The method that should handle GET requests is none. HTTP status 500 in general for all pictures.
Code: https://github.com/multiscripter/job4j/tree/master... Build
from point: /junior/pack3_pre/p2_spring/ch5_boot/
Thanks in advance.
Answer the question
In order to leave comments, you need to log in
You need to specify the path for these files in application.properties:
spring.resources.static-locations=classpath:/files/,classpath:/static-files
You can read more here: https://www.baeldung.com/spring-mvc -static-resources
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question