Spring boot 出现意外错误(类型=未找到,状态=404)。没有可用的消息

Spring boot 出现意外错误(类型=未找到,状态=404)。没有可用的消息,spring-boot,Spring Boot,我得到以下错误: 出现意外错误(类型=未找到,状态=404)。没有可用的消息 使用Spring Boot+Thymeleaf时 代码: 应用程序类别: package com.mycom.extract; 导入org.springframework.boot.SpringApplication; 导入org.springframework.boot.autoconfigure.springboot应用程序; 导入org.springframework.boot.builder.SpringAp

我得到以下错误:

出现意外错误(类型=未找到,状态=404)。没有可用的消息

使用Spring Boot+Thymeleaf时

代码:

应用程序类别:

package com.mycom.extract;
导入org.springframework.boot.SpringApplication;
导入org.springframework.boot.autoconfigure.springboot应用程序;
导入org.springframework.boot.builder.SpringApplicationBuilder;
导入org.springframework.boot.web.support.SpringBootServletInitializer;
@SpringBootApplication(scanBasePackages=“com.mycom.extract”)
公共类MyAppExtractionWebApplication扩展了SpringBootServletializer{
公共静态void main(字符串[]args){
run(MyAppExtractionWebApplication.class,args);
}
@凌驾
受保护的SpringApplicationBuilder配置(SpringApplicationBuilder应用程序){
返回application.sources(MyAppExtractionWebApplication.class);
}
}
pom.xml
4.0.0
com.mycom.extract
MyApp提取
1.
战争
MyAppExtractionWeb
SpringBoot的演示项目
org.springframework.boot
spring启动程序父级
1.5.4.1发布
UTF-8
UTF-8
1.8
org.springframework.boot
弹簧启动装置
org.springframework.boot
SpringBootStarterWeb
org.springframework.boot
弹簧靴开发工具
org.springframework.boot
弹簧启动机aop
org.springframework.boot
spring boot启动器集成
com.jcraft
jsch
0.1.54
org.springframework.boot
弹簧启动机tomcat
假如
org.springframework.boot
弹簧启动安全
javax.servlet
javax.servlet-api
org.thymeleaf.extras
thymeleaf-extras-springsecurity4
org.springframework.boot
弹簧起动试验
测试
org.springframework.boot
springbootmaven插件
证券配置
包com.mycom.extract.config.security;
导入org.springframework.beans.factory.annotation.Autowired;
导入org.springframework.context.annotation.Configuration;
导入org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
导入org.springframework.security.config.annotation.web.builders.HttpSecurity;
导入org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
导入org.springframework.security.config.annotation.web.configuration.websecurityConfigureAdapter;
导入org.springframework.security.web.util.matcher.AntPathRequestMatcher;
@配置
@启用Web安全性
公共类SecurityConfig扩展了WebSecurity配置适配器{
@自动连线
私有MyAppAuthenticationProvider authProvider;
@凌驾
受保护的无效配置(AuthenticationManagerBuilder auth)引发异常{
auth.authenticationProvider(authProvider);
}
@凌驾
受保护的无效配置(HttpSecurity http)引发异常{
http.authorizeRequests()
.antMatchers(“/css/**,“/login”).permitAll()
.antMatchers(“/*”).fullyAuthenticated()
.及()
.formLogin().login页面(“/login”)
.loginProcessingUrl(“/j\u spring\u security\u check”)
.usernameParameter(“ipn”).passwordParameter(“密码”)
.defaultSuccessUrl(“/home”).failureUrl(“/login?error”)
.及()
.logout().logoutRequestMatcher(新的AntPathRequestMatcher(“/logout”))
.logoutSuccessUrl(“/login”);
http.csrf().disable();
}
}
WebMVC配置
包com.mycom.extract.config;
导入org.springframework.boot.autoconfigure.EnableAutoConfiguration;
导入org.springframework.context.annotation.ComponentScan;
导入org.springframework.context.annotation.Configuration;
导入org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
导入org.springframework.web.servlet.config.annotation.WebMVCConfigureAdapter;
@启用自动配置
@配置
@ComponentScan(basePackages={“com.mycom.extract”})
公共类MyAppConfiguration扩展了WebMVCConfigureAdapter{
@凌驾
public void addViewController(ViewControllerRegistry注册表){
registry.addRedirectViewController(“/”,“/login”);
registry.addViewController(“/login”).setViewName(“索引”);
registry.addViewController(“/home”).setViewName(“home”);
}

}
您将获得哪些URL 404?你能在这里发布你的控制器类吗?你好,URL:我的问题是你的“/MyAppExtractionWeb”端点在哪里?如果它是一个角度状态,那么你调用的端点是什么?我认为这是因为你没有使用AuthFilter:你应该像上面那样创建一些类,并从中创建
@Bean
。发现问题。application.properties server.servlet中的路径值错误。