1. 程式人生 > >使用IDEA搭建SSM框架

使用IDEA搭建SSM框架

spa img enc 更正 dbcp -s hid 創建 nco

前言:

【關於SSM的框架,以後再做整理】

【學習性文章,本文長期更新,如有錯誤,感激指正,並會及時更正與回答,謝謝】

正文:

1、開發環境的配置【以後再做整理】

2、IDEA上創建MAVEN WEB框架【以後再做整理】

3、搭建SSM框架

ssm框架的搭建過程,實際是spring、spring-MVC、mybatis三個JAVA開源框架的整合過程。這裏涉及到【利用maven整合框架,合並項目】的學習,【以後再做整理】。

  step1:maven引入需要的jar包

      關於pom.xml文件的內容的組成:spring依賴的包,數據庫相關的包,mybatis依賴的包,三者之間關系構建依賴的包,輔助工具包

        spring依賴的包:

           技術分享圖片
<!-- spring核心包 -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <
dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</
groupId> <artifactId>spring-oxm</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-tx</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-jdbc</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aop</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context-support</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> <version>${spring.version}</version> </dependency>
spring-dependency

        mybatis依賴的包:

           技術分享圖片
        <!-- mybatis核心包 -->
        <dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis</artifactId>
            <version>${mybatis.version}</version>
        </dependency>
mybatis-dependency

        數據庫相關的包:

           技術分享圖片
                <!-- 導入Mysql數據庫鏈接jar包 -->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.30</version>
        </dependency>
        
        <!-- 導入dbcp的jar包,用來在applicationContext.xml中配置數據庫 -->
        <dependency>
            <groupId>commons-dbcp</groupId>
            <artifactId>commons-dbcp</artifactId>
            <version>1.2.2</version>
        </dependency>
        
        <!-- 數據庫連接池 -->
                <dependency>
                        <groupId>com.mchange</groupId>
                        <artifactId>c3p0</artifactId>
                        <version>0.9.5.2</version>
                </dependency>        
database-dependency

使用IDEA搭建SSM框架