user414967
user414967

Reputation: 5335

spring aop for only for specific methods

we need to implement spring aop in our project. Is there any way in the spring configuration that we need to apply aop only for some specific methods ? for example: I need to initialize some variables through spring aop only to the method which starts with 'create'. eg:createEmployee(Employee employee); Is it possible to implement without using aspectJ in spring? Is it clear? or should I explain more? How do I do that? can I apply some kind of filter to the configuration?

Upvotes: 0

Views: 273

Answers (1)

subodh
subodh

Reputation: 6158

Yes, It's possible, this way

<tx:advice id="transactionAdvice" transaction-manager="hibernateTxManager">
        <tx:attributes>        
            <tx:method name="create*" read-only="false" propagation="REQUIRED" />            
        </tx:attributes>
    </tx:advice>

Upvotes: 1

Related Questions