跳至主要內容
Spring中事务的处理

注解式事务

@Transactional 源码

@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@Documented
public @interface Transactional {
    @AliasFor("transactionManager")
    String value() default "";

    @AliasFor("value")
    String transactionManager() default "";

    Propagation propagation() default Propagation.REQUIRED;

    Isolation isolation() default Isolation.DEFAULT;

    int timeout() default -1;

    boolean readOnly() default false;

    Class<? extends Throwable>[] rollbackFor() default {};

    String[] rollbackForClassName() default {};

    Class<? extends Throwable>[] noRollbackFor() default {};

    String[] noRollbackForClassName() default {};
}

logycoconut大约 2 分钟关于技术SpringDataJpaSpring
Spring 配置笔记

忘记的时候翻一翻

XML配置

IOC容器

使用bean标签,除了id和class属性之外没有其他属性和标签时,采用的就是默认构造函数创建bean对象
如果类中没有默认构造函数,则无法创建

  • 默认构造函数创建

<bean id="exampleService" class="com.hall.service.impl.ExampleService"></bean>


logycoconut大约 5 分钟关于技术Spring