bean

Spring5学习(六)Spring 事务

家住魔仙堡 提交于 2020-02-27 08:27:11
Spring 事务 1. 事务 事务(Transaction),一般是指要做的或所做的事情。在计算机术语中是指访问并可能更新数据库中各种数据项的一个程序执行单元(unit)。事务通常由高级数据库操纵语言或编程语言(如SQL,C++或Java)书写的用户程序的执行所引起,并用形如begin transaction和end transaction语句(或函数调用)来界定。事务由事务开始(begin transaction)和事务结束(end transaction)之间执行的全体操作组成。 事务是恢复和 并发控制 的基本单位。 2. 为什么要事务 事务是为解决数据安全操作提出的,事务控制实际上就是控制数据的安全访问。 3. 事务的4个特性(ACID) 事务应该具有4个属性:原子性、一致性、隔离性、持久性。这四个属性通常称为 ACID特性 。 原子性(atomicity)。一个事务是一个不可分割的工作单位,事务中包括的操作要么都做,要么都不做。 一致性(consistency)。事务必须是使数据库从一个一致性状态变到另一个一致性状态。一致性与原子性是密切相关的。 隔离性(isolation)。一个事务的执行不能被其他事务干扰。即一个事务内部的操作及使用的数据对并发的其他事务是隔离的,并发执行的各个事务之间不能互相干扰。 持久性(durability)。指一个事务一旦提交

吴裕雄--天生自然轻量级JAVA EE企业应用开发Struts2Sping4Hibernate整合开发学习笔记:Spring_AppConfig

浪子不回头ぞ 提交于 2020-02-27 07:19:24
<?xml version="1.0" encoding="GBK"?> <project name="spring" basedir="." default=""> <property name="src" value="src"/> <property name="dest" value="classes"/> <path id="classpath"> <fileset dir="../../lib"> <include name="**/*.jar"/> </fileset> <pathelement path="${dest}"/> </path> <target name="compile" description="Compile all source code"> <delete dir="${dest}"/> <mkdir dir="${dest}"/> <copy todir="${dest}"> <fileset dir="${src}"> <exclude name="**/*.java"/> </fileset> </copy> <javac destdir="${dest}" debug="true" includeantruntime="yes" deprecation="false" optimize="false" failonerror=

吴裕雄--天生自然轻量级JAVA EE企业应用开发Struts2Sping4Hibernate整合开发学习笔记:Spring_instanceFactory

房东的猫 提交于 2020-02-27 07:19:09
<?xml version="1.0" encoding="GBK"?> <project name="spring" basedir="." default=""> <property name="src" value="src"/> <property name="dest" value="classes"/> <path id="classpath"> <fileset dir="../../lib"> <include name="**/*.jar"/> </fileset> <pathelement path="${dest}"/> </path> <target name="compile" description="Compile all source code"> <delete dir="${dest}"/> <mkdir dir="${dest}"/> <copy todir="${dest}"> <fileset dir="${src}"> <exclude name="**/*.java"/> </fileset> </copy> <javac destdir="${dest}" debug="true" includeantruntime="yes" deprecation="false" optimize="false" failonerror=

吴裕雄--天生自然轻量级JAVA EE企业应用开发Struts2Sping4Hibernate整合开发学习笔记:Spring_scope

不羁岁月 提交于 2020-02-27 07:18:55
<?xml version="1.0" encoding="GBK"?> <project name="spring" basedir="." default=""> <property name="src" value="src"/> <property name="dest" value="classes"/> <path id="classpath"> <fileset dir="../../lib"> <include name="**/*.jar"/> </fileset> <pathelement path="${dest}"/> </path> <target name="compile" description="Compile all source code"> <delete dir="${dest}"/> <mkdir dir="${dest}"/> <copy todir="${dest}"> <fileset dir="${src}"> <exclude name="**/*.java"/> </fileset> </copy> <javac destdir="${dest}" debug="true" includeantruntime="yes" deprecation="false" optimize="false" failonerror=

吴裕雄--天生自然轻量级JAVA EE企业应用开发Struts2Sping4Hibernate整合开发学习笔记:Spring_myspring

不问归期 提交于 2020-02-27 07:18:46
<?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="src"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/common-logging"/> <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Sprin4.0.4"/> <classpathentry kind="output" path="bin"/> </classpath> <?xml version="1.0" encoding="UTF-8"?> <projectDescription> <name>myspring</name> <comment></comment> <projects> </projects> <buildSpec> <buildCommand> <name>org.eclipse.jdt.core.javabuilder</name> <arguments> </arguments

