how add css and js to spring boot application?

Viewed 16798

I try to add CSS to my HTML page in Spring Boot using Thymeleaf, added the CSS file in static folder and linked it that way:

<link rel="stylesheet" th:href="@{/css/home.css}" href="../../css/home.css" />

but it doesn't work.


I wanted to stop accessing CSS and js in the URL so I added this method to my security configuration:

@Override
public void configure(WebSecurity web) throws Exception {
   web
      .ignoring()
      .antMatchers("/resources/static/**"); // #3
}

Can anyone tell me what's my error or if any configuration needed?

1 Answers
Related