我在这里完成了所有问题,所有文档都根据num11 num21
10 10
20 30
而无法找到使我的案例有效的解决方案。
我希望通过Spring
保护我的申请(Spring Boot with Angular 4
)。所以我做的第一件事就是添加两个Spring Security
类,例如:
Configuration
正如您在@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable().authorizeRequests()
.anyRequest().permitAll().and().httpBasic();
}
@Configuration
@EnableWebMvc
@ComponentScan("com.inventory")
public class WebConfig extends WebMvcConfigurerAdapter {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/", "/#/", "/resources/static/**")
.addResourceLocations("/resources/static/index.html", "/resources/static/index.html", "/resources/static/index.html");
}
}
@Controller
public class ViewController {
@RequestMapping(value = "/#/")
public String index() {
return "forward:/resources/static/index.html";
}
@RequestMapping(value = "/")
public String home() {
return "index.html";
}
}
中看到的那样,我尝试使用不同的尝试来提供静态内容。不幸的是,这一切都回归了:
Controller
我做错了什么?为什么我不能得到这个静态内容?当然,我的静态内容位于There was an unexpected error (type=Internal Server Error, status=500).
Could not resolve view with name 'index.html' in servlet with name 'dispatcherServlet'
下,并且有resources/static
个文件和ex。 .js
。