spring事物

  • spring事物
    • 引言
    • spring中的事物
      • 总结
    • spring事物原理
      • @Transaction
      • 事物的传播行为
      • 事物回滚
      • 总结
    • 类的调用图

引言

事物是一种概念,可以将一些分散的操作划分成一组原子性操作,要么全部成功,要么全部失败。常见的例子有银行转账操作。

事物具有4种性质(ACID)

  • 原子性(atomicity):强调事务的不可分割.
  • 一致性(consistency):事务的执行的前后数据的完整性保持一致.
  • 隔离性(isolation):一个事务执行的过程中,不应该受到其他事务的干扰.
  • 持久性(durability) :事务一旦结束,数据就被修改.

日常只知事物完成的工作却不知其原理,本文详细介绍下spring事物的原理。

spring中的声明式事物

spring中也有事物,通常我们使用@Transaction注解来标注我们需要事物的方法

/*** @author Mcj* @date 2020-01-15 20:11*/@RestController
@RequestMapping("/student")
public class StudentController {@AutowiredStudentService studentService;/*** 添加一个学生* @return 200*/@GetMappingpublic ResponseEntity addStudent() {Student student = new Student();student.setName("孙亚龙");student.setAge(666);student.setNum(0);studentService.addStudent(student);return ResponseEntity.ok(200);}
}
@Service
public class StudentServiceImpl implements StudentService {@Autowiredprivate StudentDao studentDao;/*** 添加一个学生** @param student 学生*/@Override@Transactional(rollbackFor = IOException.class)public void addStudent(Student student) {studentDao.save(student);}@Overridepublic Student findStudentByName(String name) {return studentDao.findAllByNameEquals(name).get(0);}
}
@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
public class Student {@Id@GeneratedValueprivate Integer id;/*** 学生姓名*/private String name;/*** 学生年龄*/private Integer age;/*** 学生完成的工作数量*/private Integer num;public Student(String name) {this.name = name;}public Student(Integer age) {this.age = age;}
}

当我们访问http接口之后会在数据库中保存一个学生,但是我们在这里打印一个1/0,这里应该会报出by zero的异常并且数据库不会保存

@Service
@Transactional
public class StudentServiceImpl implements StudentService {@Autowiredprivate StudentDao studentDao;/*** 添加一个学生* @param student 学生*/@Overridepublic void addStudent(Student student) {studentDao.save(student);System.out.println(1/0);}
}

总结

本章讲解了日常使用spring事物时遇到的现象,当出现错误时,@Transaction事物配置发生了作用,如果没有配置声明式事物则数据库内会新增一条数据然后再报出异常。

spring事物原理

spring声明式事物原理是利用aop、动态代理技术在目标方法被执行之前拦截住,执行一些增强逻辑。

利用与数据库的Connection对象进行提交或者会滚操作

同时利用了ThreadLocal对象,将当前数据库连接绑定到当前线程中来保证每次对数据库的操作都是同一条连接。

  • 数据库实现了事物功能
#当student表存储引擎为myisam时,执行以下语句则会直接保存,但是当存储引擎为innodb时,并不会保存。所以是否有事物功能与数据库表有关。
BEGIN;
INSERT INTO student (id,age,name) VALUES(10,666,'吴奇隆');
SELECT * from student;

innodb与myisam引擎区别,对事物的支持

  • spring事物管理并不直接管理事物,而是定义接口供相关平台实现,spring事物核心接口是PlatformTransactionManager,接口定义了commit()rollback()方法,PlatformTransactionManager接口实现类中有JpaTransactionManager类。同时跟踪JpaTransactionManagerdoCommit()方法,最终是jdbc操作connection来完成事物提交。

@Transaction原理

自定义的dao接口继承的JpaRepository接口,此接口的默认实现SimpleJpaRepository类也有声明式事物注解@Transaction

public interface StudentDao extends JpaRepository<Student,Integer>
@Repository
@Transactional(readOnly = true)
public class SimpleJpaRepository<T, ID> implements JpaRepositoryImplementation<T, ID> {

在studentservice中也写了这个注解

@Service
@Transactional
public class StudentServiceImpl implements StudentService {

在第一章的例子中也是写了这个注解而让sql语句没有提交。

注解只是一个标志,在项目启动时SpringTransactionAnnotationParser#parseTransactionAnnotation()类已经扫描并且获取注解上配置的属性并且注册事物拦截器。

@Override
@Nullable
public TransactionAttribute parseTransactionAnnotation(AnnotatedElement element) {//获取配置的属性AnnotationAttributes attributes = AnnotatedElementUtils.findMergedAnnotationAttributes(element, Transactional.class, false, false);if (attributes != null) {return parseTransactionAnnotation(attributes);}else {return null;}
}

spring为标记了@Transactional注解的类或者方法利用aop创建动态代理对象在目标方法调用前后创建提交事物.

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-0cs3W8Bt-1602061137147)(拦截器.jpg)]

当某个目标类中有@Transaction注解声明过的方法时,cglib就会为目标类生成一个代理对象,StudentController中的studentservice在项目启动时是一个cglib生成的代理对象,这个代理对象有许多回调函数,DynamicAdvisedInterceptor会获取方法的拦截器链并且执行。只有代理对象调用目标方法才会执行拦截器逻辑。但是在调用目标方法时不使用代理对象而是调用使用原始bean对象调用。

步骤:StudentController中我调用了studentservice#addStudent()会进入以下逻辑

cglibAopProxy.DynamicAdvisedInterceptor

//cglib代理
public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {Object oldProxy = null;boolean setProxyContext = false;Object target = null;//获取aop的目标TargetSource targetSource = this.advised.getTargetSource();try {if (this.advised.exposeProxy) {// Make invocation available if necessary.oldProxy = AopContext.setCurrentProxy(proxy);setProxyContext = true;}// Get as late as possible to minimize the time we "own" the target, in case it comes from a pool...//获取了StudentServiceImpl对象(目标bean)target = targetSource.getTarget();//获取class对象Class<?> targetClass = (target != null ? target.getClass() : null);//获取拦截器链,配置的before、after等就是一个个拦截器,addStudent方法只配置了一个拦截器就是TransactionintercrptList<Object> chain = this.advised.getInterceptorsAndDynamicInterceptionAdvice(method, targetClass);Object retVal;// Check whether we only have one InvokerInterceptor: that is,// no real advice, but just reflective invocation of the target.if (chain.isEmpty() && Modifier.isPublic(method.getModifiers())) {// We can skip creating a MethodInvocation: just invoke the target directly.// Note that the final invoker must be an InvokerInterceptor, so we know// it does nothing but a reflective operation on the target, and no hot// swapping or fancy proxying.Object[] argsToUse = AopProxyUtils.adaptArgumentsIfNecessary(method, args);retVal = methodProxy.invoke(target, argsToUse);}else {// We need to create a method invocation...//将参数传入cglib类方法调用类,要开始进行目标方法的调用//proxy:StudentServiceImpl$ 代理对象//target:StudentServiceImpl@9574 目标类Object对象//method:addstudent//args:方法参数//targetclass:目标对象类型Class类//chain:拦截器链//methodProxy:方法代理类retVal = new CglibMethodInvocation(proxy, target, method, args, targetClass, chain, methodProxy).//调用拦截器逻辑proceed();}retVal = processReturnType(proxy, target, method, retVal);return retVal;}finally {if (target != null && !targetSource.isStatic()) {targetSource.releaseTarget(target);}if (setProxyContext) {// Restore old proxy.AopContext.setCurrentProxy(oldProxy);}}
}

