java之ssm项目的xml文件

1.新建maven项目,在pom.xml中添加相关依赖

<project xmlns="http://www.198bona.com" 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>demoGroup</groupId>

<artifactId>websocket</artifactId>

<version>0.0.1-SNAPSHOT</version>

<packaging>war</packaging>

<properties>

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<!-- 设置 Spring 的版本 -->

<spring.version>4.1.2.RELEASE</spring.version>

<!-- mybatis版本号 -->

<mybatis.version>3.2.8</mybatis.version>

<postgresql.driver.version>9.3-1101-jdbc4</postgresql.driver.version>

<org.springframework.version>4.1.2.RELEASE</org.springframework.version>

<org.slf4j.version>1.6.6</org.slf4j.version>

</properties>

<dependencies>

<!-- junit -->

<dependency>

<groupId>junit</groupId>

<artifactId>junit</artifactId>

<version>4.12-beta-3</version>

<scope>test</scope>

</dependency>

<!-- log4j -->

<dependency>

<groupId>log4j</groupId>

<artifactId>log4j</artifactId>

<version>1.2.17</version>

</dependency>

<dependency>

<groupId>jstl</groupId>

<artifactId>jstl</artifactId>

<version>1.2</version>

</dependency>

<!-- spring 的基本依赖 开始 -->

<dependency>

<groupId>org.springframework</groupId>

<artifactId>spring-core</artifactId>

<version>${spring.version}</version>

</dependency>

<dependency>

<groupId>org.springframework</groupId>

<artifactId>spring-expression</artifactId>

<version>${spring.version}</version>

</dependency>

<dependency>

<groupId>org.springframework</groupId>

<artifactId>spring-beans</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</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-tx</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-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-aspects</artifactId>

<version>${spring.version}</version>

</dependency>

<dependency>

<groupId>org.springframework</groupId>

<artifactId>spring-test</artifactId>

<version>${spring.version}</version>

</dependency>

<!-- spring 的基本依赖 结束 -->

<!-- mybatis核心包 -->

<dependency>

<groupId>org.mybatis</groupId>

<artifactId>mybatis</artifactId>

<version>${mybatis.version}</version>

</dependency>

<!-- mybatis/spring包 -->

<dependency>

<groupId>org.mybatis</groupId>

<artifactId>mybatis-spring</artifactId>

<version>1.2.2</version>

</dependency>

<!-- postgresql驱动 依赖 -->

<dependency>

<groupId>org.postgresql</groupId>

<artifactId>postgresql</artifactId>

<version>${postgresql.driver.version}</version>

</dependency>

<!-- c3p0连接池 -->深圳市博纳网络信息技术有限公司

<dependency>

<groupId>c3p0</groupId>

<artifactId>c3p0</artifactId>

<version>0.9.1.2</version>

</dependency>

<!-- Spring WebSocket -->

<dependency>

<groupId>org.springframework</groupId>

<artifactId>spring-websocket</artifactId>

<version>${org.springframework.version}</version>

</dependency>

<dependency>

<groupId>org.codehaus.jackson</groupId>

<artifactId>jackson-mapper-asl</artifactId>

<version>1.9.4</version>

</dependency>

<dependency>

<groupId>org.codehaus.jackson</groupId>

<artifactId>jackson-core-asl</artifactId>

<version>1.9.4</version>

</dependency>

</dependencies>

2、在java目录下创建entity、dao、server、controller等主要目录3、在resource中创建mapper文件夹,用于存放mybatis的mapper.xml文件4、在resource中创建jdbc.properties文件,用于配置数据库连接参数 jdbc要和依赖中的对应jdbc.driver=org.postgresql.Driverjdbc.url=jdbc:postgresql://127.0.0.1:5432/dm_video_demojdbc.username=postgresqljdbc.password=1234565、在resource中创建mybatis.xml文件复制代码复制代码6、在resource中创建spring_dao.xml文件复制代码 复制代码7、在resource中创建spring_server.xml文件复制代码复制代码8、在resource中创建spring_mvc.xml文件复制代码 复制代码9、修改web.xml 文件复制代码websocket websocketmaven.example.rootorg.springframework.web.util.Log4jConfigListenerCharacterEncodingFilterorg.springframework.web.filter.CharacterEncodingFilterencodingUTF-8forceEncodingtrueCharacterEncodingFilter/*springMvcorg.springframework.web.servlet.DispatcherServletcontextConfigLocationclasspath:spring-*.xml1springMvc/

(0)

相关推荐