package ar.com.javacuriosities.spring.applications;

import ar.com.javacuriosities.spring.services.Business;
import ar.com.javacuriosities.spring.services.Installation;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class SpringXMLApplication {

    public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("application_context.xml");

        Business businessWithAfterReturnInterceptor = context.getBean("businessWithAfterReturnInterceptor", Business.class);
        Business businessWithAroundInterceptor = context.getBean("businessWithAroundInterceptor", Business.class);
        Business businessWithBeforeInterceptor = context.getBean("businessWithBeforeInterceptor", Business.class);
        Business businessWithThrowsInterceptor = context.getBean("businessWithThrowsInterceptor", Business.class);

        businessWithAfterReturnInterceptor.execute();

        businessWithAroundInterceptor.execute();

        businessWithBeforeInterceptor.execute();

        try {
            businessWithThrowsInterceptor.executeWithException();
        } catch (Exception e) {
            // Log and Handle exception
            e.printStackTrace();
        }

        Installation installation = context.getBean("installation", Installation.class);

        installation.start();
        installation.start("Hello World");
        try {
            installation.startWithError();
        } catch (Exception e) {
            // Log and Handle exception
            e.printStackTrace();
        }
        installation.startWithReturn();
    }
}

@@ -472,24 +472,147 @@
 ext.xml%22);%0A%0A
+        System.out.println(%22****** Proxy Bean ******%22);%0A%0A        System.out.println(%22**** After Return Interceptor ****%22);%0A
         Busi
@@ -716,32 +716,147 @@
 usiness.class);%0A
+        businessWithAfterReturnInterceptor.execute();%0A%0A        System.out.println(%22**** Around Interceptor ****%22);%0A
         Business
@@ -958,33 +958,24 @@
 s);%0A        
-Business 
 businessWith
@@ -966,38 +966,38 @@
     businessWith
-Before
+Around
 Interceptor = co
@@ -995,46 +995,61 @@
 ptor
- = context.getBean(%22businessWith
+.execute();%0A%0A        System.out.println(%22**** 
 Before
+ 
 Inte
@@ -1055,33 +1055,22 @@
 erceptor
-%22, Business.class
+ ****%22
 );%0A     
@@ -1085,38 +1085,38 @@
 ess businessWith
-Throws
+Before
 Interceptor = co
@@ -1134,38 +1134,38 @@
 an(%22businessWith
-Throws
+Before
 Interceptor%22, Bu
@@ -1171,33 +1171,32 @@
 usiness.class);%0A
-%0A
         business
@@ -1195,35 +1195,30 @@
 businessWith
-AfterReturn
+Before
 Interceptor.
@@ -1237,34 +1237,48 @@
         
-businessWithAround
+System.out.println(%22**** Throws 
 Intercep
@@ -1280,37 +1280,33 @@
 erceptor
-.execute(
+ ****%22
 );%0A
-%0A
         
 business
@@ -1289,32 +1289,41 @@
 ****%22);%0A        
+Business 
 businessWithBefo
@@ -1310,38 +1310,38 @@
 ess businessWith
-Before
+Throws
 Interceptor.exec
@@ -1331,37 +1331,93 @@
 sInterceptor
-.execute(
+ = context.getBean(%22businessWithThrowsInterceptor%22, Business.class
 );%0A
-%0A
         try 
@@ -1600,16 +1600,70 @@
      %7D%0A%0A
+        System.out.println(%22****** Aspects ******%22);%0A%0A
         
@@ -1756,69 +1756,303 @@
     
-installation.start();%0A        installation.start(%22Hello World
+System.out.println(%22**** Pointcut without parameter ****%22);%0A        installation.start();%0A%0A        System.out.println(%22**** Pointcut multiples parameters ****%22);%0A        installation.start(%22Hello World%22); // Multiples parameters pointcut%0A%0A        System.out.println(%22**** Pointcut exception ****
 %22);%0A
@@ -2222,16 +2222,80 @@
        %7D
+%0A%0A        System.out.println(%22**** Pointcut after return ****%22);
 %0A       

Improve AOP