Spring AOP slow startup time

前端 未结 6 1036
轻奢々
轻奢々 2020-12-11 05:59

We\'re using Spring (3.0.5) AOP with @AspectJ style annotations and . We use it for transactions, auditing, profilin

6条回答
  •  臣服心动
    2020-12-11 06:04

    From what you've posted it looks like your using Load Time Weaving which incurs a startup penalty because the system has to weave all the classes as they are being loaded. If your primary concern is startup time, then I would suggest you switch to Compile Time Weaving. You can find instructions on how to do this in the spring documentation (Chapter 6, Section 8) or in at the AspectJ site (http://www.eclipse.org/aspectj/docs.php)

    Switching to Compile time weaving with the AspectJ compiler is relatively stragiht forward:

    1. Remove the notation from your context file.
    2. Add a aspectJ compile step to your build file. On the AspectJ site you should be able to find an ant plugin, codehaus has a maven plugin. Here are examples of how to us both.

    For Maven:

    
         org.codehaus.mojo
         aspectj-maven-plugin
         1.3
         
         true
          1.6
          1.6
          1.6
          true
          
            
                                    org.springframework
                                    spring-aspects
                                
                            
                        
                        
                            
                                
                                    compile   
                                
                            
                        
                    
    

    For Ant

     
                
                    
                
            
    
      
    

提交回复
热议问题