Next we will integrate SSI into the maven build program. First you need to select the version you want to integrate, because the maven dependency needs to specify the version, the following is the SSI version I need for integration (represented by Maven dependency ):
1 <!--Spring-->
2 <dependency>
3 <groupId>org.springframework</groupId>
4 <artifactId>spring</artifactId>
5 <version>2.5.6</version>
6 </dependency>
7 <!--Ibatis-->
8 <dependency>
9 <groupId>org.apache.ibatis</groupId>
10 <artifactId>ibatis-sqlmap</artifactId>
11 <version>2.3.4.726</version>
12 </dependency>
13 <!--Struts2-->
14 <dependency>
15 <groupId>org.apache.struts</groupId>
16 <artifactId>struts2-core</artifactId>
17 <version>2.1.8.1</version>
18 </dependency>
Of course, some new users may ask, how do I know the official dependency of Maven? How do I know whether Maven has the official dependency? In fact, the solution is also very simple, there are roughly two types:
1. Search on Google. You can search for the spring version more easily. For example, if you want to search for the spring version, you can write the keyword "Maven spring repository ", in this way, the first record is basically searched.
2. Create dependency in the maven local repository by default. below the m2/repository folder, how to create it is not described in detail. You can create it according to the default style. If it is a self-generated jar dependency, you must use this form.
Next, we will first configure the dependencies required by spring. First, you will write the dependency of spring under the dependencies tab of your parent pom, and then you will execute the command MVN Eclipse: Clean Eclipse: eclipse, and then in your eclipse directory structure will spring-2.5.6.jar this dependency (PS. of course, you need to configure your path in eclipse. I will not describe it here). The same is true for configuring ibatis. Next we will first integrate Spring and ibatis, in fact, the best integration tutorial is the official reference provided by spring. You can refer to the configuration above, the approximate location is real data access in the middle layer/data access using the ORM tool (of course, my reference is in Chinese ).
Refer to the configuration above to configure a demo. Of course, here we need mainly the XML file. We will put it under the verticalmarket-config sub-project for unification, so when we reference these xml configuration files in verticalmarket-Dal, We need to configure project dependencies. The configuration is similar to the configuration of third-party package dependencies. below is my dependencies:
1 <dependency>
2 <groupId>com.tkz.verticalmarket</groupId>
3 <artifactId>verticalmarket-config</artifactId>
4 <version>1.0</version>
5 </dependency>
For some other flexible configurations, it is best to read the official documentation of Maven. The most important thing is to use more hands-on practices to discover and better solve problems.