Работаю над веб приложением с использованием Spring MVC и после подключения Spring sequrity перестали работать подключенные css стили. Перепробовал разные варианты исключений, но по прежнему результата нет. Все стили находятся по пути: resources/public/css/styles.css
web страница собрана подобным образом:
<!DOCTYPE html>
<html lang="rus" xmlns:th="http://www.thymeleaf.org">
<head th:fragment="site-head">
<meta charset="UTF-8" />
<link rel="stylesheet" href=../public/css/styles.css th:href="@{/resources/public/css/styles.css}" />
<link rel="icon" href="../public/img/favicon.ico" th:href="@{/img/favicon.ico}" />
<script src="../public/js/jquery-3.1.0.min.js" th:src="@{/js/jquery-3.1.0.min.js}"></script>
<script src="../public/js/blog-scripts.js" th:src="@{/js/blog-scripts.js}"></script>
<!--<meta th:include="this :: head" th:remove="tag"/>-->
<title>Добро пожаловать!</title>
</head>
<body>
<!--<!–Общий шаблон шапки для сайта–>-->
<header th:fragment="site-header" th:remove="tag">
<header>
<a href="index.html" th:href="@{/}"><img src="../public/img/site-logo.png" th:src="@{/img/site-logo.png}" /></a>
<a href="index.html" th:href="@{/}">Домой</a>
<a href="users/login.html" th:href="@{/users/login}">Логин</a>
<a href="users/registration.html.html" th:href="@{/users/registration}">Регистрация пользователя</a>
<a href="posts/index.html" th:href="@{/posts}">Посты</a>
<a href="posts/create.html" th:href="@{/posts/create}">Создать пост</a>
<a href="users/index.html" th:href="@{/users}">Пользователи</a>
<div id="logged-in-info">
<span>Hello, <b>(user)</b></span>
<form method="post" th:action="@{/logout}">
<input type="submit" value="Logout" />
</form>
<p> <a href="/logout">Выход из приложения</a></p>
</div>
</header>
</header>
<footer th:fragment="site-footer">
© Spring MVC Blog System, 2016
</footer>
</body>
</html>
Изображение в теле страницы - отображается, а в шапке head th:href="@{/img/favicon.ico}" - также недоступно. пробовал изменить WebSequrityConfig самыми разными способами, но результата не добился:
@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private UserService userService;
@Override
protected void configure(HttpSecurity http) throws Exception{
http
.csrf().disable()
.authorizeRequests()
.antMatchers("/"
,"/users/registration"
,"/public/css/**"
,"../public/css/**"
,"resources/public/css/**"
,"/resources/public/css/**"
).permitAll()
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.permitAll()
.defaultSuccessUrl("/",true)
.and()
.logout()
.permitAll()
.and()
.authorizeRequests()
.antMatchers("/resources/**")
.permitAll()
.anyRequest()
.permitAll();
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.userDetailsService(userService)
.passwordEncoder(NoOpPasswordEncoder.getInstance());
}
@Override
public void configure(WebSecurity web) throws Exception {
web.ignoring().antMatchers("/resources/**").anyRequest();
}
}
В некоторых местах код дублирован несколько раз, потому и хаос Также по некоторым советам доработал файл WebMvcConfig
@Configuration
@EnableWebMvc
public class WebMvcConfig implements WebMvcConfigurer {
@Override
public void addViewControllers(ViewControllerRegistry registry){
registry.addViewController("/layout").setViewName("layout");
registry.addViewController("/login").setViewName("login");
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry
.addResourceHandler("/js/**")
.addResourceLocations("/resources/public/js/");
registry
.addResourceHandler("/resources/css/**")
.addResourceLocations("/resources/public/css/");
}
}
но результата никакого, возможно где-то попросту ошибка, либо я в целом неверно все это добро пытаюсь настроить, подскажите в чем может быть беда.
Возникла какая-то странная проблемаВерстаю страничку в редакторе и проверяю его на соответствие с макетом в FireFox
Как объяснить то, что массив arr1 так странно реагирует на замену элемента?