spring boot 网站默认首页 Spring Boot 2.0 设置网站默认首页的实现代码

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

spring boot 网站默认首页 Spring Boot 2.0 设置网站默认首页的实现代码

tiandong   2021-03-28 我要评论
想了解Spring Boot 2.0 设置网站默认首页的实现代码的相关内容吗,tiandong在本文为您仔细讲解spring boot 网站默认首页的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:spring,boot,网站默认首页,下面大家一起来学习吧。

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路由

 

测试结果,如下

 

下面看下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 设置网站默认首页的实现代码,如果大家有任何疑问请给我留

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

猜您喜欢

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们