在localhost我的应用程序有效,但在运行后的ec2中我有错误404.我看到其他答案并添加到我的application.properties server.context-path=/index
和我的应用程序
@Bean
public DispatcherServlet dispatcherServlet (){
return new DispatcherServlet();
}
@Bean
public ServletRegistrationBean dispatchServletRegistration(){
ServletRegistrationBean registrationBean = new ServletRegistrationBean(dispatcherServlet(), "/*");
registrationBean.setName(DispatcherServletAutoConfiguration.DEFAULT_DISPATCHER_SERVLET_REGISTRATION_BEAN_NAME);
return registrationBean;
}
但仍然无法奏效。我做错了什么?