我的安全配置类是
private static final String[] PUBLIC_MATCHERS = {
"/css/**",
"/js/**",
"/images/**",
"/",
"**/",
"/newUser",
"/forgetPassword",
"/login",
"**/uploads/**",
"/assets/**",
"/api/updateCardStatus",
"/users",
"/fonts/**"
};
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
/* antMatchers("/**").*/
.antMatchers(PUBLIC_MATCHERS).
permitAll().anyRequest().authenticated();
http
.authorizeRequests()
.antMatchers("/admin").hasAnyRole("ROLE_ADMIN").and()
.formLogin().loginPage("/login").permitAll().failureUrl("/login?error")
.successHandler(securityHandler)
.and()
.logout().logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
.logoutSuccessUrl("/?logout").deleteCookies("remember-me").permitAll()
.and()
.rememberMe();
}
我的html文件包含一些模板
admin.html
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head th:replace="common/header :: common-header"/>
<body class="">
<div class="wrapper">
<div th:replace="common/header :: common-sidebar"/>
<div class="main-panel">
<!-- Navbar -->
<div th:replace="common/header :: common-navbar"/>
<!-- End Navbar -->
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col-lg-3 col-md-6 col-sm-6">
<div class="card card-stats">
<div class="card-header card-header-warning card-header-icon">
<div class="card-icon">
<i class="material-icons">weekend</i>
</div>
<p class="card-category">Bookings</p>
<h3 class="card-title">184</h3>
</div>
<div class="card-footer">
<div class="stats">
<i class="material-icons text-danger">warning</i>
<a href="#pablo">Get More Space...</a>
</div>
</div>
</div>
</div>
<div class="col-lg-3 col-md-6 col-sm-6">
<div class="card card-stats">
<div class="card-header card-header-rose card-header-icon">
<div class="card-icon">
<i class="material-icons">equalizer</i>
</div>
<p class="card-category">Website Visits</p>
<h3 class="card-title">75.521</h3>
</div>
<div class="card-footer">
<div class="stats">
<i class="material-icons">local_offer</i> Tracked from Google Analytics
</div>
</div>
</div>
</div>
<div class="col-lg-3 col-md-6 col-sm-6">
<div class="card card-stats">
<div class="card-header card-header-success card-header-icon">
<div class="card-icon">
<i class="material-icons">store</i>
</div>
<p class="card-category">Revenue</p>
<h3 class="card-title">$34,245</h3>
</div>
<div class="card-footer">
<div class="stats">
<i class="material-icons">date_range</i> Last 24 Hours
</div>
</div>
</div>
</div>
<div class="col-lg-3 col-md-6 col-sm-6">
<div class="card card-stats">
<div class="card-header card-header-info card-header-icon">
<div class="card-icon">
<i class="fa fa-twitter"></i>
</div>
<p class="card-category">Followers</p>
<h3 class="card-title">+245</h3>
</div>
<div class="card-footer">
<div class="stats">
<i class="material-icons">update</i> Just Updated
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div th:replace="common/footer :: footer"></div>
</div>
</div>
<div th:replace="common/footer :: scriptone"></div>
</body>
</html>
所以现在登录时,我成功进入admin.html页面。但只加载了我的资产文件夹中的一些文件夹。
例如,我通过scriptone片段定义了这样的内容:-
<div th:fragment="scriptone">
<script th:src="@{/assets/js/core/jquery.min.js}"></script>
<script th:src="@{/assets/js/core/popper.min.js}"></script>
<script th:src="@{/assets/js/bootstrap-material-design.min.js}"></script>
<script th:src="@{/assets/js/plugins/perfect-scrollbar.jquery.min.js}"></script>
<!-- Google Maps Plugin -->
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyB2Yno10-YTnLjjn_Vtk0V8cdcY5lC4plU"></script>
<!-- Plugin for Date Time Picker and Full Calendar Plugin -->
<script th:src="@{/assets/js/plugins/moment.min.js}"></script>
<!-- Plugin for the Datepicker, full documentation here: https://github.com/Eonasdan/bootstrap-datetimepicker -->
<script th:src="@{/assets/js/plugins/bootstrap-datetimepicker.min.js}"></script>
<!-- Plugin for the Sliders, full documentation here: http://refreshless.com/nouislider/ -->
<script th:src="@{/assets/js/plugins/nouislider.min.js}"></script>
<!-- Plugin for Select, full documentation here: http://silviomoreto.github.io/bootstrap-select -->
<script th:src="@{/assets/js/plugins/bootstrap-selectpicker.js}"></script>
<!-- Plugin for Tags, full documentation here: http://xoxco.com/projects/code/tagsinput/ -->
<script th:src="@{/assets/js/plugins/bootstrap-tagsinput.js}"></script>
<!-- Plugin for Fileupload, full documentation here: http://www.jasny.net/bootstrap/javascript/#fileinput -->
<script th:src="@{/assets/js/plugins/jasny-bootstrap.min.js}"></script>
<!-- Plugins for presentation and navigation -->
<script th:src="@{/assets/assets-for-demo/js/modernizr.js}"></script>
<!-- Material Kit Core initialisations of plugins and Bootstrap Material Design Library -->
<script th:src="@{/assets/js/material-dashboard790f.js?v=2.0.1}"></script>
<!-- Include a polyfill for ES6 Promises (optional) for IE11, UC Browser and Android browser support SweetAlert -->
<script src="../../../cdnjs.cloudflare.com/ajax/libs/core-js/2.4.1/core.js"></script>
<!-- Library for adding dinamically elements -->
<script th:src="@{/assets/js/plugins/arrive.min.js}" type="text/javascript"></script>
<!-- Forms Validations Plugin -->
<script th:src="@{/assets/js/plugins/jquery.validate.min.js}"></script>
<!-- Charts Plugin, full documentation here: https://gionkunz.github.io/chartist-js/ -->
<script th:src="@{/assets/js/plugins/chartist.min.js}"></script>
<!-- Plugin for the Wizard, full documentation here: https://github.com/VinceG/twitter-bootstrap-wizard -->
<script th:src="@{/assets/js/plugins/jquery.bootstrap-wizard.js}"></script>
<!-- Notifications Plugin, full documentation here: http://bootstrap-notify.remabledesigns.com/ -->
<script th:src="@{/assets/js/plugins/bootstrap-notify.js}"></script>
<!-- Vector Map plugin, full documentation here: http://jvectormap.com/documentation/ -->
<script th:src="@{/assets/js/plugins/jquery-jvectormap.js}"></script>
<!-- Sliders Plugin, full documentation here: https://refreshless.com/nouislider/ -->
<script th:src="@{/assets/js/plugins/nouislider.min.js}"></script>
<!-- Plugin for Select, full documentation here: http://silviomoreto.github.io/bootstrap-select -->
<script th:src="@{/assets/js/plugins/jquery.select-bootstrap.js}"></script>
<!-- DataTables.net Plugin, full documentation here: https://datatables.net/ -->
<script th:src="@{/assets/js/plugins/jquery.datatables.js}"></script>
<!-- Sweet Alert 2 plugin, full documentation here: https://limonte.github.io/sweetalert2/ -->
<script th:src="@{/assets/js/plugins/sweetalert2.js}"></script>
<!-- Plugin for Fileupload, full documentation here: http://www.jasny.net/bootstrap/javascript/#fileinput -->
<script th:src="@{/assets/js/plugins/jasny-bootstrap.min.js}"></script>
<!-- Full Calendar Plugin, full documentation here: https://github.com/fullcalendar/fullcalendar -->
<script th:src="@{/assets/js/plugins/fullcalendar.min.js}"></script>
<!-- demo init -->
<script th:src="@{/assets/js/plugins/demo.js}"></script>
</div>
现在我希望它可以正常工作,但不幸的是它没有工作。我查看了浏览器的源,发现只有资产中的某些文件夹正在加载。
即使我还有其他文件夹
所以现在当我加载admin.html页面时,仅出现侧栏。其他内容不显示。我想知道为什么?