2

Is anybody here who know how to create a mapping file from static directory to respond for certain url in Spring Boot?

For example, I have file in directory /resource in Spring Boot structure

resources/static/html/index.html

and I want it to respond to url

/index

No catalogue path, no .html postfix

luboskrnac
  • 23,973
  • 10
  • 81
  • 92
Piotr Żak
  • 2,083
  • 6
  • 29
  • 42

3 Answers3

1

File index.html is served as default HTML file from certain directory. So if you want to serve it from http://domain:port/index URL, you should place it into resources/static/index/index.html.

luboskrnac
  • 23,973
  • 10
  • 81
  • 92
0

As I research more, url mapping is possible only if You use template engine like Thymeleaf and then application will became context aware.

Piotr Żak
  • 2,083
  • 6
  • 29
  • 42
-1

Use Thymeleaf and then add your .html files to resources/templates/ and they will be discovered automatically.

svg
  • 79
  • 1
  • 1
  • 6