为了提供一个单包易部署的服务器应用,考虑使用Spring Boot,因为其集成了Apache Tomcat,易于运行,免去绝大部分了服务器配置的步骤。
项目初始化
首先从mvn archetype:generate中选择 com.github.mkspcd:simple-webapp(或其他webapp模版) 模版生成项目结构。
更多关于maven请移步Maven - Users Centre
在pom.xml中添加parent来获取Spring Boot所需的最小依赖。
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://.enigmabridge.hibernate.dialect.SQLiteDialect");,这个类我们已经在pom中引入了。配置入口
@SpringBootApplicationpublic class Application { public static void main(String[] args) { SpringApplication.run(Application.class); }}Spring Boot能够从JAR包的入口直接启动整个应用程序。
总结
以上所述是小编给大家介绍的使用Spring Boot快速构建基于SQLite数据源的应用,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对网站的支持!