随笔分类 - spring
摘要:保证数据的一致性和完整性 官网:http://mybatis.org/spring/zh/transactions.html 声明式事务 spring中配置声明事务 <!--配置声明事务--> <bean id="transactionManager" class="org.springframew
阅读全文
摘要:官网: http://mybatis.org/spring/zh/getting-started.html 过程 1、导入jar包 junit mybatis mysql spring aop mybatis-spring 2、编写配置文件 3、测试 二、过程 1、maven <!-- 依赖-->
阅读全文
摘要:三种方式 第二个比较好 导入包 <!-- https://mvnrepository.com/artifact/org.aspectj/aspectjweaver --> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjw
阅读全文
摘要:注意:动态代理代理的是接口 一、过程 1、接口类 2、普通类继承接口 3、ProxyInvocationHandler.java(固定格式) 4、应用类 二、案例 public interface User { void add(); void delete(); void update(); vo
阅读全文
摘要:官网:https://docs.spring.io/spring/docs/5.2.7.RELEASE/spring-framework-reference/core.html#beans-java javaConfig
阅读全文
摘要:一、环境 1、导入包 maven 2、xml配置文件 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.
阅读全文
摘要:官网:https://docs.spring.io/spring/docs/5.2.7.RELEASE/spring-framework-reference/core.html#beans-annotation-config 1、导入约束 2、配置注解支持 <?xml version="1.0" e
阅读全文
摘要:两种方式 byName:自动查找容器上下文,set方法名 与 bean id 名相同 byType: 自动查找容器上下文, class名称与类名相同 案例 人有猫和狗 1、pojo cat.java package com.wt.pojo; public class Cat { public voi
阅读全文
摘要:ScopeDescription singleton (Default) Scopes a single bean definition to a single object instance for each Spring IoC container. prototype Scopes a sin
阅读全文
摘要:1、官网 https://docs.spring.io/spring/docs/5.2.7.RELEASE/spring-framework-reference/core.html#beans-dependencies 2、构造器注入(前面有) 3、Set方式注入(重点) A、依赖 : bean对象
阅读全文
摘要:1、别名 <alias name="" alias=""/> name 原名 alias 别名 2、beans <bean id="teacher" class="com.wt.pojo.Teacher" name="t1 t2"> id 在IOC容器的名称, class 对应的类, name 对应
阅读全文
摘要:一、无参构造函数 <bean id="user" class="com.wt.pojo.User"> <property name="name" value="tom"/> </bean> 二、含参构造函数 1、通过 name 键值对 <bean id="teacher" class="com.wt
阅读全文
摘要:IOC: 由spring 进行创建、管理、配置 官网:https://docs.spring.io/spring/docs/5.2.7.RELEASE/spring-framework-reference/core.html#beans-child-bean-definitions 一个简单的例子
阅读全文
摘要:https://docs.spring.io/spring/docs/5.2.7.RELEASE/spring-framework-reference/core.html#spring-core IOC:控制反转 理解: 原本一个程序的控制权在程序员手中,用户修改功能需要程序员修改 IOC用户现在本
阅读全文
摘要:一、网址 文档: https://spring.io/projects/spring-framework 资源下载: https://repo.spring.io/release/org/springframework/spring/ maven 下载 spring-webmvc spring jd
阅读全文