2012-01-28 25 views
0

我希望我的Tomcat Web應用程序的對象由Maven的pom和Spring的IoC控制,包括會話範圍的bean。我的應用程序由幾個從jsp文件訪問的對象組成。如何使用SpringSource Tool Suit開發Tomcat應用程序?

用套裝工具設計這樣的應用程序的最佳方式是什麼?我應該使用Spring MVC Project模板,但我不想實現MVC層?或者網絡上有另一個模板?

回答

1

我使用STS的方式就是這樣。轉到

File --> New --> Project --> Maven Project--> Create a simple project (skip archtype) --> Enter the Artifact details. 

例如:組ID:com.examples 工件ID:MyProject

單擊Finish。

現在右鍵單擊Project Explorer和項目選擇Spring Tools--> Add Spring Project Nature.

我通常使用簡單的項目,因爲我喜歡用跨項目相同pom.xml,並添加/需要時取出的依賴。

樣品的pom.xml獲得與Spring

<dependencies> 
<dependency> 
    <groupId>org.springframework</groupId> 
    <artifactId>spring-aop</artifactId> 
    <version>3.1.0.RELEASE</version> 
    <scope>runtime</scope> 
</dependency> 
<dependency> 
    <groupId>org.springframework</groupId> 
    <artifactId>spring-aspects</artifactId> 
    <version>3.1.0.RELEASE</version> 
    <scope>runtime</scope> 
</dependency> 
<dependency> 
    <groupId>org.springframework</groupId> 
    <artifactId>spring-web</artifactId> 
    <version>3.1.0.RELEASE</version> 
    <scope>runtime</scope> 
</dependency> 
<dependency> 
    <groupId>org.springframework</groupId> 
    <artifactId>spring-context-support</artifactId> 
    <version>3.1.0.RELEASE</version> 
    <scope>runtime</scope> 
</dependency> 
<dependency> 
    <groupId>org.springframework</groupId> 
    <artifactId>spring-beans</artifactId> 
    <version>3.1.0.RELEASE</version> 
    <scope>runtime</scope> 
</dependency> 
<dependency> 
    <groupId>org.springframework</groupId> 
    <artifactId>spring-context</artifactId> 
    <version>3.1.0.RELEASE</version> 
    <scope>runtime</scope> 
</dependency> 
<dependency> 
    <groupId>org.springframework</groupId> 
    <artifactId>spring-core</artifactId> 
    <version>3.1.0.RELEASE</version> 
    <scope>runtime</scope> 
    </dependency> 
    <dependency> 
    <groupId>javax.el</groupId> 
    <artifactId>javax.el-api</artifactId> 
    <version>2.2.4</version> 
    <scope>provided</scope> 
    </dependency> 
    <dependency> 
    <groupId>javax.servlet.jsp</groupId> 
    <artifactId>javax.servlet.jsp-api</artifactId> 
    <version>2.2.1</version> 
    <scope>provided</scope> 
    </dependency> 
    <dependency> 
    <groupId>javax.servlet</groupId> 
    <artifactId>javax.servlet-api</artifactId> 
    <version>3.0.1</version> 
    <scope>provided</scope> 
    </dependency> 
</dependencies> 
+0

但如何將添加「雄貓自然」這樣我就可以調試一個用'WEB-INF'等Tomcat上的應用程序? – 2012-02-01 21:22:55

+0

如果您想對tomcat進行性能分析,並且您使用提供的VFabric tc服務器。只需雙擊tc服務器,就會有一個名爲Insight的小標籤。選中啓用度量收集框。之後,重新啓動SpringToolSuite並部署一個應用程序,並在瀏覽器中指向http:// localhost:8080/insight,它將帶您進入Insight Dashboard,您可以查看由tomcat和其他人收集的各種統計信息。 – Ravi 2012-02-01 23:57:54

+0

請將答案標記爲如果它能幫助你以某種方式解決這個問題,它就會被接受。 – Ravi 2012-02-01 23:59:07

相關問題