itshare

Spring Boot设置默认首页,方法实验OK如下

附上Application启动代码

/**
 * @ClassName Application
 * @Description Spring-Boot website启动类
 * @author kevin.tian
 * @Date 2018-03
 * @version 1.0.0
 */
@SpringBootApplication
@PropertySource(value={    
        "file:${APP_HOME_CONF}/overpayment-web/overpayment-web.properties",    
        "file:${APP_HOME_CONF}/overpayment-web/db.properties"
    })
@ImportResource({"file:${APP_HOME_CONF}/overpayment-web/spring.xml"})
public class Application extends SpringBootServletInitializer {

    public static void main(String[] args)
    {
        try {
            SpringApplication.run(Application.class);
        } catch (Exception e) {
            // TODO: handle exception
            e.printStackTrace();
        }
    }
}

 

1. 放置默认首页default.html,

位置在/src/main/resources/static/default.html

 

2. 增加IndexController控制器,设置index路由

 

测试结果,如下

 

相关文章:

  • 2021-09-23
  • 2022-01-07
  • 2021-05-25
  • 2021-12-02
  • 2021-12-23
  • 2021-04-07
  • 2021-04-22
猜你喜欢
  • 2021-04-17
  • 2021-10-04
  • 2021-07-24
  • 2021-09-23
  • 2022-01-05
  • 2022-01-07
  • 2021-11-22
  • 2021-06-11
相关资源
相似解决方案