0
我有一個Spring核心應用程序,我想轉換爲一個Web項目。我已經在使用Eclipse IDE和Maven構建的普通Java項目中爲我的應用程序實現了所有業務邏輯。如何將Spring應用程序轉換爲Spring Web應用程序?
但自從我開始使用Core Java Project以來,我沒有WebContent文件夾或Apache Tomcat包裝器。那麼轉換這個項目最好的方法是什麼?我應該只是改變pom.xml還是Spring有一個使用SpringBoot的替代解決方案,我已經包含在pom.xml中了? (正如你能告訴我是新來的Spring框架)
這裏是我的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>
<groupId>org.springframework</groupId>
<artifactId>gs-serving-web-content</artifactId>
<version>0.1.0</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.2.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.9</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-dbcp2</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
<version>2.3</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-milestone</id>
<url>https://repo.spring.io/libs-release</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-milestone</id>
<url>https://repo.spring.io/libs-release</url>
</pluginRepository>
</pluginRepositories>
</project>
但不會反映我對pom.xml中所做的更改會嗎?如果有人從git中抽取我的項目呢? – shyam 2015-03-25 06:25:35
它與你的'pom.xml'沒有任何關係,可以讓你對它做出的改變進行查詢。您必須爲項目執行'maven - install'並檢查您的庫文件夾中新添加的罐子 – 2015-03-25 06:29:13