吴裕雄--天生自然轻量级JAVA EE企业应用开发Struts2Sping4Hibernate整合开发学习笔记:Spring_springQs

帅比萌擦擦* 提交于 2020-02-27 07:18:10
<?xml version="1.0" encoding="GBK"?> <project name="spring" basedir="." default=""> <property name="src" value="src"/> <property name="dest" value="classes"/> <path id="classpath"> <fileset dir="../../lib"> <include name="**/*.jar"/> </fileset> <pathelement path="${dest}"/> </path> <target name="compile" description="Compile all source code"> <delete dir="${dest}"/> <mkdir dir="${dest}"/> <copy todir="${dest}"> <fileset dir="${src}"> <exclude name="**/*.java"/> </fileset> </copy> <javac destdir="${dest}" debug="true" includeantruntime="yes" deprecation="false" optimize="false" failonerror=

吴裕雄--天生自然轻量级JAVA EE企业应用开发Struts2Sping4Hibernate整合开发学习笔记:Spring_ApplicationContextAware

南笙酒味 提交于 2020-02-27 07:17:09
<?xml version="1.0" encoding="GBK"?> <project name="spring" basedir="." default=""> <property name="src" value="src"/> <property name="dest" value="classes"/> <path id="classpath"> <fileset dir="../../lib"> <include name="**/*.jar"/> </fileset> <pathelement path="${dest}"/> </path> <target name="compile" description="Compile all source code"> <delete dir="${dest}"/> <mkdir dir="${dest}"/> <copy todir="${dest}"> <fileset dir="${src}"> <exclude name="**/*.java"/> </fileset> </copy> <javac destdir="${dest}" debug="true" includeantruntime="yes" deprecation="false" optimize="false" failonerror=

实例化Bean

孤街浪徒 提交于 2020-02-27 07:03:55
/** * 一个简单的Beans工厂,实例化具体的Bean */ public class BeansFactory { private ConcurrentHashMap<String, Object> singletonObjects = new ConcurrentHashMap<>(); private ConcurrentHashMap<String, BeanDefinition> beanDefinitions = new ConcurrentHashMap<>(); @VisibleForTesting protected Object createBean(BeanDefinition beanDefinition) { // 类对象的实例 Object bean = null; try { // 根据字符串得到类 Class beanClass = Class.forName(beanDefinition.getClassName()); List<BeanDefinition.ConstructorArg> args = beanDefinition.getConstructorArgs(); if (args.isEmpty()) { bean = beanClass.newInstance(); } else { Class[] argClasses =

蚂蚁金服研发框架总览 | SOFABoot 框架剖析

前提是你 提交于 2020-02-27 07:02:16
SOFA Stack( S calable O pen F inancial A rchitecture Stack)是蚂蚁金服自主研发的金融级云原生架构,包含了构建金融级云原生架构所需的各个组件,是在金融场景里锤炼出来的最佳实践。 本文为《剖析 | SOFABoot 框架》第一篇,本篇作者纶珥,来自蚂蚁金服。《剖析 | SOFABoot 框架》系列由 SOFA 团队和源码爱好者们出品,项目代号: SOFA:BootLab/ ,文章尾部有参与方式,欢迎同样对源码热情的你加入。 SOFABoot 是蚂蚁金服开源的基于 SpringBoot 的研发框架,提供了诸如 Readiness Check、类隔离、日志空间隔离等能力,用于快速、敏捷地开发 Spring 应用程序,特别适合构建微服务系统。 SpringBoot 基于 Spring 的按条件配置(Conditional Configuration),结合 starter 依赖机制提供了快捷、方便开发 Spring 项目的体验,获得了极大的成功; SOFABoot 同样在这两个能力上基于 SpringBoot 扩展出适应于金融级应用开发框架。作为脱胎于蚂蚁金服内部对于 SpringBoot 的实践,SOFABoot 补充了 SpringBoot 在大规模金融级生产场景下一些不足的地方,例如 Readiness 检查

spring bean生命周期管理--转

不打扰是莪最后的温柔 提交于 2020-02-27 05:43:31
Life Cycle Management of a Spring Bean 原文地址:http://javabeat.net/life-cycle-management-of-a-spring-bean/ 1) Introduction This article would brief about how a Spring Bean is managed in IOC (Inversion of Control) Container . Spring Beans exist within the Container as long as they are needed by the Application. There are various life-cycle interfaces and methods that will be called by the IOC Container. The pre-requisite for this article is some basic knowledge in Spring which can be got by reading the article in Javabeat Introduction to Spring Web Framework . 2) Bean Life Cycle A Spring Bean