Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-5082

@Transactional annotation doesn't work for scanned component, again

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Works as Designed
    • Affects Version/s: 2.5 final
    • Fix Version/s: None
    • Component/s: Transaction
    • Labels:
      None
    • Last commented by a User:
      true

      Description

      Please see the following example:

      @Service
      @Transactional
      public class AccountService {
      
          @Autowired
          private AccountDao accountDao;
      
          public void updateLoginInfo(Account account) {
              accountDao.updateLoginInfo(account);
              someOtherStatementsMightThrowException();
          }
      }
      

      And everything supports the annotation is configurated:

      <context:annotation-config />
      <context:component-scan base-package="com.xyz" />
      <tx:annotation-driven transaction-manager="transactionManager" />
      

      We use @Service annotation on service bean, that is, it could be autowired to any bean that depends on it.

      But the @Transactional annotation doesn't work, until I remove @Service annotation and explicitly define the bean in context configuration xml:

      <bean id="accountService" class="com.xyz.service.AccountService" />
      

      I'm wondering if there is any step I missed, or it supposes to work like that? Thanks.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                juergen.hoeller Juergen Hoeller
                Reporter:
                wei Yuwei Zhao
                Last updater:
                S├ębastien Deleuze
              • Votes:
                10 Vote for this issue
                Watchers:
                16 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  5 years, 13 weeks, 6 days ago