虚位以待(AD)
虚位以待(AD)
首页 > 软件编程 > Java编程 > Spring Boot 2.0 设置网站默认首页的实现代码

Spring Boot 2.0 设置网站默认首页的实现代码
类别:Java编程   作者:码皇   来源:互联网   点击:

这篇文章主要介绍了Spring Boot 2 0 设置网站默认首页的实现代码,需要的朋友可以参考下

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 exceptione.printStackTrace();
    }
    }
    }

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

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

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

 

测试结果,如下

 

下面看下Spring Boot 2.0 新特性

说了这么多,Spring Boot 2.0 和 1.0 比都有哪些变动和新特性呢?

•JDK最低要求1.8+,并支持1.9;
•支持Spring webflux/webflux.fn响应式的web编程;
•提供Spring Data Cassandra, MongoDB, Couchbase和Redis的响应式自动配置及starter POMs;
•支持嵌入式的Netty;
•HTTP/2的支持:Tomcat, Undertow and Jetty;
•全新的体系结构,支持Spring MVC、WebFlux和Jersey;
•增强了Micrometer集成,以Atlas, Datadog, Ganglia, Graphite, Influx, JMX, New Relic, Prometheus, SignalFx, StatsD and Wavefront为基础的度量指标;
•Quartz调度支持;
•极大简化了安全自动配置;

总结

以上所述是小编给大家介绍的Spring Boot 2.0 设置网站默认首页的实现代码,如果大家有任何疑问请给我留

言,小编会及时回复大家的。在此也非常感谢大家对脚本之家网站的支持!

您可能感兴趣的文章:

  • spring boot 中设置默认网页的方法
相关热词搜索: spring boot 网站默认首页