ReflectiveMethodInvocation

@Override
@Nullable
public Object proceed() throws Throwable {// We start with an index of -1 and increment early.//查看当前拦截器是否是最后一个拦截器了。如果后面没有拦截器了则执行目标方法if (this.currentInterceptorIndex == this.interceptorsAndDynamicMethodMatchers.size() - 1) {//连接点,拦截的方法,addstudent();return invokeJoinpoint();}//获取拦截器对象
Object interceptorOrInterceptionAdvice =this.interceptorsAndDynamicMethodMatchers.get(++this.currentInterceptorIndex);if (interceptorOrInterceptionAdvice instanceof InterceptorAndDynamicMethodMatcher) {// Evaluate dynamic method matcher here: static part will already have// been evaluated and found to match.InterceptorAndDynamicMethodMatcher dm =(InterceptorAndDynamicMethodMatcher) interceptorOrInterceptionAdvice;Class<?> targetClass = (this.targetClass != null ? this.targetClass : this.method.getDeclaringClass());if (dm.methodMatcher.matches(this.method, targetClass, this.arguments)) {return dm.interceptor.invoke(this);}else {// Dynamic matching failed.// Skip this interceptor and invoke the next in the chain.return proceed();}}else {// It's an interceptor, so we just invoke it: The pointcut will have// been evaluated statically before this object was constructed.//调用拦截器逻辑 ,现在只有一个拦截器transactioninterceptreturn ((MethodInterceptor) interceptorOrInterceptionAdvice).invoke(this);}
}

transactioninterceptor

@Override
@Nullable
public Object invoke(MethodInvocation invocation) throws Throwable {// Work out the target class: may be {@code null}.// The TransactionAttributeSource should be passed the target class// as well as the method, which may be from an interface.Class<?> targetClass = (invocation.getThis() != null ? AopUtils.getTargetClass(invocation.getThis()) : null);// Adapt to TransactionAspectSupport's invokeWithinTransaction...//调用拦截器逻辑return invokeWithinTransaction(invocation.getMethod(), targetClass, invocation::proceed);
}

TransactionAspectSupport

@Nullable
protected Object invokeWithinTransaction(Method method, @Nullable Class<?> targetClass,final InvocationCallback invocation) throws Throwable {// If the transaction attribute is null, the method is non-transactional.TransactionAttributeSource tas = getTransactionAttributeSource();//获取事物属性txAttr//txAttr , PROPAGATION_REQUIRED事物传播行为,事物的隔离级别final TransactionAttribute txAttr = (tas != null ? tas.getTransactionAttribute(method, targetClass) : null);//获取事物管理器 此处为JpaTractionManagerfinal PlatformTransactionManager tm = determineTransactionManager(txAttr);//获取方法连接点 此处为addStudentfinal String joinpointIdentification = methodIdentification(method, targetClass, txAttr);if (txAttr == null || !(tm instanceof CallbackPreferringPlatformTransactionManager)) {// Standard transaction demarcation with getTransaction and commit/rollback calls.//创建一个事物基本信息对象,里面有事物管理器、事物传播行为、事物隔离级别、动态代理方法连接点、事物状态(是否新事物、是否只读、保存点等信息),并开启事物,返回对象(下面会解释这个方法内做了什么)//***重点TransactionInfo txInfo = createTransactionIfNecessary(tm, txAttr, joinpointIdentification);Object retVal;try {// This is an around advice: Invoke the next interceptor in the chain.// This will normally result in a target object being invoked.//执行下一个拦截器方法retVal = invocation.proceedWithInvocation();}catch (Throwable ex) {// target invocation exceptioncompleteTransactionAfterThrowing(txInfo, ex);throw ex;}finally {//清除当前线程的事物信息cleanupTransactionInfo(txInfo);}//调用JpaTransationManager的doCommit()方法提交事物commitTransactionAfterReturning(txInfo);return retVal;}

###createTransactionIfNecessary

@SuppressWarnings("serial")
protected TransactionInfo createTransactionIfNecessary(@Nullable PlatformTransactionManager tm,@Nullable TransactionAttribute txAttr, final String joinpointIdentification) {// If no name specified, apply method identification as transaction name.if (txAttr != null && txAttr.getName() == null) {txAttr = new DelegatingTransactionAttribute(txAttr) {@Overridepublic String getName() {return joinpointIdentification;}};}TransactionStatus status = null;if (txAttr != null) {if (tm != null) {//开启事物并且获取事物状态status = tm.getTransaction(txAttr);}else {if (logger.isDebugEnabled()) {logger.debug("Skipping transactional joinpoint [" + joinpointIdentification +"] because no transaction manager has been configured");}}}//封装事物对象属性,并且将事物绑定到本地线程中return prepareTransactionInfo(tm, txAttr, joinpointIdentification, status);
}

AbstractPlatformTransactionManager

//---------------------------------------------------------------------
// Implementation of PlatformTransactionManager
//---------------------------------------------------------------------/*** This implementation handles propagation behavior. Delegates to* {@code doGetTransaction}, {@code isExistingTransaction}* and {@code doBegin}.* @see #doGetTransaction* @see #isExistingTransaction* @see #doBegin*/
@Override
public final TransactionStatus getTransaction(@Nullable TransactionDefinition definition) throws TransactionException {//获取事物对象,返回jpatransactionManager类中的JpaTransactionObject对象Object transaction = doGetTransaction();// Cache debug flag to avoid repeated checks.boolean debugEnabled = logger.isDebugEnabled();if (definition == null) {// Use defaults if no transaction definition given.definition = new DefaultTransactionDefinition();}if (isExistingTransaction(transaction)) {// Existing transaction found -> check propagation behavior to find out how to behave.return handleExistingTransaction(definition, transaction, debugEnabled);}// Check definition settings for new transaction.if (definition.getTimeout() < TransactionDefinition.TIMEOUT_DEFAULT) {throw new InvalidTimeoutException("Invalid transaction timeout", definition.getTimeout());}// No existing transaction found -> check propagation behavior to find out how to proceed.if (definition.getPropagationBehavior() == TransactionDefinition.PROPAGATION_MANDATORY) {throw new IllegalTransactionStateException("No existing transaction found for transaction marked with propagation 'mandatory'");}else if (definition.getPropagationBehavior() == TransactionDefinition.PROPAGATION_REQUIRED ||definition.getPropagationBehavior() == TransactionDefinition.PROPAGATION_REQUIRES_NEW ||definition.getPropagationBehavior() == TransactionDefinition.PROPAGATION_NESTED) {SuspendedResourcesHolder suspendedResources = suspend(null);if (debugEnabled) {logger.debug("Creating new transaction with name [" + definition.getName() + "]: " + definition);}try {boolean newSynchronization = (getTransactionSynchronization() != SYNCHRONIZATION_NEVER);DefaultTransactionStatus status = newTransactionStatus(definition, transaction, true, newSynchronization, debugEnabled, suspendedResources);//调用事物管理器的begin方法,事物开启,将自动提交设置为false,并且将获取的链接绑定到当前线程上doBegin(transaction, definition);prepareSynchronization(status, definition);return status;}catch (RuntimeException | Error ex) {resume(null, suspendedResources);throw ex;}}else {// Create "empty" transaction: no actual transaction, but potentially synchronization.if (definition.getIsolationLevel() != TransactionDefinition.ISOLATION_DEFAULT && logger.isWarnEnabled()) {logger.warn("Custom isolation level specified but no actual transaction initiated; " +"isolation level will effectively be ignored: " + definition);}boolean newSynchronization = (getTransactionSynchronization() == SYNCHRONIZATION_ALWAYS);return prepareTransactionStatus(definition, null, true, newSynchronization, debugEnabled, null);}
}

执行拦截的方法了,回到TransactionAspectSupport方法中

try {// This is an around advice: Invoke the next interceptor in the chain.// This will normally result in a target object being invoked.//执行动态代理的目标方法retVal = invocation.proceedWithInvocation();}

由于只有一个transactionintercept拦截器

public Object proceed() throws Throwable {// We start with an index of -1 and increment early.//查看当前是否还有拦截器需要执行,如果已经是最后一个拦截器则执行目标方法if (this.currentInterceptorIndex == this.interceptorsAndDynamicMethodMatchers.size() - 1) {//执行addstudent方法return invokeJoinpoint();}

所以执行joinpoint,就是写上注解的那个方法addStudent();

此时不调用jpa的话,执行commitTransactionAfterReturning方法,事物就结束了。


但是addStudent()方法内调用了jpa的save()方法。

jpa内又配置了10个拦截器,并且jpa是jdk动态代理的

  • JdkDynamicAopProxy
@Override
@Nullable
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {Object oldProxy = null;boolean setProxyContext = false;TargetSource targetSource = this.advised.targetSource;Object target = null;try {if (!this.equalsDefined && AopUtils.isEqualsMethod(method)) {// The target does not implement the equals(Object) method itself.return equals(args[0]);}else if (!this.hashCodeDefined && AopUtils.isHashCodeMethod(method)) {// The target does not implement the hashCode() method itself.return hashCode();}else if (method.getDeclaringClass() == DecoratingProxy.class) {// There is only getDecoratedClass() declared -> dispatch to proxy config.return AopProxyUtils.ultimateTargetClass(this.advised);}else if (!this.advised.opaque && method.getDeclaringClass().isInterface() &&method.getDeclaringClass().isAssignableFrom(Advised.class)) {// Service invocations on ProxyConfig with the proxy config...return AopUtils.invokeJoinpointUsingReflection(this.advised, method, args);}Object retVal;if (this.advised.exposeProxy) {// Make invocation available if necessary.oldProxy = AopContext.setCurrentProxy(proxy);setProxyContext = true;}// Get as late as possible to minimize the time we "own" the target,// in case it comes from a pool.target = targetSource.getTarget();Class<?> targetClass = (target != null ? target.getClass() : null);// Get the interception chain for this method.//获取拦截器链List<Object> chain = this.advised.getInterceptorsAndDynamicInterceptionAdvice(method, targetClass);// Check whether we have any advice. If we don't, we can fallback on direct// reflective invocation of the target, and avoid creating a MethodInvocation.if (chain.isEmpty()) {// We can skip creating a MethodInvocation: just invoke the target directly// Note that the final invoker must be an InvokerInterceptor so we know it does// nothing but a reflective operation on the target, and no hot swapping or fancy proxying.Object[] argsToUse = AopProxyUtils.adaptArgumentsIfNecessary(method, args);retVal = AopUtils.invokeJoinpointUsingReflection(target, method, argsToUse);}else {// We need to create a method invocation...MethodInvocation invocation =new ReflectiveMethodInvocation(proxy, target, method, args, targetClass, chain);// Proceed to the joinpoint through the interceptor chain.//调用拦截器逻辑,并且跳到下一个拦截器retVal = invocation.proceed();}

10个拦截器按照上面的方式顺序调用。

jpa配置的拦截器中同样有transactioninterceptor,同样会createTransactionIfNecessary创建事物,这时候方法返回值是TransactionInfo对象,这个对象保存着外层的事物信息,如addstudent的事物信息,这个对象是用链表结构保存嵌套事物的。

jpa拦截器执行完毕需要提交数据时会调用commitTransactionAfterReturning方法,

/*** Execute after successful completion of call, but not after an exception was handled.* Do nothing if we didn't create a transaction.* @param txInfo information about the current transaction*/
protected void commitTransactionAfterReturning(@Nullable TransactionInfo txInfo) {if (txInfo != null && txInfo.getTransactionStatus() != null) {if (logger.isTraceEnabled()) {logger.trace("Completing transaction for [" + txInfo.getJoinpointIdentification() + "]");}//配置的是jpatransactionmanager方法的commit。最终跟踪下去是connection的commit方法txInfo.getTransactionManager().commit(txInfo.getTransactionStatus());}
}

AbstractPlatformTransactionManager

//提交时会判断是否是新事物,jpa的save方法不是最外层事物,addStudent方法是最外层事物
else if (status.isNewTransaction()) {if (status.isDebug()) {logger.debug("Initiating transaction commit");}unexpectedRollback = status.isGlobalRollbackOnly();//执行提交方法doCommit(status);
}

内部jpa的事物结束后,再提交addStudent的事物,提交完成后事物才算结束。

至此事物提交成功。

利用springaop自定义事物

根据动态代理的方法自定义一个事物处理机制
定义注解

/*** @author mcj*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface McjTransaction {
}

定义注解解释类

@Aspect
@Configuration
@Slf4j
public class CglibConfig {@AutowiredPlatformTransactionManager jpaTransactionManager;@AutowiredTransactionDefinition transactionDefinition;/* 定义一个切入点 */@Pointcut("@annotation(com.springboot.transactiondemo.annotation.McjTransaction)")public void doPointCut() {}@Before("doPointCut()")public void before(JoinPoint joinPoint) {log.info("PersonAspect ==> before method : {}", joinPoint.getSignature().getName());log.info("注解的类型名称为{}",joinPoint.getSignature().getDeclaringTypeName());log.info("方法修饰符个数为{}",joinPoint.getSignature().getModifiers());log.info("方法名称为{}",joinPoint.getSignature().getName());}@After("doPointCut()")public void after(JoinPoint joinPoint) throws FileNotFoundException {log.info("PersonAspect ==> after method : {}", joinPoint.getSignature().getName());}@Around("doPointCut()")public void aroundMethod(ProceedingJoinPoint point)  {TransactionStatus transaction = jpaTransactionManager.getTransaction(new DefaultTransactionAttribute());point.proceed();jpaTransactionManager.commit(transaction);}
}

最后将注解替换

    /*** 添加一个学生** @param student 学生*/@Override@McjTransactionpublic void addStudent(Student student) {studentDao.save(student);}

还可以自定义一个transactionManager

@Component("mcjtrans")
public class McjTransactionManager implements PlatformTransactionManager {@AutowiredJdbcUtil jdbcUtil;@Overridepublic TransactionStatus getTransaction(TransactionDefinition definition) throws TransactionException {return new SimpleTransactionStatus();}@Overridepublic void commit(TransactionStatus status) throws TransactionException {try {jdbcUtil.getConnectionThreadLocal().commit();} catch (SQLException e) {e.printStackTrace();}}@Overridepublic void rollback(TransactionStatus status) throws TransactionException {try {jdbcUtil.getConnectionThreadLocal().rollback();} catch (SQLException e) {e.printStackTrace();}}
}

不用jpa后我选择使用jdbc

@Component
public class JdbcUtil {@Autowiredprivate JdbcTemplate jdbcTemplate;private ThreadLocal<Connection> t = new ThreadLocal<Connection>();public Connection getConnectionThreadLocal() {if (t.get() == null) {try {Connection connection = jdbcTemplate.getDataSource().getConnection();connection.setAutoCommit(false);t.set(connection);} catch (SQLException e) {e.printStackTrace();}}else{return t.get();}return t.get();}public void removeConnection(){try {t.get().close();} catch (SQLException e) {e.printStackTrace();}t.remove();}
}

定义一个自己的dao

@Service
public class McjStudentDao {@Autowiredprivate JdbcUtil jdbcUtil;@McjTransactionpublic void save(Student student){String format = String.format("insert into student (id,age,name,num) VALUES (null,'%s','%s','55')",student.getAge(),student.getName());Connection connectionThreadLocal = jdbcUtil.getConnectionThreadLocal();try {Statement statement = connectionThreadLocal.createStatement();statement.execute(format);} catch (SQLException e) {e.printStackTrace();}};
}

运行程序发送http请求,数据库中保存了一条记录。

事物的传播行为

原本每个事物都是独立的互相不干扰的,于是通过配置事物的传播行为将不相关的操作变成了原子性的操作。事物的传播行为是指定了当有两个事物时是否需要回滚的问题

  • PROPAGATION_REQUIRED
    如果当前存在事物则加入该事物,不存在事物则新建事物(默认的事物机制),finishWork方法产生异常,数据库中任务没有被接下,两个方法都回滚

  • PAOPAGATION_REQUIRE_NEW

    若当前没有事务,则新建一个事务。若当前存在事务,则新建一个事务,新老事务相互独立。外部事务抛出异常回滚不会影响内部事务的正常提交,执行完成后数据库内有4个学生

  • PROPAGATION_SUPPORTS

    如果存在一个事务,支持当前事务。如果没有事务,则非事务的执行,运行完成后添加了5个学生

  • PROPAGATION_MANDATORY

    如果已经存在一个事务,支持当前事务。如果没有一个活动的事务,则抛出异常。

  • PROPAGATION_NOT_SUPPORTED

    总是非事务地执行,并挂起任何存在的事务。数据库中有5名学生

  • PROPAGATION_NEVER

    总是非事务地执行,如果存在一个活动事务,则抛出异常。

  • PROPAGATION_NESTED

    内部事物抛出异常没被捕获则会影响外部事物会滚,与required区别是对外部事物的依赖

事物回滚

由sql语句看起来最为直观,前提是需要mysql数据库表引擎为innodb

#设置保存点,创建一个存档
SAVEPOINT point;
#执行insert语句
insert into student (id,name) VALUES (15,'吴彦祖');
select * from student;#返回到保存点,回档
ROLLBACK to point;
select * from student;#提交事物
COMMIT;

事物中出现异常如果被捕获了则不会回滚,默认运行时异常全部会回滚,非运行时异常不回滚,但是可以配置

spring事物中的事物回滚是利用了savepoint,在事物中配置了savepoint

@Transactional(rollbackFor = Exception.class)

总结

spring事物利用动态代理的方式,生成代理对象,在代理对象调用拦截器逻辑(transactioninterceptor)在方法前后增强,然后使用原始对象调用目标方法完成事物调用。

数据库实现了事物的功能,spring不直接操作数据库,而是让各大持久化平台实现这些与数据库事物打交道的方法,spring使用实现好的接口可以用在自己的框架中,通过事物的传播行为将一组方法组合成原子性操作。嵌套事物信息利用链表存储。

spring事物的管理,spring有一个默认主数据源,与一个默认主数据源的事物管理器(一个数据源一个事物管理器).同时transaction注解只对这个数据源管理器起作用.

流程图

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-UmrOxZ8C-1602061137157)(事物流程.jpg)]

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-brRZH9Do-1602061137159)(代理.jpg)]

查看全文
如若内容造成侵权/违法违规/事实不符,请联系编程学习网邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!

相关文章

  1. 世界级热门交易所火币新增存储币板块 PFS Filecoin挖矿大势所趋

    又见IPFS实力加持&#xff01; 近期&#xff0c;Filecoin热度持续攀升。临近主网上线&#xff0c;火币APP新增存储币板块&#xff0c;并且在首页各广告位进行大规模宣发&#xff0c;此举为Filecoin的上线提前预热。 存储可以说是区块链最好的落地应用场景之一&#xff0c;也…...

    2024/4/9 8:50:15
  2. 代码中特殊空格处理

    背景&#xff1a;一家供应商打出二维码&#xff0c;经扫码解析后&#xff0c;发现空格有问题&#xff0c;微信扫出的有问题&#xff0c;支付宝扫出的就没问题&#xff0c;不知道啥原因&#xff0c;上网上找些资料&#xff0c;还真是出乎意料。 三种空格unicode(\u00A0,\u0020,…...

    2024/4/9 7:50:22
  3. Pynq调试AXI UART接口

    Pynq将IP的操作封装的很好&#xff0c;但是也隐藏了很多细节 Pynq的Base.bit在PL生成了MicroBlaze&#xff0c;这个处理器帮助我们操作了GPIO、UART、IIC等外设&#xff0c;但是在测试时PL无法同时加载两个bit流文件&#xff0c;那么自定义的设计无法和Base.bit中定义的外设同…...

    2024/4/8 16:43:06
  4. nodejs处理图片的模块nimg

    地址&#xff1a;https://github.com/qcdong2016/nimg nodejs已经有很多不错的图片处理模块了。但几乎都是异步的&#xff0c;而且api也不太容易理解。所以我基于Magick封装了这个模块。所有函数都是同步的&#xff0c;api也尽量简单直白&#xff0c;写一些小脚本比较方便。 …...

    2024/4/9 14:15:47
  5. CSDN如何改变图片大小

    1. 粘贴后在pic_center 400x100直接设置 ![在这里插入图片描述](https://img-blog.csdnimg.cn/2020100814312859.png ?x-oss-processimage/watermark, type_ZmFuZ3poZW5naGVpdGk,shadow_10, text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQxMTIyMTcz, size_5,color_FFFFFF,t_70#pi…...

    2024/4/8 17:50:41
  6. Numpy入门(十一):np.std()用法

    点击跳转 《Numpy入门系列目录》 numpy.std(a, axisNone, dtypeNone, outNone, ddof0) a&#xff1a; array_like&#xff0c;需计算标准差的数组axis&#xff1a; int, 可选&#xff0c;计算标准差的轴。默认情况是计算扁平数组的标准偏差。dtype&#xff1a; dtype, 可选&…...

    2024/4/8 15:18:36
  7. 使用keil及proteus实现数码管循环显示“0“-“F“

    数码管循环显示"0"-“F” 目录数码管循环显示"0"-"F"一、数码管循环程序的编译1.keil新建工程2.新建文本进行C语言编译3.创建hex文件二、使用proteus进行仿真一、数码管循环程序的编译 1.keil新建工程 打开project选择新建 打开ATmel&#xf…...

    2024/4/30 16:46:46
  8. 超详细的3D游戏建模步骤 |使用zbrush制作写实士兵

    本文来自NicolGranese是一名初级角色艺术家 这个概念是Louie Palu拍摄的USMC士兵的真实照片 参考 我开始收集士兵&#xff0c;装备&#xff0c;衣服和不同人脸的照片。该项目的主要目标不是创造一个相似&#xff0c;而是能够使主题尽可能逼真。所以我开始将所有东西放在一起…...

    2024/4/8 15:55:05
  9. 2020.10.07【普及组】模拟赛C组总结

    奇妙的文章目录总结T1 小x的数列&#xff08;100&#xff09;T2 小x的极限&#xff08;90&#xff09;T3 小x的字符串&#xff08;0&#xff09;T4 小x的最短路&#xff08;0&#xff09;完成情况总结 这次凉了QAQ T1 小x的数列&#xff08;100&#xff09; 题目大意&#xff…...

    2024/4/29 20:15:05
  10. 常见浏览器内核

    浏览器内核也就是浏览器所采用的渲染引擎&#xff0c;不同内核的浏览器对网页渲染效果不同&#xff0c;以下是常见的浏览器内核&#xff1a; ** Trident: IE内核&#xff0c;代表浏览器是 IE 6-10&#xff0c;部分浏览器的新版本是“双核”甚至是“多核”&#xff0c;所以IE9…...

    2024/4/9 11:53:46
  11. 卷积神经网络卷积层池化层输出计算公式

    1. 卷积层&#xff1a; 输出矩阵大小为x、输入矩阵大小为n、卷积核大小为f、步长为s、padding 填充为p x&#xff08;n-f2p&#xff09;/s 1 所得x的数值如果为小数&#xff0c;则向下取值 2.池化层: 输出矩阵大小为x1 x&#xff08;n-f&#xff09;/s 1 所得x的数值如果为小数…...

    2024/4/9 9:11:03
  12. 是不是还有人不知道?动漫建模和游戏建模到底区别在哪?

    我就是从影视转向游戏的。大三的时候干了几个月的影视外包&#xff0c;还是觉得游戏有前途&#xff0c;现在刚刚进入一家游戏公司。 影视动画布线和游戏布线还是有一定的区别哈。前者布线最主要是能符合动画原理&#xff0c;也不能出现三角面&#xff0c;这些就不说了&#xf…...

    2024/4/9 18:44:57
  13. python 中numpy不以科学计数法输出

    import numpy as np np.set_printoptions(suppressTrue)...

    2024/4/9 14:38:20
  14. python不同数据类型的深浅拷贝

    深浅拷贝 一、数字和字符串 对于 数字 和 字符串 而言&#xff0c;赋值、浅拷贝和深拷贝无实际变化&#xff0c;因为在这些操作之后&#xff0c;该数字或字符串还是指向同一个内存地址。 import copy # ######### 数字、字符串 ######### n1 123 # n1 "i am alex age…...

    2024/5/10 6:31:50
  15. Vue:v-model指令,表单数据双向绑定

    v-model官方API介绍 1.v-model 预期&#xff1a;随表单控件类型不同而不同。 使用范围&#xff1a;<input> | <select> | <textarea> | components 修饰符&#xff1a; .lazy - 取代 input 监听 change 事件 .number - 输入字符串转为有效的数字 .trim - …...

    2024/4/9 23:40:34
  16. LVS介绍及配置

    LVS 负载均衡 1.Linux Virtual Server 2.章文嵩博士主导的开源的负载均衡项目 3.LVS&#xff08;ipvs&#xff09;已被集成到Linux内核中 LVS官网地址&#xff1a;传送门 为什么要使用 LVS Nginx 1.LVS基于四层&#xff0c;工作效率高 2.单个 Nginx 承受不了压力&#xff0…...

    2024/4/9 5:39:08
  17. python爬取喜马拉雅FM雪中悍刀行整本有声小说!下次教你们爬付费!

    前言 本文的文字及图片来源于网络,仅供学习、交流使用,不具有任何商业用途,如有问题请及时联系我们以作处理。 开发工具 python 3.6.5pycharm import requests import re 相关模块可pip安装 确定网页目标 有个白狐儿脸&#xff0c;佩双刀绣冬春雷&#xff0c;要做那天下第…...

    2024/4/9 12:34:09
  18. npm包实践与常见问题

    npm发布及常见问题 引用&#xff1a;https://mp.weixin.qq.com/s/Z7mB4Z4Z6wkCJKrXFFumcQ. 记一次最近发布npm包的基本流程及遇到的问题。 注册 1、在npm官网注册 https://www.npmjs.com/2、在命令行中注册 npm adduser // 按提示输入Username、Password、Email完成注册登…...

    2024/5/7 0:53:34
  19. 简单的机票预定系统01

    这个机票预订系统是老师布置的课程作业&#xff0c;第一次写这样的项目&#xff0c;顺便记录一下自己的学习过程。本系统使用Java语言实现&#xff0c;页面布局使用了JavaSwing&#xff0c;数据库使用mysql,以及链接数据库使用的是JDBC&#xff0c;操作数据库使用的是Navicat。…...

    2024/4/25 17:30:28
  20. 使用Maven那么久了,你对企业级Maven的核心配置了解多少?

    作者个人研发的在高并发场景下&#xff0c;提供的简单、稳定、可扩展的延迟消息队列框架&#xff0c;具有精准的定时任务和延迟队列处理功能。自开源半年多以来&#xff0c;已成功为十几家中小型企业提供了精准定时调度方案&#xff0c;经受住了生产环境的考验。 为使更多童鞋…...

    2024/4/2 10:29:08

最新文章

  1. 记录汇川:ST电磁阀封装

    ...

    2024/5/10 17:50:50
  2. 梯度消失和梯度爆炸的一些处理方法

    在这里是记录一下梯度消失或梯度爆炸的一些处理技巧。全当学习总结了如有错误还请留言&#xff0c;在此感激不尽。 权重和梯度的更新公式如下&#xff1a; w w − η ⋅ ∇ w w w - \eta \cdot \nabla w ww−η⋅∇w 个人通俗的理解梯度消失就是网络模型在反向求导的时候出…...

    2024/5/9 21:23:04
  3. 随行付优化外卡收单,助力支付便利化

    解决老年人和境外游客在支付过程中遇到的问题和障碍&#xff0c;正逐渐成为整个支付行业的焦点关注词汇。 在有关提高支付服务便利度的意见发布后&#xff0c;有关收单行业的好消息不断涌现&#xff1a;中国银联于3月15日宣布投入30亿元用于升级基础设施&#xff0c;促进支付便…...

    2024/5/10 14:12:40
  4. 论文阅读AI工具链

    文献检索 可以利用智谱清言来生成合适的文献检索式&#xff0c;并根据需要不断调整。 谷歌学术 在Google Scholar中进行检索时&#xff0c;您可以使用类似的逻辑来构建您的搜索式&#xff0c;但是语法会有所不同。Google Scholar的搜索框接受普通的文本搜索&#xff0c;但是…...

    2024/5/10 0:16:27
  5. Java中的装饰器模式

    在Java中&#xff0c;装饰器模式允许我们动态地给对象添加新的行为或责任&#xff0c;而无需修改原有类。以下是一个简单的装饰器模式示例&#xff0c;我们将模拟一个咖啡销售系统&#xff0c;其中基础饮料类&#xff08;Component&#xff09;是Coffee&#xff0c;装饰器类&am…...

    2024/5/10 0:02:55
  6. 416. 分割等和子集问题(动态规划)

    题目 题解 class Solution:def canPartition(self, nums: List[int]) -> bool:# badcaseif not nums:return True# 不能被2整除if sum(nums) % 2 ! 0:return False# 状态定义&#xff1a;dp[i][j]表示当背包容量为j&#xff0c;用前i个物品是否正好可以将背包填满&#xff…...

    2024/5/10 1:36:26
  7. 【Java】ExcelWriter自适应宽度工具类(支持中文)

    工具类 import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellType; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet;/*** Excel工具类** author xiaoming* date 2023/11/17 10:40*/ public class ExcelUti…...

    2024/5/10 16:45:57
  8. Spring cloud负载均衡@LoadBalanced LoadBalancerClient

    LoadBalance vs Ribbon 由于Spring cloud2020之后移除了Ribbon&#xff0c;直接使用Spring Cloud LoadBalancer作为客户端负载均衡组件&#xff0c;我们讨论Spring负载均衡以Spring Cloud2020之后版本为主&#xff0c;学习Spring Cloud LoadBalance&#xff0c;暂不讨论Ribbon…...

    2024/5/10 16:45:56
  9. TSINGSEE青犀AI智能分析+视频监控工业园区周界安全防范方案

    一、背景需求分析 在工业产业园、化工园或生产制造园区中&#xff0c;周界防范意义重大&#xff0c;对园区的安全起到重要的作用。常规的安防方式是采用人员巡查&#xff0c;人力投入成本大而且效率低。周界一旦被破坏或入侵&#xff0c;会影响园区人员和资产安全&#xff0c;…...

    2024/5/10 2:07:45
  10. VB.net WebBrowser网页元素抓取分析方法

    在用WebBrowser编程实现网页操作自动化时&#xff0c;常要分析网页Html&#xff0c;例如网页在加载数据时&#xff0c;常会显示“系统处理中&#xff0c;请稍候..”&#xff0c;我们需要在数据加载完成后才能继续下一步操作&#xff0c;如何抓取这个信息的网页html元素变化&…...

    2024/5/10 8:07:24
  11. 【Objective-C】Objective-C汇总

    方法定义 参考&#xff1a;https://www.yiibai.com/objective_c/objective_c_functions.html Objective-C编程语言中方法定义的一般形式如下 - (return_type) method_name:( argumentType1 )argumentName1 joiningArgument2:( argumentType2 )argumentName2 ... joiningArgu…...

    2024/5/10 16:45:52
  12. 【洛谷算法题】P5713-洛谷团队系统【入门2分支结构】

    &#x1f468;‍&#x1f4bb;博客主页&#xff1a;花无缺 欢迎 点赞&#x1f44d; 收藏⭐ 留言&#x1f4dd; 加关注✅! 本文由 花无缺 原创 收录于专栏 【洛谷算法题】 文章目录 【洛谷算法题】P5713-洛谷团队系统【入门2分支结构】&#x1f30f;题目描述&#x1f30f;输入格…...

    2024/5/10 8:16:30
  13. 【ES6.0】- 扩展运算符(...)

    【ES6.0】- 扩展运算符... 文章目录 【ES6.0】- 扩展运算符...一、概述二、拷贝数组对象三、合并操作四、参数传递五、数组去重六、字符串转字符数组七、NodeList转数组八、解构变量九、打印日志十、总结 一、概述 **扩展运算符(...)**允许一个表达式在期望多个参数&#xff0…...

    2024/5/10 2:07:43
  14. 摩根看好的前智能硬件头部品牌双11交易数据极度异常!——是模式创新还是饮鸩止渴?

    文 | 螳螂观察 作者 | 李燃 双11狂欢已落下帷幕&#xff0c;各大品牌纷纷晒出优异的成绩单&#xff0c;摩根士丹利投资的智能硬件头部品牌凯迪仕也不例外。然而有爆料称&#xff0c;在自媒体平台发布霸榜各大榜单喜讯的凯迪仕智能锁&#xff0c;多个平台数据都表现出极度异常…...

    2024/5/10 2:07:43
  15. Go语言常用命令详解(二)

    文章目录 前言常用命令go bug示例参数说明 go doc示例参数说明 go env示例 go fix示例 go fmt示例 go generate示例 总结写在最后 前言 接着上一篇继续介绍Go语言的常用命令 常用命令 以下是一些常用的Go命令&#xff0c;这些命令可以帮助您在Go开发中进行编译、测试、运行和…...

    2024/5/10 16:45:47
  16. 用欧拉路径判断图同构推出reverse合法性:1116T4

    http://cplusoj.com/d/senior/p/SS231116D 假设我们要把 a a a 变成 b b b&#xff0c;我们在 a i a_i ai​ 和 a i 1 a_{i1} ai1​ 之间连边&#xff0c; b b b 同理&#xff0c;则 a a a 能变成 b b b 的充要条件是两图 A , B A,B A,B 同构。 必要性显然&#xff0…...

    2024/5/10 16:45:46
  17. 【NGINX--1】基础知识

    1、在 Debian/Ubuntu 上安装 NGINX 在 Debian 或 Ubuntu 机器上安装 NGINX 开源版。 更新已配置源的软件包信息&#xff0c;并安装一些有助于配置官方 NGINX 软件包仓库的软件包&#xff1a; apt-get update apt install -y curl gnupg2 ca-certificates lsb-release debian-…...

    2024/5/9 19:47:07
  18. Hive默认分割符、存储格式与数据压缩

    目录 1、Hive默认分割符2、Hive存储格式3、Hive数据压缩 1、Hive默认分割符 Hive创建表时指定的行受限&#xff08;ROW FORMAT&#xff09;配置标准HQL为&#xff1a; ... ROW FORMAT DELIMITED FIELDS TERMINATED BY \u0001 COLLECTION ITEMS TERMINATED BY , MAP KEYS TERMI…...

    2024/5/10 10:17:11
  19. 【论文阅读】MAG:一种用于航天器遥测数据中有效异常检测的新方法

    文章目录 摘要1 引言2 问题描述3 拟议框架4 所提出方法的细节A.数据预处理B.变量相关分析C.MAG模型D.异常分数 5 实验A.数据集和性能指标B.实验设置与平台C.结果和比较 6 结论 摘要 异常检测是保证航天器稳定性的关键。在航天器运行过程中&#xff0c;传感器和控制器产生大量周…...

    2024/5/10 2:07:41
  20. --max-old-space-size=8192报错

    vue项目运行时&#xff0c;如果经常运行慢&#xff0c;崩溃停止服务&#xff0c;报如下错误 FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory 因为在 Node 中&#xff0c;通过JavaScript使用内存时只能使用部分内存&#xff08;64位系统&…...

    2024/5/10 16:37:19
  21. 基于深度学习的恶意软件检测

    恶意软件是指恶意软件犯罪者用来感染个人计算机或整个组织的网络的软件。 它利用目标系统漏洞&#xff0c;例如可以被劫持的合法软件&#xff08;例如浏览器或 Web 应用程序插件&#xff09;中的错误。 恶意软件渗透可能会造成灾难性的后果&#xff0c;包括数据被盗、勒索或网…...

    2024/5/10 15:01:36
  22. JS原型对象prototype

    让我简单的为大家介绍一下原型对象prototype吧&#xff01; 使用原型实现方法共享 1.构造函数通过原型分配的函数是所有对象所 共享的。 2.JavaScript 规定&#xff0c;每一个构造函数都有一个 prototype 属性&#xff0c;指向另一个对象&#xff0c;所以我们也称为原型对象…...

    2024/5/9 16:54:42
  23. C++中只能有一个实例的单例类

    C中只能有一个实例的单例类 前面讨论的 President 类很不错&#xff0c;但存在一个缺陷&#xff1a;无法禁止通过实例化多个对象来创建多名总统&#xff1a; President One, Two, Three; 由于复制构造函数是私有的&#xff0c;其中每个对象都是不可复制的&#xff0c;但您的目…...

    2024/5/10 1:31:37
  24. python django 小程序图书借阅源码

    开发工具&#xff1a; PyCharm&#xff0c;mysql5.7&#xff0c;微信开发者工具 技术说明&#xff1a; python django html 小程序 功能介绍&#xff1a; 用户端&#xff1a; 登录注册&#xff08;含授权登录&#xff09; 首页显示搜索图书&#xff0c;轮播图&#xff0…...

    2024/5/10 9:24:29
  25. 电子学会C/C++编程等级考试2022年03月(一级)真题解析

    C/C++等级考试(1~8级)全部真题・点这里 第1题:双精度浮点数的输入输出 输入一个双精度浮点数,保留8位小数,输出这个浮点数。 时间限制:1000 内存限制:65536输入 只有一行,一个双精度浮点数。输出 一行,保留8位小数的浮点数。样例输入 3.1415926535798932样例输出 3.1…...

    2024/5/10 10:40:03
  26. 配置失败还原请勿关闭计算机,电脑开机屏幕上面显示,配置失败还原更改 请勿关闭计算机 开不了机 这个问题怎么办...

    解析如下&#xff1a;1、长按电脑电源键直至关机&#xff0c;然后再按一次电源健重启电脑&#xff0c;按F8健进入安全模式2、安全模式下进入Windows系统桌面后&#xff0c;按住“winR”打开运行窗口&#xff0c;输入“services.msc”打开服务设置3、在服务界面&#xff0c;选中…...

    2022/11/19 21:17:18
  27. 错误使用 reshape要执行 RESHAPE,请勿更改元素数目。

    %读入6幅图像&#xff08;每一幅图像的大小是564*564&#xff09; f1 imread(WashingtonDC_Band1_564.tif); subplot(3,2,1),imshow(f1); f2 imread(WashingtonDC_Band2_564.tif); subplot(3,2,2),imshow(f2); f3 imread(WashingtonDC_Band3_564.tif); subplot(3,2,3),imsho…...

    2022/11/19 21:17:16
  28. 配置 已完成 请勿关闭计算机,win7系统关机提示“配置Windows Update已完成30%请勿关闭计算机...

    win7系统关机提示“配置Windows Update已完成30%请勿关闭计算机”问题的解决方法在win7系统关机时如果有升级系统的或者其他需要会直接进入一个 等待界面&#xff0c;在等待界面中我们需要等待操作结束才能关机&#xff0c;虽然这比较麻烦&#xff0c;但是对系统进行配置和升级…...

    2022/11/19 21:17:15
  29. 台式电脑显示配置100%请勿关闭计算机,“准备配置windows 请勿关闭计算机”的解决方法...

    有不少用户在重装Win7系统或更新系统后会遇到“准备配置windows&#xff0c;请勿关闭计算机”的提示&#xff0c;要过很久才能进入系统&#xff0c;有的用户甚至几个小时也无法进入&#xff0c;下面就教大家这个问题的解决方法。第一种方法&#xff1a;我们首先在左下角的“开始…...

    2022/11/19 21:17:14
  30. win7 正在配置 请勿关闭计算机,怎么办Win7开机显示正在配置Windows Update请勿关机...

    置信有很多用户都跟小编一样遇到过这样的问题&#xff0c;电脑时发现开机屏幕显现“正在配置Windows Update&#xff0c;请勿关机”(如下图所示)&#xff0c;而且还需求等大约5分钟才干进入系统。这是怎样回事呢&#xff1f;一切都是正常操作的&#xff0c;为什么开时机呈现“正…...

    2022/11/19 21:17:13
  31. 准备配置windows 请勿关闭计算机 蓝屏,Win7开机总是出现提示“配置Windows请勿关机”...

    Win7系统开机启动时总是出现“配置Windows请勿关机”的提示&#xff0c;没过几秒后电脑自动重启&#xff0c;每次开机都这样无法进入系统&#xff0c;此时碰到这种现象的用户就可以使用以下5种方法解决问题。方法一&#xff1a;开机按下F8&#xff0c;在出现的Windows高级启动选…...

    2022/11/19 21:17:12
  32. 准备windows请勿关闭计算机要多久,windows10系统提示正在准备windows请勿关闭计算机怎么办...

    有不少windows10系统用户反映说碰到这样一个情况&#xff0c;就是电脑提示正在准备windows请勿关闭计算机&#xff0c;碰到这样的问题该怎么解决呢&#xff0c;现在小编就给大家分享一下windows10系统提示正在准备windows请勿关闭计算机的具体第一种方法&#xff1a;1、2、依次…...

    2022/11/19 21:17:11
  33. 配置 已完成 请勿关闭计算机,win7系统关机提示“配置Windows Update已完成30%请勿关闭计算机”的解决方法...

    今天和大家分享一下win7系统重装了Win7旗舰版系统后&#xff0c;每次关机的时候桌面上都会显示一个“配置Windows Update的界面&#xff0c;提示请勿关闭计算机”&#xff0c;每次停留好几分钟才能正常关机&#xff0c;导致什么情况引起的呢&#xff1f;出现配置Windows Update…...

    2022/11/19 21:17:10
  34. 电脑桌面一直是清理请关闭计算机,windows7一直卡在清理 请勿关闭计算机-win7清理请勿关机,win7配置更新35%不动...

    只能是等着&#xff0c;别无他法。说是卡着如果你看硬盘灯应该在读写。如果从 Win 10 无法正常回滚&#xff0c;只能是考虑备份数据后重装系统了。解决来方案一&#xff1a;管理员运行cmd&#xff1a;net stop WuAuServcd %windir%ren SoftwareDistribution SDoldnet start WuA…...

    2022/11/19 21:17:09
  35. 计算机配置更新不起,电脑提示“配置Windows Update请勿关闭计算机”怎么办?

    原标题&#xff1a;电脑提示“配置Windows Update请勿关闭计算机”怎么办&#xff1f;win7系统中在开机与关闭的时候总是显示“配置windows update请勿关闭计算机”相信有不少朋友都曾遇到过一次两次还能忍但经常遇到就叫人感到心烦了遇到这种问题怎么办呢&#xff1f;一般的方…...

    2022/11/19 21:17:08
  36. 计算机正在配置无法关机,关机提示 windows7 正在配置windows 请勿关闭计算机 ,然后等了一晚上也没有关掉。现在电脑无法正常关机...

    关机提示 windows7 正在配置windows 请勿关闭计算机 &#xff0c;然后等了一晚上也没有关掉。现在电脑无法正常关机以下文字资料是由(历史新知网www.lishixinzhi.com)小编为大家搜集整理后发布的内容&#xff0c;让我们赶快一起来看一下吧&#xff01;关机提示 windows7 正在配…...

    2022/11/19 21:17:05
  37. 钉钉提示请勿通过开发者调试模式_钉钉请勿通过开发者调试模式是真的吗好不好用...

    钉钉请勿通过开发者调试模式是真的吗好不好用 更新时间:2020-04-20 22:24:19 浏览次数:729次 区域: 南阳 > 卧龙 列举网提醒您:为保障您的权益,请不要提前支付任何费用! 虚拟位置外设器!!轨迹模拟&虚拟位置外设神器 专业用于:钉钉,外勤365,红圈通,企业微信和…...

    2022/11/19 21:17:05
  38. 配置失败还原请勿关闭计算机怎么办,win7系统出现“配置windows update失败 还原更改 请勿关闭计算机”,长时间没反应,无法进入系统的解决方案...

    前几天班里有位学生电脑(windows 7系统)出问题了&#xff0c;具体表现是开机时一直停留在“配置windows update失败 还原更改 请勿关闭计算机”这个界面&#xff0c;长时间没反应&#xff0c;无法进入系统。这个问题原来帮其他同学也解决过&#xff0c;网上搜了不少资料&#x…...

    2022/11/19 21:17:04
  39. 一个电脑无法关闭计算机你应该怎么办,电脑显示“清理请勿关闭计算机”怎么办?...

    本文为你提供了3个有效解决电脑显示“清理请勿关闭计算机”问题的方法&#xff0c;并在最后教给你1种保护系统安全的好方法&#xff0c;一起来看看&#xff01;电脑出现“清理请勿关闭计算机”在Windows 7(SP1)和Windows Server 2008 R2 SP1中&#xff0c;添加了1个新功能在“磁…...

    2022/11/19 21:17:03
  40. 请勿关闭计算机还原更改要多久,电脑显示:配置windows更新失败,正在还原更改,请勿关闭计算机怎么办...

    许多用户在长期不使用电脑的时候&#xff0c;开启电脑发现电脑显示&#xff1a;配置windows更新失败&#xff0c;正在还原更改&#xff0c;请勿关闭计算机。。.这要怎么办呢&#xff1f;下面小编就带着大家一起看看吧&#xff01;如果能够正常进入系统&#xff0c;建议您暂时移…...

    2022/11/19 21:17:02
  41. 还原更改请勿关闭计算机 要多久,配置windows update失败 还原更改 请勿关闭计算机,电脑开机后一直显示以...

    配置windows update失败 还原更改 请勿关闭计算机&#xff0c;电脑开机后一直显示以以下文字资料是由(历史新知网www.lishixinzhi.com)小编为大家搜集整理后发布的内容&#xff0c;让我们赶快一起来看一下吧&#xff01;配置windows update失败 还原更改 请勿关闭计算机&#x…...

    2022/11/19 21:17:01
  42. 电脑配置中请勿关闭计算机怎么办,准备配置windows请勿关闭计算机一直显示怎么办【图解】...

    不知道大家有没有遇到过这样的一个问题&#xff0c;就是我们的win7系统在关机的时候&#xff0c;总是喜欢显示“准备配置windows&#xff0c;请勿关机”这样的一个页面&#xff0c;没有什么大碍&#xff0c;但是如果一直等着的话就要两个小时甚至更久都关不了机&#xff0c;非常…...

    2022/11/19 21:17:00
  43. 正在准备配置请勿关闭计算机,正在准备配置windows请勿关闭计算机时间长了解决教程...

    当电脑出现正在准备配置windows请勿关闭计算机时&#xff0c;一般是您正对windows进行升级&#xff0c;但是这个要是长时间没有反应&#xff0c;我们不能再傻等下去了。可能是电脑出了别的问题了&#xff0c;来看看教程的说法。正在准备配置windows请勿关闭计算机时间长了方法一…...

    2022/11/19 21:16:59
  44. 配置失败还原请勿关闭计算机,配置Windows Update失败,还原更改请勿关闭计算机...

    我们使用电脑的过程中有时会遇到这种情况&#xff0c;当我们打开电脑之后&#xff0c;发现一直停留在一个界面&#xff1a;“配置Windows Update失败&#xff0c;还原更改请勿关闭计算机”&#xff0c;等了许久还是无法进入系统。如果我们遇到此类问题应该如何解决呢&#xff0…...

    2022/11/19 21:16:58
  45. 如何在iPhone上关闭“请勿打扰”

    Apple’s “Do Not Disturb While Driving” is a potentially lifesaving iPhone feature, but it doesn’t always turn on automatically at the appropriate time. For example, you might be a passenger in a moving car, but your iPhone may think you’re the one dri…...

    2022/11/19 21:16:57