Ich benutze die UI-Router-Bibliothek mit Spring Boot und Spring Security. Wenn ich versuche, auf eine Route zuzugreifen, die ich definiert habe, passiert nichts, ich bekomme nicht einmal einen Fehler in der Konsole.AngularJs UI-Router funktioniert nicht im Spring Boot
Hier ist meine app.js
Dateivar app = angular.module("app", ['ui.router']);
app.config(function($stateProvider, $urlRouterProvider) {
//
// For any unmatched url, redirect to /state1
$urlRouterProvider.otherwise("/");
//
// Now set up the states
$stateProvider
.state('default', {
url: "/",
templateUrl: "partials/firstpage.html"
})
.state('register', {
url: "/register",
templateUrl: "partials/register.html"
})
.state('login', {
url: "/login",
templateUrl: "partials/login.html"
})
});
Die Datei index.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<script src="assets/js/jquery-2.1.4.js"></script>
<script src="assets/bootstrap/js/bootstrap.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular.min.js"> </script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.3.1/angular-ui-router.js"> </script>
<script src="app.js"> </script>
<script src="controllers/navbar.controller.js"> </script>
</head>
<body>
<div ui-view> </div>
</body>
Die WebSecurityConfiguration Klasse:
protected void configure(HttpSecurity httpSecurity) throws Exception {
httpSecurity
.csrf()
.disable()
.exceptionHandling()
.authenticationEntryPoint(authenticationEntryPoint)
.and()
.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and()
.authorizeRequests()
.antMatchers(
HttpMethod.GET,
"/",
"/*.html",
"/favicon.ico",
"/**/*.html",
"/**/*.css",
"/**/*.js",
"/**/**/*.css",
"/**/**/*.js",
"/**/**/*.html",
"/**/**/**/*.css",
"/**/**/**/*.js",
"/**/**/**/*.html",
"/**/**/**/**/*.css",
"/**/**/**/**/*.js"
).permitAll()
.antMatchers("/auth/**", "/").permitAll()
.anyRequest().authenticated();
// Custom JWT based authentication
httpSecurity
.addFilterBefore(authenticationTokenFilterBean(), UsernamePasswordAuthenticationFilter.class);
}
Und hier ist meine Struktur Projekt: project structure
Gibt es irgendetwas, das ich hinzufügen sollte meine Code zum Konfigurieren der Ui-Router-Bibliothek für Spring-Boot?
– Thailand