关于spring,我是比较模糊的,就用了是springmvc作为后端框架。
本文就当自己的学习笔记,先把脑子的大体印象写出来,想到哪里写到哪里,不作为分享。待以后看源码学习。
结合图,我吧常用的分类待整理地方。
从上图来看让你更来理解:IOC,aop是需要理解的。待专门梳理。
核心配置文件:
applicationContext.xml
关注点:自动扫描,基于注解,数据域配置,对于输出json,xml的转换配置。
配置mybatis,还有下面的数据库事务。
引入dubbo服务。
有关Spring中的Advisor,Advice,Pointcut
http://blog.sina.com.cn/s/blog_5198c7370100hw1p.html
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"
default-lazy-init="true">
<!-- Enable @Transactional support -->
<tx:annotation-driven/>
<!-- Enable @AspectJ support -->
<aop:aspectj-autoproxy/>
<!-- Activates scanning of @Autowired -->
<context:annotation-config/>
<!-- Activates scanning of @Service -->
<context:component-scan base-package="com.ailk.haier.uplus.core.service"/>
<tx:advice id="txAdvice" transaction-manager="transactionManager" >
<tx:attributes>
<tx:method name="insert*" propagation="REQUIRED" rollback-for="Throwable" timeout="120"/>
<tx:method name="update*" propagation="REQUIRED" rollback-for="Throwable" timeout="120"/>
<tx:method name="delete*" propagation="REQUIRED" rollback-for="Throwable" timeout="120"/>
<tx:method name="transaction*" propagation="REQUIRED" rollback-for="Throwable" timeout="120"/>
<tx:method name="add*" propagation="REQUIRED" rollback-for="Throwable" timeout="120"/>
<tx:method name="save*" propagation="REQUIRED" rollback-for="Throwable" timeout="120"/>
<tx:method name="clear*" propagation="REQUIRED" rollback-for="Throwable" timeout="120"/>
<tx:method name="move*" propagation="REQUIRED" rollback-for="Throwable" timeout="120"/>
<tx:method name="reduce*" propagation="REQUIRED" rollback-for="Throwable" timeout="120"/>
<tx:method name="*" rollback-for="Throwable" timeout="120"/>
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="productServiceMethods" expression="execution(* com.ailk.haier.uplus.core*.*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="productServiceMethods" />
</aop:config>
<!-- =================================================================== -->
<!-- Security class from Spring Security - used to configure Password -->
<!-- Encryption in UserManagerImpl. Can override in security.xml. -->
<!-- =================================================================== -->
<bean id="passwordEncoder" class="org.springframework.security.authentication.encoding.ShaPasswordEncoder"/>
</beans>
*************************************************
当然从springmvc的项目角度来考虑,
相关的配置文件有maven的pom.xml创建工程的。
有web.xml,配置监听器、过滤器、Spring MVC 核心控制器 DispatcherServlet 配置、编码等。
数据库的数据源
mybatis配置。
**********************************