学生成绩管理系统-SSM实现(配置文件的配置加注解)

(该项目使用maven管理)
1. 所需jar包(pom.xml) <!-- jar包的版本--> <spring.version>4.3.9.RELEASE</
spring.version> <aspectj.version>1.6.11</aspectj.version> <junit.version>4.12</
junit.version> <mysql.version>5.1.38</mysql.version> <mybatis.version></
mybatis.version> <mybatis-spring.version>1.3.1</mybatis-spring.version> <
mybatis.version>3.4.4</mybatis.version> <jstl.version>1.2</jstl.version> <
jackson.version>1.9.13</jackson.version> <fastjson.version>1.2.46</
fastjson.version> <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> <!-- springframe end -->
<!--mysql数据库驱动 --> <dependency> <groupId>mysql</groupId> <artifactId>
mysql-connector-java</artifactId> <version>${mysql.version}</version> </
dependency> <!--使用AspectJ方式注解需要相应的包 --> <dependency> <groupId>org.aspectj</
groupId> <artifactId>aspectjrt</artifactId> <version>${aspectj.version}</version
> </dependency> <!--使用AspectJ方式注解需要相应的包 --> <dependency> <groupId>org.aspectj</
groupId> <artifactId>aspectjweaver</artifactId> <version>${aspectj.version}</
version> </dependency> <!-- batis --> <dependency> <groupId>org.mybatis</groupId
> <artifactId>mybatis-spring</artifactId> <version>${mybatis-spring.version}</
version> </dependency> <dependency> <groupId>org.mybatis</groupId> <artifactId>
mybatis</artifactId> <version>${mybatis.version}</version> </dependency> <!--
json所需jar start --> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <
artifactId>jackson-databind</artifactId> <version>2.7.5</version> </dependency>
<dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>
jackson-mapper-asl</artifactId> <version>${jackson.version}</version> </
dependency> <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>
jackson-core-asl</artifactId> <version>${jackson.version}</version> </dependency
> <!-- json所需jar end --> 2. spring.xml <!-- 可实现json字符串自动转化为实体类 --> <
mvc:annotation-driven /> <!-- 实体 json 自动映射转化 --> <bean class=
"org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
<property name="messageConverters"> <list> <ref bean=
"mappingJacksonHttpMessageConverter" /> </list> </property> </bean> <bean id=
"mappingJacksonHttpMessageConverter" class=
"org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"> <
property name="supportedMediaTypes"> <list> <value>text/html;charset=UTF-8</
value> <value>text/json;charset=UTF-8</value> </list> </property> </bean> <!--
启用Spring对基于@AspectJ aspects的配置支持 --> <!-- 激活自动代理功能 --> <aop:aspectj-autoproxy />
<!-- 事务管理 注解开启--> <tx:annotation-driven transaction-manager="transactionManager"
/> <!-- Initialization for data source --> <bean id="dataSource" class=
"org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name=
"driverClassName" value="com.mysql.jdbc.Driver" /> <property name="url" value=""
/> <property name="username" value="" /> <property name="password" value="" />
</bean> <!-- Initialization for TransactionManager --> <!-- 开启事务管理器 --> <bean id
="transactionManager" class=
"org.springframework.jdbc.datasource.DataSourceTransactionManager"> <property
name="dataSource" ref="dataSource" /> </bean> <!-- mybatis的配置开始 --> <bean id=
"sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <property
name="dataSource" ref="dataSource" /> <property name="typeAliasesPackage" value=
"com.mdy.student.bean" /> <!-- mybatis的设置--> <property name="configLocation"
value="classpath:orm/mybatis-config.xml" /> <!-- mapper类的配置文件的自动装载--> <property
name="mapperLocations" value="classpath:mapper/*.xml" /> </bean> <!-- scan for
mappers and let them be autowired --> <bean class=
"org.mybatis.spring.mapper.MapperScannerConfigurer"> <property name=
"basePackage" value="com.mdy.student.mapper" /> </bean> <!-- mybatis的配置结束 -->
3.web.xml部分内容 <!-- 上下文监听器 不启用spring自动注入可能会失败 --> <listener> <listener-class>
org.springframework.web.context.ContextLoaderListener</listener-class> </
listener> <servlet> <servlet-name>Student</servlet-name> <servlet-class>
org.springframework.web.servlet.DispatcherServlet</servlet-class> <!--
servlet的配置文件加载 --> <init-param> <param-name>contextConfigLocation</param-name>
<!-- spring mvc 的配置--> <param-value>classpath*:spring/mvc-config.xml</
param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <
servlet-mapping> <servlet-name>Student</servlet-name> <url-pattern>/</
url-pattern> </servlet-mapping> 4.mvc-config.xml <mvc:annotation-driven/> <
context:component-scan base-package="com.mdy.student.web" /> <!--
js,css等静态文件的配置,否则会被spring的过滤器拦截--> <mvc:resources mapping="/js/**" location=
"/resources/js/" cache-period="#{60 * 60}" /> <mvc:resources mapping="/css/**"
location="/resources/css/" cache-period="#{60 * 60}" />
<!--<mvc:default-servlet-handler />--> <!-- jsp页面资源的访问配置,使用spring mvc时直接return
jsp文件名--> <bean class=
"org.springframework.web.servlet.view.InternalResourceViewResolver"> <!--
前缀配置--> <property name="prefix" value="/WEB-INF/jsp/"/> <!-- 后缀配置--> <property
name="suffix" value=".jsp"/> </bean>
以上为该项目的配置文件的具体情况