網頁

2019/1/7

使用SpringBoot打造記帳簿專案(十)建立SpringBoot專案

本篇為記帳簿SpringBoot專案的建立。

首先建立用來存放專案的資料夾,在D:\槽下建立一個記帳簿專用的資料夾命名為moneynote。

然後在moneynote資料夾中在建立一個workspace資料夾,用來做為Eclipse的工作空間(workspace)。

建立SpringBoot專案請參考使用Eclipse STS建立Spring Boot應用程式專案,只需參考到建立好專案可啟動的部分即可。

以下是一些記帳簿環境資訊。

  • 使用的jdk版本為1.8。
  • 使用的Eclipse版本為eclipse-jee-2018-12-R-win32-x86_64.zip
  • 安裝的STS版本為4.1.0.RELEASE
  • 安裝的SpringBoot版本為2.2.0
  • 專案名稱為'moneynote'。
  • 其餘參考Eclipse的一些基本設定

建立好的專案目錄如下



預設的pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.2.0.BUILD-SNAPSHOT</version>
    <relativePath /> <!-- lookup parent from repository -->
  </parent>
  <groupId>idv.matt</groupId>
  <artifactId>moneynote</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>
  <name>moneynote</name>
  <description>moneynote</description>

  <properties>
    <java.version>1.8</java.version>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-tomcat</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-test</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
      </plugin>
    </plugins>
  </build>

  <repositories>
    <repository>
      <id>spring-snapshots</id>
      <name>Spring Snapshots</name>
      <url>https://repo.spring.io/snapshot</url>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
    <repository>
      <id>spring-milestones</id>
      <name>Spring Milestones</name>
      <url>https://repo.spring.io/milestone</url>
    </repository>
  </repositories>
  <pluginRepositories>
    <pluginRepository>
      <id>spring-snapshots</id>
      <name>Spring Snapshots</name>
      <url>https://repo.spring.io/snapshot</url>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </pluginRepository>
    <pluginRepository>
      <id>spring-milestones</id>
      <name>Spring Milestones</name>
      <url>https://repo.spring.io/milestone</url>
    </pluginRepository>
  </pluginRepositories>

</project>

啟動SpringBoot專案console所印出的訊息

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::  (v2.2.0.BUILD-SNAPSHOT)

2019-01-07 21:55:20.279  INFO 8616 --- [           main] i.matt.application.MoneynoteApplication  : Starting MoneynoteApplication on matt-PC with PID 8616 (D:\moneynote\workspace\moneynote\target\classes started by matt in D:\moneynote\workspace\moneynote)
2019-01-07 21:55:20.282  INFO 8616 --- [           main] i.matt.application.MoneynoteApplication  : No active profile set, falling back to default profiles: default
2019-01-07 21:55:21.247  INFO 8616 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2019-01-07 21:55:21.271  INFO 8616 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2019-01-07 21:55:21.271  INFO 8616 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.14]
2019-01-07 21:55:21.278  INFO 8616 --- [           main] o.a.catalina.core.AprLifecycleListener   : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [D:\Applications\Java\jdk.1.8.0_171\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;D:\app\matt2\product\12.2.0\dbhome_1\bin;D:\Applications\Java\jdk.1.8.0_171\bin\;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;D:\Applications\PuTTY\;D:\Applications\Git\bin\;D:\Applications\MySQL\MySQL Server 8.0\bin\;C:\Program Files (x86)\QuickTime\QTSystem\;;D:\Applications\Microsoft VS Code\bin;.]
2019-01-07 21:55:21.347  INFO 8616 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2019-01-07 21:55:21.347  INFO 8616 --- [           main] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 1021 ms
2019-01-07 21:55:21.567  INFO 8616 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2019-01-07 21:55:21.735  INFO 8616 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2019-01-07 21:55:21.740  INFO 8616 --- [           main] i.matt.application.MoneynoteApplication  : Started MoneynoteApplication in 1.774 seconds (JVM running for 2.462)

接著參考以下:


參考:

沒有留言:

張貼留言