本地主机重定向到不同的页面
localhost redirects to a different page
我的 Spring 引导项目遇到问题。当我 运行 应用程序并转到 http://localhost:8086/ it redirects to http://localhost:8086/login 时,这不是我想要的页面。
这是我的application.properties文件
的内容
#Database
spring.datasource.url=jdbc:mysql://localhost:3306/db_name
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.platform=mysql
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
#Html
spring.mvc.view.prefix=/public/
spring.mvc.view.suffix=.html
#Server
server.port=8086
我还添加了这个 class,它应该按照指定打开 /public/ 文件夹中的 index.html 文件在上面的属性中
public class WebAppConfig implements WebMvcConfigurer {
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/").setViewName("forward:/index.html");
}
}
我是否做错了什么,或者我应该先在它重定向到的页面中登录吗?
希望, basically it's in the configuration
我的 Spring 引导项目遇到问题。当我 运行 应用程序并转到 http://localhost:8086/ it redirects to http://localhost:8086/login 时,这不是我想要的页面。
这是我的application.properties文件
的内容#Database
spring.datasource.url=jdbc:mysql://localhost:3306/db_name
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.platform=mysql
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
#Html
spring.mvc.view.prefix=/public/
spring.mvc.view.suffix=.html
#Server
server.port=8086
我还添加了这个 class,它应该按照指定打开 /public/ 文件夹中的 index.html 文件在上面的属性中
public class WebAppConfig implements WebMvcConfigurer {
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/").setViewName("forward:/index.html");
}
}
我是否做错了什么,或者我应该先在它重定向到的页面中登录吗?
希望