If you wanted to add bootstrap UI CSS and JS files in thymeleaf then you can use following code:
<link th:href="@{/webjars/bootstrap/5.0.0/css/bootstrap.min.css}"
rel="stylesheet" media="screen" />
<script th:src="@{/webjars/bootstrap/5.0.0/js/bootstrap.min.js}"></script>
If those styles are still not loading then refresh project and if you are using spring security then you need to add following code in your extended class of
WebSecurityConfigurerAdapter
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/", "/home","/webjars/**", "/resources/**").permitAll()
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.permitAll()
.and()
.logout()
.permitAll();
}
It will solve your issue