為了提供一個(gè)單包易部署的服務(wù)器應(yīng)用,考慮使用Spring Boot,因?yàn)槠浼闪薃pache Tomcat,易于運(yùn)行,免去絕大部分了服務(wù)器配置的步驟。
項(xiàng)目初始化
首先從mvn archetype:generate
中選擇 com.github.mkspcd:simple-webapp
(或其他webapp模版) 模版生成項(xiàng)目結(jié)構(gòu)。
更多關(guān)于maven請(qǐng)移步Maven - Users Centre
在pom.xml中添加parent來(lái)獲取Spring Boot所需的最小依賴(lài)。
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.github.hwding.example</groupId> <artifactId>example</artifactId> <packaging>jar</packaging> <version>0.0.1</version> <name>an example</name> <url>https://github.com/hwding</url> <!-- 添加Spring的Repository以便于添加相關(guān)組件 --> <repositories> <repository> <url>http://repo.spring.io/milestone/</url> <id>repo-spring</id> </repository> </repositories> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.6.RELEASE</version> </parent> <build> <finalName>example</finalName> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> <!-- 編譯級(jí)別,可選 --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <!-- 用于Hibernate4的SQLite3 Dialect --> <dependency> <groupId>com.enigmabridge</groupId> <artifactId>hibernate4-sqlite-dialect</artifactId> <version>0.1.2</version> </dependency> <!-- 用于配置數(shù)據(jù)源 --> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-dbcp2</artifactId> <version>2.1.1</version> </dependency> <dependency> <groupId>org.eclipse.persistence</groupId> <artifactId>javax.persistence</artifactId> <version>2.2.0-RC1</version> </dependency> <!-- SQLite3 驅(qū)動(dòng) --> <dependency> <groupId>org.xerial</groupId> <artifactId>sqlite-jdbc</artifactId> <version>3.20.0</version> </dependency> </dependencies> </project>
本文標(biāo)題:使用SpringBoot快速構(gòu)建基于SQLite數(shù)據(jù)源的應(yīng)用-創(chuàng)新互聯(lián)
文章鏈接:http://aaarwkj.com/article0/dgosio.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站改版、微信小程序、品牌網(wǎng)站建設(shè)、云服務(wù)器、網(wǎng)站策劃、標(biāo)簽優(yōu)化
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容