Spring AOP: improves in old examples about AOP Spring old way, AspectJ and LTW.
authorGustavo Martin Morcuende <gu.martinm@gmail.com>
Sun, 10 Apr 2016 23:56:12 +0000 (01:56 +0200)
committerGustavo Martin Morcuende <gu.martinm@gmail.com>
Sun, 10 Apr 2016 23:56:12 +0000 (01:56 +0200)
63 files changed:
SpringJava/JPA/pom.xml [new file with mode: 0644]
SpringJava/JPA/src/main/resources/jpa.properties [new file with mode: 0644]
SpringJava/JPA/src/main/resources/log4j2.xml [new file with mode: 0644]
SpringJava/JPA/src/main/resources/spring-configuration/datasource-configuration.xml [new file with mode: 0644]
SpringJava/JPA/src/main/resources/spring-configuration/jpa-configuration.xml [new file with mode: 0644]
SpringJava/SpringAOP20/pom.xml
SpringJava/SpringAOP20/spring-aop-example/pom.xml [deleted file]
SpringJava/SpringAOP20/spring-aop-example/src/main/java/de/spring/example/GeneralAccess.java [deleted file]
SpringJava/SpringAOP20/spring-aop-example/src/main/java/de/spring/example/SpringAdvice.java [deleted file]
SpringJava/SpringAOP20/spring-aop-example/src/main/java/de/spring/example/SpringContextLocator.java [deleted file]
SpringJava/SpringAOP20/spring-aop-example/src/main/java/de/spring/example/SpringStart.java [deleted file]
SpringJava/SpringAOP20/spring-aop-example/src/main/java/de/spring/example/SystemArchitecture.java [deleted file]
SpringJava/SpringAOP20/spring-aop-example/src/main/java/de/spring/example/service/TestB.java [deleted file]
SpringJava/SpringAOP20/spring-aop-example/src/main/java/de/spring/example/web/TestA.java [deleted file]
SpringJava/SpringAOP20/spring-aop-example/src/main/resources/spring-config.xml [deleted file]
SpringJava/SpringAOP20/src/main/java/de/spring/example/GeneralAccess.java [new file with mode: 0644]
SpringJava/SpringAOP20/src/main/java/de/spring/example/SpringAdvice.java [new file with mode: 0644]
SpringJava/SpringAOP20/src/main/java/de/spring/example/SpringContextLocator.java [new file with mode: 0644]
SpringJava/SpringAOP20/src/main/java/de/spring/example/SpringStart.java [new file with mode: 0644]
SpringJava/SpringAOP20/src/main/java/de/spring/example/SystemArchitecture.java [new file with mode: 0644]
SpringJava/SpringAOP20/src/main/java/de/spring/example/service/TestB.java [new file with mode: 0644]
SpringJava/SpringAOP20/src/main/java/de/spring/example/web/TestA.java [new file with mode: 0644]
SpringJava/SpringAOP20/src/main/resources/log4j2.xml [new file with mode: 0644]
SpringJava/SpringAOP20/src/main/resources/spring-config.xml [new file with mode: 0644]
SpringJava/SpringAspectJ/pom.xml
SpringJava/SpringAspectJ/spring-aspectj-example/pom.xml [deleted file]
SpringJava/SpringAspectJ/spring-aspectj-example/src/main/java/de/spring/example/MyAdvice.java [deleted file]
SpringJava/SpringAspectJ/spring-aspectj-example/src/main/java/de/spring/example/SpringAdvice.java [deleted file]
SpringJava/SpringAspectJ/spring-aspectj-example/src/main/java/de/spring/example/SpringContextLocator.java [deleted file]
SpringJava/SpringAspectJ/spring-aspectj-example/src/main/java/de/spring/example/SpringStart.java [deleted file]
SpringJava/SpringAspectJ/spring-aspectj-example/src/main/java/de/spring/example/SystemArchitecture.java [deleted file]
SpringJava/SpringAspectJ/spring-aspectj-example/src/main/java/de/spring/example/web/Test.java [deleted file]
SpringJava/SpringAspectJ/spring-aspectj-example/src/main/resources/spring-config.xml [deleted file]
SpringJava/SpringAspectJ/src/main/java/de/spring/example/MyAdvice.java [new file with mode: 0644]
SpringJava/SpringAspectJ/src/main/java/de/spring/example/SpringAdvice.java [new file with mode: 0644]
SpringJava/SpringAspectJ/src/main/java/de/spring/example/SpringContextLocator.java [new file with mode: 0644]
SpringJava/SpringAspectJ/src/main/java/de/spring/example/SpringStart.java [new file with mode: 0644]
SpringJava/SpringAspectJ/src/main/java/de/spring/example/SystemArchitecture.java [new file with mode: 0644]
SpringJava/SpringAspectJ/src/main/java/de/spring/example/web/Test.java [new file with mode: 0644]
SpringJava/SpringAspectJ/src/main/resources/log4j2.xml [new file with mode: 0644]
SpringJava/SpringAspectJ/src/main/resources/spring-config.xml [new file with mode: 0644]
SpringJava/SpringLTW/README [new file with mode: 0644]
SpringJava/SpringLTW/pom.xml
SpringJava/SpringLTW/spring-ltw-example/pom.xml [deleted file]
SpringJava/SpringLTW/spring-ltw-example/src/main/java/de/spring/example/MyAdvice.java [deleted file]
SpringJava/SpringLTW/spring-ltw-example/src/main/java/de/spring/example/SpringContextLocator.java [deleted file]
SpringJava/SpringLTW/spring-ltw-example/src/main/java/de/spring/example/SpringStart.java [deleted file]
SpringJava/SpringLTW/spring-ltw-example/src/main/java/de/spring/example/TransactionManager.java [deleted file]
SpringJava/SpringLTW/spring-ltw-example/src/main/java/de/spring/example/annotation/commitTransactional.java [deleted file]
SpringJava/SpringLTW/spring-ltw-example/src/main/java/de/spring/example/annotation/initTransactional.java [deleted file]
SpringJava/SpringLTW/spring-ltw-example/src/main/java/de/spring/example/web/Test.java [deleted file]
SpringJava/SpringLTW/spring-ltw-example/src/main/resources/META-INF/aop.xml [deleted file]
SpringJava/SpringLTW/spring-ltw-example/src/main/resources/spring-config.xml [deleted file]
SpringJava/SpringLTW/src/main/java/de/spring/example/MyAdvice.java [new file with mode: 0644]
SpringJava/SpringLTW/src/main/java/de/spring/example/SpringContextLocator.java [new file with mode: 0644]
SpringJava/SpringLTW/src/main/java/de/spring/example/SpringStart.java [new file with mode: 0644]
SpringJava/SpringLTW/src/main/java/de/spring/example/TransactionManager.java [new file with mode: 0644]
SpringJava/SpringLTW/src/main/java/de/spring/example/annotation/commitTransactional.java [new file with mode: 0644]
SpringJava/SpringLTW/src/main/java/de/spring/example/annotation/initTransactional.java [new file with mode: 0644]
SpringJava/SpringLTW/src/main/java/de/spring/example/web/Test.java [new file with mode: 0644]
SpringJava/SpringLTW/src/main/resources/META-INF/aop.xml [new file with mode: 0644]
SpringJava/SpringLTW/src/main/resources/log4j2.xml [new file with mode: 0644]
SpringJava/SpringLTW/src/main/resources/spring-config.xml [new file with mode: 0644]

diff --git a/SpringJava/JPA/pom.xml b/SpringJava/JPA/pom.xml
new file mode 100644 (file)
index 0000000..d91a5b4
--- /dev/null
@@ -0,0 +1,239 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+       <modelVersion>4.0.0</modelVersion>
+       <groupId>de.spring.jpa</groupId>
+       <artifactId>spring-jpa</artifactId>
+       <version>1.0-SNAPSHOT</version>
+       <name>spring-jpa</name>
+       <url>http://gumartinm.name</url>
+       <description>JPA Spring Framework</description>
+       <organization>
+               <name>Gustavo Martin Morcuende</name>
+               <url>http://www.gumartinm.name</url>
+       </organization>
+       <scm>
+               <developerConnection>scm:git:http://git.gumartinm.name/SpringWebServicesForFun</developerConnection>
+               <url>http://git.gumartinm.name/SpringWebServicesForFun</url>
+       </scm>
+
+       <properties>
+               <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+               <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+               <spring.version>4.2.4.RELEASE</spring.version>
+       </properties>
+
+       <profiles>
+               <profile>
+                       <id>release</id>
+                       <properties>
+                               <environment.profile>release</environment.profile>
+                       </properties>
+                       <activation>
+                               <activeByDefault>true</activeByDefault>
+                       </activation>
+               </profile>
+       </profiles>
+
+       <dependencies>
+               <!--
+                       1/3 Required dependency for log4j 2 with slf4j: binding between log4j 
+                       2 and slf4j
+               -->
+               <dependency>
+                       <groupId>org.apache.logging.log4j</groupId>
+                       <artifactId>log4j-slf4j-impl</artifactId>
+                       <version>2.5</version>
+               </dependency>
+               <!--
+                       2/3 Required dependency for log4j 2 with slf4j: log4j 2 maven plugin 
+                       (it is the log4j 2 implementation)
+               -->
+               <dependency>
+                       <groupId>org.apache.logging.log4j</groupId>
+                       <artifactId>log4j-core</artifactId>
+                       <version>2.5</version>
+               </dependency>
+               <!--
+                       3/3 Required dependency for getting rid of commons logging. This is 
+                       the BRIDGE (no binding) between Jakarta Commons Logging (used by Spring) 
+                       and whatever I am using for logging (in this case I am using log4j 2) See: 
+                       http://www.slf4j.org/legacy.html We need exclusions in every dependency using 
+                       Jakarta Commons Logging (see Spring dependencies below) 
+               -->
+               <dependency>
+                       <groupId>org.slf4j</groupId>
+                       <artifactId>jcl-over-slf4j</artifactId>
+                       <version>1.7.13</version>
+               </dependency>
+               
+               <dependency>
+                       <groupId>org.springframework</groupId>
+                       <artifactId>spring-context</artifactId>
+                       <version>${spring.version}</version>
+                       <!--
+                               Required dependency for getting rid of commons logging and use my 
+                               own logging library (in my case I decided to use log4j 2 under slf4j)
+                       -->
+                       <exclusions>
+                               <exclusion>
+                                       <groupId>commons-logging</groupId>
+                                       <artifactId>commons-logging</artifactId>
+                               </exclusion>
+                       </exclusions>
+               </dependency>
+               
+               <dependency>
+                       <groupId>cglib</groupId>
+                       <artifactId>cglib</artifactId>
+                       <version>2.2.2</version>
+               </dependency>
+
+               <dependency>
+                       <groupId>com.mchange</groupId>
+                       <artifactId>c3p0</artifactId>
+                       <version>0.9.5.2</version>
+               </dependency>
+
+               <!-- Required JPA dependencies with hibernate -->
+               <dependency>
+               <groupId>org.springframework</groupId>
+               <artifactId>spring-orm</artifactId>
+               <version>${spring.version}</version>
+               </dependency>
+               
+               <dependency>
+                       <groupId>org.springframework.data</groupId>
+                       <artifactId>spring-data-jpa</artifactId>
+                       <version>1.9.2.RELEASE</version>
+                       <exclusions>
+                               <exclusion>
+                                       <groupId>org.springframework</groupId>
+                                       <artifactId>spring-beans</artifactId>
+                               </exclusion>
+                               <exclusion>
+                                       <groupId>org.springframework</groupId>
+                                       <artifactId>spring-jdbc</artifactId>
+                               </exclusion>
+                               <exclusion>
+                                       <groupId>org.springframework</groupId>
+                                       <artifactId>spring-orm</artifactId>
+                               </exclusion>
+                               <exclusion>
+                                       <groupId>org.springframework</groupId>
+                                       <artifactId>spring-core</artifactId>
+                               </exclusion>
+                               <exclusion>
+                                       <groupId>org.springframework</groupId>
+                                       <artifactId>spring-aop</artifactId>
+                               </exclusion>
+                               <exclusion>
+                                       <groupId>org.springframework</groupId>
+                                       <artifactId>spring-context</artifactId>
+                               </exclusion>
+                       </exclusions>
+               </dependency>
+
+               <dependency>
+                       <groupId>org.hibernate</groupId>
+                       <artifactId>hibernate-entitymanager</artifactId>
+                       <version>5.0.7.Final</version>
+               </dependency>
+
+
+               <!-- Unitary and integration tests -->
+               <dependency>
+                       <groupId>junit</groupId>
+                       <artifactId>junit</artifactId>
+                       <version>4.12</version>
+                       <scope>test</scope>
+               </dependency>
+               <dependency>
+                       <groupId>org.springframework</groupId>
+                       <artifactId>spring-test</artifactId>
+                       <version>${spring.version}</version>
+                       <scope>test</scope>
+               </dependency>
+               <dependency>
+                       <groupId>org.mockito</groupId>
+                       <artifactId>mockito-core</artifactId>
+                       <version>2.0.11-beta</version>
+                       <scope>test</scope>
+               </dependency>
+       </dependencies>
+       <build>
+               <plugins>
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-surefire-plugin</artifactId>
+                               <version>2.18.1</version>
+                       </plugin>
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-failsafe-plugin</artifactId>
+                               <version>2.18.1</version>
+                       </plugin>
+
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-compiler-plugin</artifactId>
+                               <version>3.3</version>
+                               <configuration>
+                                       <source>1.8</source>
+                                       <target>1.8</target>
+                                       <encoding>${project.build.sourceEncoding}</encoding>
+                               </configuration>
+                       </plugin>
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-resources-plugin</artifactId>
+                               <version>2.7</version>
+                               <configuration>
+                                       <encoding>${project.build.sourceEncoding}</encoding>
+                               </configuration>
+                       </plugin>
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-jar-plugin</artifactId>
+                               <version>2.4</version>
+                               <configuration>
+                                       <archive>
+                                               <manifestEntries>
+                                                       <Specification-Title>${project.description}</Specification-Title>
+                                                       <Specification-Version>${project.version}</Specification-Version>
+                                                       <Specification-Vendor>${project.organization.name}</Specification-Vendor>
+                                                       <Implementation-Title>${project.description}</Implementation-Title>
+                                                       <Implementation-Version>${project.version}</Implementation-Version>
+                                                       <Implementation-Vendor>${project.organization.name}</Implementation-Vendor>
+                                               </manifestEntries>
+                                       </archive>
+                               </configuration>
+                       </plugin>
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-surefire-plugin</artifactId>
+                               <configuration>
+                                       <excludes>
+                                               <exclude>**/*IntegrationTest.java</exclude>
+                                       </excludes>
+                               </configuration>
+                       </plugin>
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-failsafe-plugin</artifactId>
+                               <executions>
+                                       <execution>
+                                               <goals>
+                                                       <goal>integration-test</goal>
+                                                       <goal>verify</goal>
+                                               </goals>
+                                       </execution>
+                               </executions>
+                               <configuration>
+                                       <includes>
+                                               <include>**/*IntegrationTest.java</include>
+                                       </includes>
+                               </configuration>
+                       </plugin>
+               </plugins>
+       </build>
+</project>
diff --git a/SpringJava/JPA/src/main/resources/jpa.properties b/SpringJava/JPA/src/main/resources/jpa.properties
new file mode 100644 (file)
index 0000000..f0755b8
--- /dev/null
@@ -0,0 +1,2 @@
+jpa.dialect=org.hibernate.dialect.DB2Dialect
+jpa.show_sql=true
\ No newline at end of file
diff --git a/SpringJava/JPA/src/main/resources/log4j2.xml b/SpringJava/JPA/src/main/resources/log4j2.xml
new file mode 100644 (file)
index 0000000..d684e48
--- /dev/null
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- 
+       status: The level of internal Log4j events that should be logged to the console.
+       Valid values for this attribute are "trace", "debug", "info", "warn", "error" and "fatal".
+       
+       monitorInterval: The minimum amount of time, in seconds, that must elapse before the file configuration is checked for changes.
+       
+       
+       see https://logging.apache.org/log4j/2.x/manual/configuration.html
+ -->
+<Configuration status="error" strict="true" monitorInterval="30"
+                name="XMLConfigTest" packages="org.apache.logging.log4j.test">
+                
+       <!--
+               ALL > TRACE > DEBUG > INFO > WARN > ERROR > OFF
+               
+               ERROR by default.
+       -->
+                
+    <Appenders>
+        <Appender type="Console" name="STDOUT">
+            <PatternLayout pattern="%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n"/>
+        </Appender>
+    </Appenders>
+    <Loggers>
+    
+
+               <!-- 
+               General logging Spring.
+        -->
+        <Logger name="org.springframework" level="INFO" additivity="false">
+            <AppenderRef ref="STDOUT" />
+        </Logger>
+    
+
+               <!-- 
+                       Anything else will be using TRACE logging level.
+                -->        
+        <Root level="INFO">
+            <AppenderRef ref="STDOUT"/>
+        </Root>
+        
+    </Loggers>
+</Configuration>
diff --git a/SpringJava/JPA/src/main/resources/spring-configuration/datasource-configuration.xml b/SpringJava/JPA/src/main/resources/spring-configuration/datasource-configuration.xml
new file mode 100644 (file)
index 0000000..0951744
--- /dev/null
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<beans xmlns="http://www.springframework.org/schema/beans"\r
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
+       xmlns:util="http://www.springframework.org/schema/util"\r
+       xmlns:tx="http://www.springframework.org/schema/tx"\r
+       xsi:schemaLocation="http://www.springframework.org/schema/beans\r
+        http://www.springframework.org/schema/beans/spring-beans.xsd\r
+        http://www.springframework.org/schema/util\r
+        http://www.springframework.org/schema/util/spring-util.xsd\r
+        http://www.springframework.org/schema/tx \r
+        http://www.springframework.org/schema/tx/spring-tx.xsd">\r
+\r
+       \r
+       <!-- enable the configuration of transactional behavior based on annotations -->\r
+    <tx:annotation-driven transaction-manager="transactionManager"/>\r
+\r
+       <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">\r
+        <property name="user" value="db2inst1"/>\r
+        <property name="password" value="db2inst1"/>\r
+        <property name="driverClass" value="com.ibm.db2.jcc.DB2Driver"/>\r
+        <!--\r
+               If you are dropping like me (by means of some firewall) IPV6 connections and you feel\r
+               during the first SLQ connection as if there is a huge lag and you are using\r
+               *NIX, you could use this system property -Djava.net.preferIPv4Stack=true\r
+               in order to stop using IPV6 from JVM.\r
+               The JVM tries to find out if IPV6 is available by means of opening a random\r
+               AF_INET6 POSIX socket.\r
+         -->\r
+        <property name="jdbcUrl" value="jdbc:db2://localhost:50000/velabd:allowNextOnExhaustedResultSet=1;currentSchema=CLOSURE;"/>\r
+        <property name="initialPoolSize" value="5"/>\r
+        <property name="maxPoolSize" value="20"/>\r
+        <property name="minPoolSize" value="10"/>\r
+        <property name="acquireIncrement" value="1"/>\r
+        <property name="acquireRetryAttempts" value="5"/>\r
+        <property name="acquireRetryDelay" value="1000"/>\r
+        <property name="automaticTestTable" value="con_test"/>\r
+        <property name="checkoutTimeout" value="5000"/>\r
+    </bean>\r
+    \r
+       <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">\r
+               <property name="entityManagerFactory" ref="jpaEntityManagerFactory" />\r
+       </bean>\r
+       \r
+</beans>\r
diff --git a/SpringJava/JPA/src/main/resources/spring-configuration/jpa-configuration.xml b/SpringJava/JPA/src/main/resources/spring-configuration/jpa-configuration.xml
new file mode 100644 (file)
index 0000000..4381156
--- /dev/null
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<beans xmlns="http://www.springframework.org/schema/beans"\r
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
+       xmlns:context="http://www.springframework.org/schema/context"\r
+       xmlns:util="http://www.springframework.org/schema/util"\r
+       xmlns:jpa="http://www.springframework.org/schema/data/jpa"\r
+       xsi:schemaLocation="http://www.springframework.org/schema/beans\r
+        http://www.springframework.org/schema/beans/spring-beans.xsd\r
+        http://www.springframework.org/schema/context\r
+        http://www.springframework.org/schema/context/spring-context.xsd\r
+        http://www.springframework.org/schema/util\r
+        http://www.springframework.org/schema/util/spring-util.xsd\r
+        http://www.springframework.org/schema/data/jpa \r
+        http://www.springframework.org/schema/data/jpa/spring-jpa.xsd">\r
+\r
+       <context:annotation-config />\r
+\r
+    <context:component-scan base-package="de.spring.jpa.repository.impl" />\r
+    \r
+    <context:property-placeholder location="classpath:jpa.properties" />\r
+    \r
+       <bean id="jpaEntityManagerFactory"\r
+               class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">\r
+               <property name="dataSource" ref="dataSource" />\r
+               <property name="jpaVendorAdapter">\r
+                       <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">\r
+                               <property name="databasePlatform" value="${jpa.dialect}" />\r
+                               <property name="showSql" value="${jpa.show_sql}" />\r
+                       </bean>\r
+               </property>\r
+               <property name="packagesToScan" value="de.spring.jpa.domain" />\r
+       </bean>\r
+\r
+       <jpa:repositories entity-manager-factory-ref="jpaEntityManagerFactory"\r
+               base-package="de.spring.jpa.repository"\r
+               transaction-manager-ref="transactionManager" />\r
+\r
+</beans>\r
index 03f9331..b43ac81 100644 (file)
 <?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" 
-        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
-        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 
+<project
+       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+       xmlns="http://maven.apache.org/POM/4.0.0" 
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+       
        <modelVersion>4.0.0</modelVersion>
-       <groupId>de.spring.example</groupId>
-       <artifactId>spring-aop</artifactId>
-       <version>2.0-SNAPSHOT</version>
-       <name>spring-aop</name>
-       <url>http://www.myorganization.de</url>
-       <description>Spring AspectJ with Spring Libraries</description>
-       <organization>
-               <name>MyOrganization</name>
-               <url>http://www.myorganization.de</url>
-       </organization>
-       <packaging>pom</packaging>
-       <issueManagement>
-               <system>trac</system>
-               <url>http://noserver/</url>
-       </issueManagement>
-       <ciManagement>
-               <system>jenkins</system>
-               <url>http://noserver/jenkins/</url>
-       </ciManagement>
-       <scm>
-               <developerConnection>scm:svn:http://noserver</developerConnection>
-               <url>http://noserver</url>
-       </scm>
-       <dependencies>
-               <dependency>
-                       <groupId>com.sun.jdmk</groupId>
-                       <artifactId>jmxtools</artifactId>
-                       <version>1.2.1</version>
-               </dependency>
-               <dependency>
-                       <groupId>javax.activation</groupId>
-                       <artifactId>activation</artifactId>
-                       <version>1.1</version>
-               </dependency>
-               <dependency>
-                       <groupId>log4j</groupId>
-                       <artifactId>log4j</artifactId>
-                       <version>1.2.15</version>
-                       <exclusions>
-                               <exclusion>
-                                       <groupId>com.sun.jdmk</groupId>
-                                       <artifactId>jmxtools</artifactId>
-                               </exclusion>
-                               <exclusion>
-                                       <groupId>com.sun.jmx</groupId>
-                                       <artifactId>jmxri</artifactId>
-                               </exclusion>
-                               <exclusion>
-                                       <groupId>javax.mail</groupId>
-                                       <artifactId>mail</artifactId>
-                               </exclusion>
-                               <exclusion>
-                                       <groupId>javax.jms</groupId>
-                                       <artifactId>jms</artifactId>
-                               </exclusion>
-                       </exclusions>
-               </dependency>
-               <dependency>
-                       <groupId>junit</groupId>
-                       <artifactId>junit</artifactId>
-                       <version>4.4</version>
-                       <scope>test</scope>
-               </dependency>
-       </dependencies>
-       <dependencyManagement>
-               <dependencies>
-                       <dependency>
-                               <groupId>c3p0</groupId>
-                               <artifactId>c3p0</artifactId>
-                               <version>0.9.1.2</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>cglib</groupId>
-                               <artifactId>cglib-nodep</artifactId>
-                               <version>2.1_3</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>commons-collections</groupId>
-                               <artifactId>commons-collections</artifactId>
-                               <version>3.2.1</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>commons-configuration</groupId>
-                               <artifactId>commons-configuration</artifactId>
-                               <version>1.6</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>commons-dbcp</groupId>
-                               <artifactId>commons-dbcp</artifactId>
-                               <version>1.2.2</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>commons-io</groupId>
-                               <artifactId>commons-io</artifactId>
-                               <version>1.4</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>commons-lang</groupId>
-                               <artifactId>commons-lang</artifactId>
-                               <version>2.4</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>commons-logging</groupId>
-                               <artifactId>commons-logging</artifactId>
-                               <version>1.1.1</version>
-                       </dependency>
-                        <dependency>
-                               <groupId>commons-net</groupId>
-                                <artifactId>commons-net</artifactId>
-                               <version>2.0</version>
-                        </dependency>
-                       <dependency>
-                               <groupId>commons-pool</groupId>
-                               <artifactId>commons-pool</artifactId>
-                               <version>1.3</version>
-                       </dependency> 
-                       <dependency>
-                               <groupId>com.h2database</groupId>
-                               <artifactId>h2</artifactId>
-                               <version>1.2.130</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>dom4j</groupId>
-                               <artifactId>dom4j</artifactId>
-                               <version>1.6.1</version>
-                               <exclusions>
-                                       <exclusion>
-                                               <groupId>xml-apis</groupId>
-                                               <artifactId>xml-apis</artifactId>
-                                       </exclusion>
-                               </exclusions>
-                       </dependency>
-                       <dependency>
-                               <groupId>hsqldb</groupId>
-                               <artifactId>hsqldb</artifactId>
-                               <version>1.8.0.7</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>javatar</groupId>
-                               <artifactId>javatar</artifactId>
-                               <version>2.5</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>jpos</groupId>
-                               <artifactId>jpos</artifactId>
-                               <version>1.12.2</version>
-                               <scope>provided</scope>
-                       </dependency>
-                       <dependency>
-                               <groupId>jpos</groupId>
-                               <artifactId>jpos-controls</artifactId>
-                               <version>1.12.2</version>
-                               <scope>provided</scope>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.python</groupId>
-                               <artifactId>jython</artifactId>
-                               <version>2.5.2b2</version>
-                       </dependency>           
-                       <dependency>
-                               <groupId>urbanophile</groupId>
-                               <artifactId>java-getopt</artifactId>
-                               <version>1.0.13</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>mysql</groupId>
-                               <artifactId>mysql-connector-java</artifactId>
-                               <version>5.1.6</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.apache.ibatis</groupId>
-                               <artifactId>ibatis-sqlmap</artifactId>
-                               <version>2.3.4.726</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.apache.mina</groupId>
-                               <artifactId>mina-core</artifactId>
-                               <version>2.0.0-M6</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.aspectj</groupId>
-                               <artifactId>aspectjrt</artifactId>
-                               <version>1.6.5</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.aspectj</groupId>
-                               <artifactId>aspectjweaver</artifactId>
-                               <version>1.6.5</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.dbunit</groupId>
-                               <artifactId>dbunit</artifactId>
-                               <version>2.4.4</version>
-                               <scope>test</scope>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.eclipse.jetty</groupId>
-                               <artifactId>jetty-continuation</artifactId>
-                               <version>7.0.0.v20091005</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.eclipse.jetty</groupId>
-                               <artifactId>jetty-http</artifactId>
-                               <version>7.0.0.v20091005</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.eclipse.jetty</groupId>
-                               <artifactId>jetty-io</artifactId>
-                               <version>7.0.0.v20091005</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.eclipse.jetty</groupId>
-                               <artifactId>jetty-security</artifactId>
-                               <version>7.0.0.v20091005</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.eclipse.jetty</groupId>
-                               <artifactId>jetty-server</artifactId>
-                               <version>7.0.0.v20091005</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.eclipse.jetty</groupId>
-                               <artifactId>jetty-servlet</artifactId>
-                               <version>7.0.0.v20091005</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.eclipse.jetty</groupId>
-                               <artifactId>jetty-webapp</artifactId>
-                               <version>7.0.0.v20091005</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.eclipse.jetty</groupId>
-                               <artifactId>jetty-util</artifactId>
-                               <version>7.0.0.v20091005</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.eclipse.jetty</groupId>
-                               <artifactId>jetty-xml</artifactId>
-                               <version>7.0.0.v20091005</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.slf4j</groupId>
-                               <artifactId>slf4j-api</artifactId>
-                               <version>1.5.2</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.slf4j</groupId>
-                               <artifactId>slf4j-log4j12</artifactId>
-                               <version>1.5.2</version>
-                               <exclusions>
-                                       <exclusion>
-                                               <groupId>log4j</groupId>
-                                               <artifactId>log4j</artifactId>
-                                       </exclusion>
-                               </exclusions>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.springframework</groupId>
-                               <artifactId>spring-aop</artifactId>
-                               <version>${spring.version}</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.springframework</groupId>
-                               <artifactId>spring-beans</artifactId>
-                               <version>${spring.version}</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.springframework</groupId>
-                               <artifactId>spring-core</artifactId>
-                               <version>${spring.version}</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.springframework</groupId>
-                               <artifactId>spring-context</artifactId>
-                               <version>${spring.version}</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.springframework</groupId>
-                               <artifactId>spring-jdbc</artifactId>
-                               <version>${spring.version}</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.springframework</groupId>
-                               <artifactId>spring-tx</artifactId>
-                               <version>${spring.version}</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.springframework</groupId>
-                               <artifactId>spring-web</artifactId>
-                               <version>${spring.version}</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.springframework</groupId>
-                               <artifactId>spring-webmvc</artifactId>
-                               <version>${spring.version}</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.springframework</groupId>
-                                       <artifactId>spring-context-support</artifactId>
-                               <version>${spring.version}</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.springframework</groupId>
-                               <artifactId>spring-test</artifactId>
-                               <version>${spring.version}</version>
-                               <scope>test</scope>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.springframework.batch</groupId>
-                               <artifactId>spring-batch-test</artifactId>
-                               <version>2.0.4.RELEASE</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.springframework.batch</groupId>
-                               <artifactId>spring-batch-core</artifactId>
-                               <version>2.0.4.RELEASE</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.springframework.batch</groupId>
-                               <artifactId>spring-batch-infrastructure</artifactId>
-                               <version>2.0.4.RELEASE</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.springframework</groupId>
-                               <artifactId>spring-orm</artifactId>
-                               <version>${spring.version}</version>
-                       </dependency>
-                       <dependency>
-                           <groupId>net.sf.ehcache</groupId>
-                           <artifactId>ehcache</artifactId>
-                           <version>1.6.2</version>
-                       </dependency>
-                       <dependency>
-                           <groupId>org.springmodules</groupId>
-                           <artifactId>spring-modules-cache</artifactId>
-                           <version>0.9</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>p6spy</groupId>
-                               <artifactId>p6spy</artifactId>
-                               <version>1.3</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>javax.transaction</groupId>
-                               <artifactId>jta</artifactId>
-                               <version>1.0.1B</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>javax.servlet</groupId>
-                               <artifactId>servlet-api</artifactId>
-                               <version>2.5</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>com.caucho</groupId>
-                               <artifactId>hessian</artifactId>
-                               <version>3.1.6</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.codehaus.jettison</groupId>
-                               <artifactId>jettison</artifactId>
-                               <version>1.0</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>com.thoughtworks.xstream</groupId>
-                               <artifactId>xstream</artifactId>
-                               <version>1.3</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.ini4j</groupId>
-                               <artifactId>ini4j</artifactId>
-                               <version>0.5.1</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.easymock</groupId>
-                               <artifactId>easymock</artifactId>
-                               <version>2.4</version>
-                               <scope>test</scope>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.easymock</groupId>
-                               <artifactId>easymockclassextension</artifactId>
-                               <version>2.4</version>
-                               <scope>test</scope>
-                       </dependency>
+    <groupId>de.spring.example</groupId>
+       <artifactId>spring-aop-example</artifactId>
+    <version>2.0-SNAPSHOT</version>
+       <name>spring-aop-example</name>
+       <url>http://gumartinm.name</url>
+    <properties>
+      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+       <dependencies> 
+       <dependency>
+           <groupId>org.springframework</groupId>
+           <artifactId>spring-context</artifactId>
+           <version>4.2.5.RELEASE</version>
+           <!-- 
+               Required dependency for getting rid of commons logging and use my own logging library
+               (in my case I decided to use log4j 2 under slf4j)
+           -->
+           <exclusions>
+               <exclusion>
+                   <groupId>commons-logging</groupId>
+                   <artifactId>commons-logging</artifactId>
+               </exclusion>
+           </exclusions>
+       </dependency>
+      <dependency>
+          <groupId>org.springframework</groupId>
+          <artifactId>spring-aspects</artifactId>
+          <version>4.2.5.RELEASE</version>
+          <!-- 
+              Required dependency for getting rid of commons logging and use my own logging library
+              (in my case I decided to use log4j 2 under slf4j)
+          -->
+          <exclusions>
+              <exclusion>
+                  <groupId>commons-logging</groupId>
+                  <artifactId>commons-logging</artifactId>
+              </exclusion>
+          </exclusions>
+      </dependency>
+      <dependency>
+          <groupId>org.springframework</groupId>
+          <artifactId>spring-aop</artifactId>
+          <version>4.2.5.RELEASE</version>
+          <!-- 
+              Required dependency for getting rid of commons logging and use my own logging library
+              (in my case I decided to use log4j 2 under slf4j)
+          -->
+          <exclusions>
+              <exclusion>
+                  <groupId>commons-logging</groupId>
+                  <artifactId>commons-logging</artifactId>
+              </exclusion>
+          </exclusions>
+      </dependency>
 
-                       <dependency>
-                               <groupId>org.apache.commons</groupId>
-                               <artifactId>commons-compress</artifactId>
-                               <version>1.0</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.apache.commons</groupId>
-                               <artifactId>commons-math</artifactId>
-                               <version>2.0</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>dtgjpos_forms</groupId>
-                               <artifactId>dtgjpos_forms</artifactId>
-                               <version>1.4.12</version>
-                               <scope>provided</scope>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.codehaus.castor</groupId>
-                               <artifactId>castor-xml</artifactId>
-                               <version>1.3.1</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.apache.xmlbeans</groupId>
-                               <artifactId>xmlbeans</artifactId>
-                               <version>2.5.0</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.apache.velocity.tools</groupId>
-                               <artifactId>velocity-tools-generic</artifactId>
-                               <version>1.4</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.apache.velocity</groupId>
-                               <artifactId>velocity</artifactId>
-                               <version>1.6.2</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.tmatesoft.svnkit</groupId>
-                               <artifactId>svnkit</artifactId>
-                               <version>1.3.1</version>
-                       </dependency>
-               </dependencies>
-       </dependencyManagement>
-       <modules>
-               <module>spring-aop-example</module>
-       </modules>
-       <build>
-               <plugins>
-                       <plugin>
-                               <groupId>org.apache.maven.plugins</groupId>
-                               <artifactId>maven-compiler-plugin</artifactId>
-                               <version>2.0.2</version>
-                               <configuration>
-                                       <source>1.6</source>
-                                       <target>1.6</target>
-                                       <encoding>${project.build.sourceEncoding}</encoding>
-                               </configuration>
-                       </plugin>
-                       <!-- Usually you will not need this plugin
-                       <plugin>
-                               <groupId>org.apache.maven.plugins</groupId>
-                               <artifactId>maven-resources-plugin</artifactId>
-                               <version>2.2</version>
-                               <configuration>
-                                       <encoding>${project.build.sourceEncoding}</encoding>
-                               </configuration>
-                       </plugin>
-                       -->
-                       <plugin>
-                               <groupId>org.apache.maven.plugins</groupId>
-                               <artifactId>maven-javadoc-plugin</artifactId>
-                               <version>2.6</version>
-                       </plugin>
-                       <plugin>
-                               <groupId>org.apache.maven.plugins</groupId>
-                               <artifactId>maven-surefire-plugin</artifactId>
-                               <version>2.4.2</version>
-                               <configuration>
-                                       <testFailureIgnore>true</testFailureIgnore>
-                               </configuration>
-                       </plugin>
-                       <plugin>
-                               <groupId>org.codehaus.mojo</groupId>
-                               <artifactId>jdepend-maven-plugin</artifactId>
-                               <version>2.0-beta-2</version>
-                       </plugin>
-                       <plugin>
-                               <groupId>org.apache.maven.plugins</groupId>
-                               <artifactId>maven-jar-plugin</artifactId>
-                               <version>2.3.1</version>
-                               <configuration>
-                                       <archive>
-                                               <manifestEntries>
-                                                       <Specification-Title>${project.description}</Specification-Title>
-                                                       <Specification-Version>${project.version}</Specification-Version>
-                                                       <Specification-Vendor>${project.organization.name}</Specification-Vendor>
-                                                       <Implementation-Title>${project.description}</Implementation-Title>
-                                                       <Implementation-Version>${project.version}</Implementation-Version>
-                                                       <Implementation-Vendor>${project.organization.name}</Implementation-Vendor>
-                                                       <Implementation-Build>${BUILD_TAG}</Implementation-Build>
-                                                       <Implementation-Build-id>${BUILD_ID}</Implementation-Build-id>
-                                                       <Implementation-Build-number>${BUILD_NUMBER}</Implementation-Build-number>
-                                                       <scm-committed-revision>${prefix.committedRevision}</scm-committed-revision>
-                                                       <scm-repository>${prefix.repository}</scm-repository>
-                                                       <scm-path>${prefix.path}</scm-path>                                                           
-                                               </manifestEntries>
-                                       </archive>
-                               </configuration>
-                       </plugin>
-                       <plugin>
-                               <groupId>com.google.code.maven-svn-revision-number-plugin</groupId>
-                               <artifactId>maven-svn-revision-number-plugin</artifactId>
-                               <version>1.6</version>
-                               <executions>
-                                       <execution>
-                                               <goals>
-                                                       <goal>revision</goal>
-                                               </goals>
-                                       </execution>
-                               </executions>
-                               <configuration>
-                                       <entries>
-                                               <entry>
-                                                       <prefix>prefix</prefix>
-                                               </entry>
-                                       </entries>
-                               </configuration>
-                       </plugin>
-               </plugins>
-       </build>
-       <!--We need this for the javadoc and reporting maven plugin -->
-       <distributionManagement>
-               <repository>
-                       <id>releases</id>
-                       <name>releases</name>
-                       <url>http://noserver/artifactory/custom-annotations-libs-releases-local</url>
-               </repository>
-               <snapshotRepository>
-                       <id>snapshots-releases</id>
-                       <name>snapshots-releases</name>
-                       <url>http://noserver/artifactory/custom-annotations-libs-snapshots-local</url>
-               </snapshotRepository>
-               <site>
-                       <id>noserver</id>
-                       <url>file:///mnt/sdb1/data/downloads/jenkins/</url>
-               </site>
+      <dependency>
+        <groupId>cglib</groupId>
+        <artifactId>cglib</artifactId>
+        <version>3.2.1</version>
+      </dependency>
 
-       </distributionManagement>
-       <reporting>
-               <plugins>
-                       <plugin>
-                               <groupId>org.apache.maven.plugins</groupId>
-                               <artifactId>maven-project-info-reports-plugin</artifactId>
-                               <version>2.1.2</version>
-                               <reportSets>
-                                       <reportSet>
-                                               <reports>
-                                                       <report>index</report>
-                                                       <report>dependencies</report>
-                                                       <report>cim</report>
-                                                       <report>issue-tracking</report>
-                                                       <report>scm</report>
-                                                       <report>summary</report>
-                                                       <report>project-team</report>
-                                               </reports>
-                                       </reportSet>
-                               </reportSets>
-                       </plugin>
-                       <plugin>
-                               <groupId>org.apache.maven.plugins</groupId>
-                               <artifactId>maven-javadoc-plugin</artifactId>
-                               <version>2.6.1</version>
-                               <reportSets>
-                                       <reportSet>
-                                               <id>html</id>
-                                               <configuration>
-                                                       <doctitle>MYPROJECT API for ${project.name} ${project.version}</doctitle>
-                                                       <windowtitle>MYPROJECT API for ${project.name} ${project.version}</windowtitle>
-                                               </configuration>
-                                               <reports>
-                                                       <report>javadoc</report>
-                                                       <report>aggregate</report>
-                                               </reports>
-                                       </reportSet>
-                               </reportSets>
-                       </plugin>
-                       <plugin>
-                               <groupId>org.codehaus.mojo</groupId>
-                               <artifactId>taglist-maven-plugin</artifactId>
-                               <version>2.3</version>
-                               <configuration>
-                                       <tags>
-                                               <tag>TODO</tag>
-                                               <tag>@todo</tag>
-                                               <tag>FIXME</tag>
-                                               <tag>XXX</tag>
-                                       </tags>
-                               </configuration>
-                       </plugin>
-                       <plugin>
-                               <groupId>org.apache.maven.plugins</groupId>
-                               <artifactId>maven-surefire-report-plugin</artifactId>
-                               <version>2.4.3</version>
-                               <reportSets>
-                                       <reportSet>
-                                               <id>integration-tests</id>
-                                               <reports>
-                                                       <report>report-only</report>
-                                               </reports>
-                                               <configuration>
-                                                       <outputName>failsafe-report</outputName>
-                                                       <reportsDirectories>
-                                                               <reportsDirectory>target/failsafe-reports</reportsDirectory>
-                                                       </reportsDirectories>
-                                               </configuration>
-                                       </reportSet>
-                                       <reportSet>
-                                               <id>junit-tests</id>
-                                               <reports>
-                                                       <report>report-only</report>
-                                               </reports>
-                                               <configuration>
-                                                       <outputName>surefire-report</outputName>
-                                                       <reportsDirectories>
-                                                               <reportsDirectory>target/surefire-reports</reportsDirectory>
-                                                       </reportsDirectories>
-                                               </configuration>
-                                       </reportSet>
-                               </reportSets>
-                       </plugin>
-               </plugins>
-       </reporting>
-       <properties>
-               <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-               <spring.version>2.5.6</spring.version>
-       </properties>
-       <repositories>
-               <!--
-               <repository>
-                       <id>central-myproject-repo</id>
-                       <name>Internal repository</name>
-                       <url>http://noserver/artifactory/my-repo</url>
-                       <snapshots>
-                               <enabled>false</enabled>
-                       </snapshots>
-               </repository>
-               <repository>
-                       <id>snapshots-releases</id>
-                       <name>snapshots-releases</name>
-                       <url>http://noserver/artifactory/custom-annotations-libs-snapshots-local</url>
-                       <snapshots>
-                               <enabled>true</enabled>
-                       </snapshots>
-               </repository>
-               -->
-       </repositories>
-       <pluginRepositories>
-               <!--
-               <pluginRepository>
-                       <id>central-myproject-plugins-repo</id>
-                       <name>Plugins internal repository</name>
-                       <url>http://noserver/artifactory/plugins-repo</url>
-                       <snapshots>
-                               <enabled>true</enabled>
-                       </snapshots>
-                       <releases>
-                               <enabled>true</enabled>
-                       </releases>
-               </pluginRepository>
-               -->
-       </pluginRepositories>
+      <!--
+          1/3 Required dependency for log4j 2 with slf4j: binding between log4j 2 and slf4j
+      -->
+      <dependency>
+          <groupId>org.apache.logging.log4j</groupId>
+          <artifactId>log4j-slf4j-impl</artifactId>
+          <version>2.3</version>
+      </dependency>
+      <!--
+          2/3 Required dependency for log4j 2 with slf4j: log4j 2 maven plugin (it is the log4j 2 implementation)
+      -->
+      <dependency>
+          <groupId>org.apache.logging.log4j</groupId>
+          <artifactId>log4j-core</artifactId>
+          <version>2.3</version>
+      </dependency>
+      <!-- 
+          3/3 Required dependency for getting rid of commons logging.
+          This is the BRIDGE (no binding) between Jakarta Commons Logging (used by Spring) and whatever
+          I am using for logging (in this case I am using log4j 2)
+          See: http://www.slf4j.org/legacy.html
+          
+          We need exclusions in every dependency using Jakarta Commons Logging (see Spring dependencies below)
+       -->
+      <dependency>
+          <groupId>org.slf4j</groupId>
+          <artifactId>jcl-over-slf4j</artifactId>
+          <version>1.7.12</version>
+      </dependency>
+
+       </dependencies>
+    <build>
+      <plugins>
+          <plugin>
+              <groupId>org.apache.maven.plugins</groupId>
+              <artifactId>maven-compiler-plugin</artifactId>
+              <version>3.3</version>
+              <configuration>
+                  <source>1.8</source>
+                  <target>1.8</target>
+                  <encoding>${project.build.sourceEncoding}</encoding>
+              </configuration>
+          </plugin>
+          <plugin>
+              <groupId>org.apache.maven.plugins</groupId>
+              <artifactId>maven-resources-plugin</artifactId>
+              <version>2.7</version>
+              <configuration>
+                  <encoding>${project.build.sourceEncoding}</encoding>
+              </configuration>
+          </plugin>
+      </plugins>
+    </build>
 </project>
diff --git a/SpringJava/SpringAOP20/spring-aop-example/pom.xml b/SpringJava/SpringAOP20/spring-aop-example/pom.xml
deleted file mode 100644 (file)
index fc21237..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<project
-       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
-       xmlns="http://maven.apache.org/POM/4.0.0" 
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-       
-       <modelVersion>4.0.0</modelVersion>
-       <parent>
-               <artifactId>spring-aop</artifactId>
-               <groupId>de.spring.example</groupId>
-               <version>2.0-SNAPSHOT</version>
-       </parent>
-
-       <artifactId>spring-aop-example</artifactId>
-       <name>spring-aop-example</name>
-       <url>http://maven.apache.org</url>
-
-       <dependencies> 
-               <dependency>
-               <groupId>org.springframework</groupId>
-               <artifactId>spring-aspects</artifactId>
-               <version>2.5.6</version>
-               </dependency>
-               <dependency>
-            <groupId>org.springframework</groupId>
-                       <artifactId>spring-context</artifactId>
-        </dependency>
-               <dependency>
-                       <groupId>cglib</groupId>
-                       <artifactId>cglib-nodep</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>org.springframework</groupId>
-                       <artifactId>spring-aop</artifactId>
-               </dependency>
-       </dependencies>
-</project>
diff --git a/SpringJava/SpringAOP20/spring-aop-example/src/main/java/de/spring/example/GeneralAccess.java b/SpringJava/SpringAOP20/spring-aop-example/src/main/java/de/spring/example/GeneralAccess.java
deleted file mode 100644 (file)
index 3f07587..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-package de.spring.example;
-
-
-/**
- * 
- * This class is not using the AspectJ annotations, so we could use it on JDK 1.4 and below.
- * If we want to use it as an Aspect we may JUST do it using a schema based declaration.
- * What means, you can use this class as an Aspect JUST using an xml Spring declaration. 
- *
- */
-public class GeneralAccess {
-               
-       public void monitor()
-       {
-               System.out.println("I am the Advice monitor for TestB and I will be run before.");
-       }
-}
diff --git a/SpringJava/SpringAOP20/spring-aop-example/src/main/java/de/spring/example/SpringAdvice.java b/SpringJava/SpringAOP20/spring-aop-example/src/main/java/de/spring/example/SpringAdvice.java
deleted file mode 100644 (file)
index 90e345e..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-package de.spring.example;
-
-import java.lang.reflect.Method;
-import org.springframework.aop.MethodBeforeAdvice;
-
-/**
- * 
- * We are using here an Advice of Spring 1.2
- * See: http://static.springsource.org/spring/docs/3.1.0.RC1/spring-framework-reference/html/aop-api.html#aop-api-advice-types
- *
- */
-public class SpringAdvice implements MethodBeforeAdvice {
-
-       public void before(Method m, Object[] args, Object target) throws Throwable {
-               System.out.println("I am the SpringAdvice and I will be run before.");
-       }
-       
-}
diff --git a/SpringJava/SpringAOP20/spring-aop-example/src/main/java/de/spring/example/SpringContextLocator.java b/SpringJava/SpringAOP20/spring-aop-example/src/main/java/de/spring/example/SpringContextLocator.java
deleted file mode 100644 (file)
index d599c8f..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-package de.spring.example;
-
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-
-/**
- *
- */
-public final class SpringContextLocator {
-
-        // Singleton Pattern
-        private static SpringContextLocator instance;
-
-        // Spring ApplicationContext
-        private static ApplicationContext context;
-
-        // Spring Context
-        private static final String SPRING_CONFIG_CONTEXT="spring-config.xml";
-
-
-        /**
-         * Private constructor. Singleton pattern.
-         */
-        private SpringContextLocator() {
-                String[] factoryFiles = null;
-                System.out.println("Loading context files: " + SpringContextLocator.SPRING_CONFIG_CONTEXT);
-
-                factoryFiles = new String[] { SPRING_CONFIG_CONTEXT };
-
-                SpringContextLocator.context = new ClassPathXmlApplicationContext(factoryFiles);
-
-                System.out.println("The context has been loaded successfully!! ");
-        }
-
-        /**
-         * Singleton pattern not thread safety. To use SingletoHolder pattern as the best approximation 
-         * otherwise to use an Enum class (see Effective Java Second Edition and ) if we need serialization.
-         */
-        public static SpringContextLocator getInstance() {
-                if (SpringContextLocator.instance == null) {
-                        SpringContextLocator.instance = new SpringContextLocator();
-                }
-                return SpringContextLocator.instance;
-        }
-
-        /**
-         * Return bean from application context.
-         */
-        public Object getBean(final String name) {
-                return SpringContextLocator.context.getBean(name);
-        }
-}
\ No newline at end of file
diff --git a/SpringJava/SpringAOP20/spring-aop-example/src/main/java/de/spring/example/SpringStart.java b/SpringJava/SpringAOP20/spring-aop-example/src/main/java/de/spring/example/SpringStart.java
deleted file mode 100644 (file)
index 2cf4a1a..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-package de.spring.example;
-
-import de.spring.example.service.TestB;
-import de.spring.example.web.TestA;
-
-public class SpringStart {
-
-       /**
-        * @param args
-        */
-       public static void main(String[] args) {
-               System.out.println("Starting application");
-               SpringContextLocator.getInstance();
-               
-               TestA testA = (TestA) SpringContextLocator.getInstance().getBean("testA");
-               testA.myMethod();
-               
-               TestB testB = (TestB) SpringContextLocator.getInstance().getBean("testB");
-               testB.myMethod();
-       }
-}
diff --git a/SpringJava/SpringAOP20/spring-aop-example/src/main/java/de/spring/example/SystemArchitecture.java b/SpringJava/SpringAOP20/spring-aop-example/src/main/java/de/spring/example/SystemArchitecture.java
deleted file mode 100644 (file)
index f9511b2..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-package de.spring.example;
-
-import org.aspectj.lang.annotation.Pointcut;
-
-/**
- * 
- * Using the @Aspect annotation you could use this class as an Aspect without
- * using a schema based declaration (without using <aop:aspect in the Spring xml file)
- * What means, you could use this class as an Aspect without the xml Spring declaration.
- *
- */
-public class SystemArchitecture {
-       
-       //Coonecting to the execution of any method defined in the 
-       //package: de.spring.example.web
-       //We are connecting the methods defined in that package with this
-       //Pointcut. So, when executing any of those methods defined in that
-       //package we will run the Advice related to this Pointcut (if there is an Advice)
-       //NOTICE:
-       //                      WE ARE NOT USING THE @Aspect ANNOTATION, SO WE CAN USE THIS CLASS AS
-       //          AN ASPECT AND THIS METHOD AS A POINTCUT JUST USING A SCHEMA BASED DECLARATION
-       @Pointcut("execution(* de.spring.example.web.*.*(..))")
-       public void pointCutMethod() 
-       {
-               System.out.println("I am the Pointcut and you will never see me.");
-               //This is the PointCut. 
-               //You can write code here, but it will be useless because while running
-               //the methods connected to the Pointcut, this code will not be executed.
-               //Just the advice will run!!!! :/
-               //Is not this weird? We are here defining a method whose code 
-               //will never be run. When the hell should we write code here?
-               //This is a waste of time and code IMHO. Isn't it?
-       }
-       
-       public void monitor()
-       {
-               System.out.println("I am the Advice monitor for TestA and I will be run before.");
-       }
-}
\ No newline at end of file
diff --git a/SpringJava/SpringAOP20/spring-aop-example/src/main/java/de/spring/example/service/TestB.java b/SpringJava/SpringAOP20/spring-aop-example/src/main/java/de/spring/example/service/TestB.java
deleted file mode 100644 (file)
index 2a95fc8..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-package de.spring.example.service;
-
-public class TestB {
-       public int myMethod()
-       {
-               System.out.println("TestB: The Advice should be run before.");
-               
-               //This value will be caught by the Advice with the @AfterReturning annotation.
-               return 999;
-       }
-}
diff --git a/SpringJava/SpringAOP20/spring-aop-example/src/main/java/de/spring/example/web/TestA.java b/SpringJava/SpringAOP20/spring-aop-example/src/main/java/de/spring/example/web/TestA.java
deleted file mode 100644 (file)
index 058f009..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-package de.spring.example.web;
-
-
-public class TestA {
-       public int myMethod()
-       {
-               System.out.println("TestA: The Advice should be run before.");
-               
-               //This value will be caught by the Advice with the @AfterReturning annotation.
-               return 666;
-       }
-}
diff --git a/SpringJava/SpringAOP20/spring-aop-example/src/main/resources/spring-config.xml b/SpringJava/SpringAOP20/spring-aop-example/src/main/resources/spring-config.xml
deleted file mode 100644 (file)
index 5880dad..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xmlns:context="http://www.springframework.org/schema/context" 
-       xmlns:aop="http://www.springframework.org/schema/aop"
-       xsi:schemaLocation="http://www.springframework.org/schema/beans 
-                                                  http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
-                                                  http://www.springframework.org/schema/aop 
-                                                  http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
-                                                  http://www.springframework.org/schema/context 
-                                                  http://www.springframework.org/schema/context/spring-context-2.5.xsd
-                                                  http://www.springframework.org/schema/tx 
-                                                  http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
-  
-        <!-- 
-               To force CGLIB proxying when using Spring AOP
-               See: http://static.springsource.org/spring/docs/3.1.0.RC1/spring-framework-reference/html/aop.html#aop-proxying
-        -->
-     <aop:config proxy-target-class="true">
-       <aop:aspect id="myAspectSchemaBased" ref="generalAccess">
-               <aop:pointcut id="aspectOperation" 
-                                         expression="execution(* de.spring.example.service.*.*(..))"/>
-               <aop:before pointcut-ref="aspectOperation" method="monitor"/>
-               </aop:aspect>
-     </aop:config>
-     
-       
-       <aop:config proxy-target-class="true">
-       <aop:aspect id="myAspectwithAnnotations" ref="systemArchitecture">
-               <!-- 
-                       See: http://static.springsource.org/spring/docs/3.1.0.RC1/spring-framework-reference/html/aop.html#aop-schema-pointcuts
-                       "Note that the pointcut expression itself is using the same AspectJ pointcut expression 
-                       language as described in Section 8.2, “@AspectJ support”. If you are using the schema 
-                       based declaration style with Java 5, you can refer to named pointcuts defined in types 
-                       (@Aspects) within the pointcut expression, but this feature is not available on JDK 1.4 and below 
-                       (it relies on the Java 5 specific AspectJ reflection APIs). On JDK 1.5 therefore, another way of 
-                       defining the above pointcut would be:
-                -->
-               <aop:pointcut id="pointCutAspect" 
-                                         expression="de.spring.example.SystemArchitecture.pointCutMethod()"/>
-            <!-- This will be the Advice. You can use the same class for it or you can use the aop:advisor
-                xml Spring annotation. In that case you have to use an Advice class from AOP support of Spring 1.2
-                (below you can see an example of this)
-             -->
-               <aop:before pointcut-ref="pointCutAspect" method="monitor"/>
-               </aop:aspect>
-    </aop:config>
-     
-     
-    <!-- 
-               We are using AOP support from Spring 1.2 :/ for this Advice
-               (we use Spring beans as advices and we can use the AOP support from Spring 1.2 for this)
-               We can use and mix whatever we want. Spring is powerful but at the same time it can be a complete mess.
-        -->
-       <aop:config proxy-target-class="true">
-       <aop:advisor pointcut="de.spring.example.SystemArchitecture.pointCutMethod()"
-                                advice-ref="springAdvice" />
-    </aop:config>
-       
-       <bean id="testA" class="de.spring.example.web.TestA">
-       
-    </bean>
-    
-    <bean id="testB" class="de.spring.example.service.TestB">
-       
-    </bean>
-    
-    <bean id="generalAccess" class="de.spring.example.GeneralAccess">
-       
-    </bean>
-    
-    <bean id="systemArchitecture" class="de.spring.example.SystemArchitecture">
-       
-    </bean>
-    
-    <bean id="springAdvice" class="de.spring.example.SpringAdvice">
-       
-    </bean>
-    
-</beans>
diff --git a/SpringJava/SpringAOP20/src/main/java/de/spring/example/GeneralAccess.java b/SpringJava/SpringAOP20/src/main/java/de/spring/example/GeneralAccess.java
new file mode 100644 (file)
index 0000000..ce30630
--- /dev/null
@@ -0,0 +1,21 @@
+package de.spring.example;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * 
+ * This class is not using the AspectJ annotations, so we could use it on JDK 1.4 and below.
+ * If we want to use it as an Aspect we may JUST do it using a schema based declaration.
+ * What means, you can use this class as an Aspect JUST using an xml Spring declaration. 
+ *
+ */
+public class GeneralAccess {
+       private static final Logger LOGGER = LoggerFactory.getLogger(GeneralAccess.class);
+
+               
+       public void monitor()
+       {
+               LOGGER.info("I am the Advice monitor for TestB and I will be run before.");
+       }
+}
diff --git a/SpringJava/SpringAOP20/src/main/java/de/spring/example/SpringAdvice.java b/SpringJava/SpringAOP20/src/main/java/de/spring/example/SpringAdvice.java
new file mode 100644 (file)
index 0000000..1555575
--- /dev/null
@@ -0,0 +1,23 @@
+package de.spring.example;
+
+import java.lang.reflect.Method;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.aop.MethodBeforeAdvice;
+
+/**
+ * 
+ * We are using here an Advice of Spring 1.2
+ * See: http://static.springsource.org/spring/docs/3.1.0.RC1/spring-framework-reference/html/aop-api.html#aop-api-advice-types
+ *
+ */
+public class SpringAdvice implements MethodBeforeAdvice {
+       private static final Logger LOGGER = LoggerFactory.getLogger(SpringAdvice.class);
+
+
+       public void before(Method m, Object[] args, Object target) throws Throwable {
+               LOGGER.info("I am the SpringAdvice and I will be run before.");
+       }
+       
+}
diff --git a/SpringJava/SpringAOP20/src/main/java/de/spring/example/SpringContextLocator.java b/SpringJava/SpringAOP20/src/main/java/de/spring/example/SpringContextLocator.java
new file mode 100644 (file)
index 0000000..d599c8f
--- /dev/null
@@ -0,0 +1,53 @@
+package de.spring.example;
+
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+
+/**
+ *
+ */
+public final class SpringContextLocator {
+
+        // Singleton Pattern
+        private static SpringContextLocator instance;
+
+        // Spring ApplicationContext
+        private static ApplicationContext context;
+
+        // Spring Context
+        private static final String SPRING_CONFIG_CONTEXT="spring-config.xml";
+
+
+        /**
+         * Private constructor. Singleton pattern.
+         */
+        private SpringContextLocator() {
+                String[] factoryFiles = null;
+                System.out.println("Loading context files: " + SpringContextLocator.SPRING_CONFIG_CONTEXT);
+
+                factoryFiles = new String[] { SPRING_CONFIG_CONTEXT };
+
+                SpringContextLocator.context = new ClassPathXmlApplicationContext(factoryFiles);
+
+                System.out.println("The context has been loaded successfully!! ");
+        }
+
+        /**
+         * Singleton pattern not thread safety. To use SingletoHolder pattern as the best approximation 
+         * otherwise to use an Enum class (see Effective Java Second Edition and ) if we need serialization.
+         */
+        public static SpringContextLocator getInstance() {
+                if (SpringContextLocator.instance == null) {
+                        SpringContextLocator.instance = new SpringContextLocator();
+                }
+                return SpringContextLocator.instance;
+        }
+
+        /**
+         * Return bean from application context.
+         */
+        public Object getBean(final String name) {
+                return SpringContextLocator.context.getBean(name);
+        }
+}
\ No newline at end of file
diff --git a/SpringJava/SpringAOP20/src/main/java/de/spring/example/SpringStart.java b/SpringJava/SpringAOP20/src/main/java/de/spring/example/SpringStart.java
new file mode 100644 (file)
index 0000000..c6ed090
--- /dev/null
@@ -0,0 +1,25 @@
+package de.spring.example;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import de.spring.example.service.TestB;
+import de.spring.example.web.TestA;
+
+public class SpringStart {
+       private static final Logger LOGGER = LoggerFactory.getLogger(SpringStart.class);
+
+       /**
+        * @param args
+        */
+       public static void main(String[] args) {
+               LOGGER.info("Starting application");
+               SpringContextLocator.getInstance();
+               
+               TestA testA = (TestA) SpringContextLocator.getInstance().getBean("testA");
+               testA.myMethod();
+               
+               TestB testB = (TestB) SpringContextLocator.getInstance().getBean("testB");
+               testB.myMethod();
+       }
+}
diff --git a/SpringJava/SpringAOP20/src/main/java/de/spring/example/SystemArchitecture.java b/SpringJava/SpringAOP20/src/main/java/de/spring/example/SystemArchitecture.java
new file mode 100644 (file)
index 0000000..822f240
--- /dev/null
@@ -0,0 +1,43 @@
+package de.spring.example;
+
+import org.aspectj.lang.annotation.Pointcut;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * 
+ * Using the @Aspect annotation you could use this class as an Aspect without
+ * using a schema based declaration (without using <aop:aspect in the Spring xml file)
+ * What means, you could use this class as an Aspect without the xml Spring declaration.
+ *
+ */
+public class SystemArchitecture {
+       private static final Logger LOGGER = LoggerFactory.getLogger(SystemArchitecture.class);
+
+       
+       //Coonecting to the execution of any method defined in the 
+       //package: de.spring.example.web
+       //We are connecting the methods defined in that package with this
+       //Pointcut. So, when executing any of those methods defined in that
+       //package we will run the Advice related to this Pointcut (if there is an Advice)
+       //NOTICE:
+       //                      WE ARE NOT USING THE @Aspect ANNOTATION, SO WE CAN USE THIS CLASS AS
+       //          AN ASPECT AND THIS METHOD AS A POINTCUT JUST USING A SCHEMA BASED DECLARATION
+       @Pointcut("execution(* de.spring.example.web.*.*(..))")
+       public void pointCutMethod() 
+       {
+               LOGGER.info("I am the Pointcut and you will never see me.");
+               //This is the PointCut. 
+               //You can write code here, but it will be useless because while running
+               //the methods connected to the Pointcut, this code will not be executed.
+               //Just the advice will run!!!! :/
+               //Is not this weird? We are here defining a method whose code 
+               //will never be run. When the hell should we write code here?
+               //This is a waste of time and code IMHO. Isn't it?
+       }
+       
+       public void monitor()
+       {
+               LOGGER.info("I am the Advice monitor for TestA and I will be run before.");
+       }
+}
\ No newline at end of file
diff --git a/SpringJava/SpringAOP20/src/main/java/de/spring/example/service/TestB.java b/SpringJava/SpringAOP20/src/main/java/de/spring/example/service/TestB.java
new file mode 100644 (file)
index 0000000..22f186d
--- /dev/null
@@ -0,0 +1,16 @@
+package de.spring.example.service;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TestB {
+       private static final Logger LOGGER = LoggerFactory.getLogger(TestB.class);
+
+       public int myMethod()
+       {
+               LOGGER.info("TestB: The Advice should be run before.");
+               
+               //This value will be caught by the Advice with the @AfterReturning annotation.
+               return 999;
+       }
+}
diff --git a/SpringJava/SpringAOP20/src/main/java/de/spring/example/web/TestA.java b/SpringJava/SpringAOP20/src/main/java/de/spring/example/web/TestA.java
new file mode 100644 (file)
index 0000000..0b40603
--- /dev/null
@@ -0,0 +1,16 @@
+package de.spring.example.web;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TestA {
+       private static final Logger LOGGER = LoggerFactory.getLogger(TestA.class);
+
+       public int myMethod()
+       {
+               LOGGER.info("TestA: The Advice should be run before.");
+               
+               //This value will be caught by the Advice with the @AfterReturning annotation.
+               return 666;
+       }
+}
diff --git a/SpringJava/SpringAOP20/src/main/resources/log4j2.xml b/SpringJava/SpringAOP20/src/main/resources/log4j2.xml
new file mode 100644 (file)
index 0000000..8b3fc3f
--- /dev/null
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- 
+       status: The level of internal Log4j events that should be logged to the console.
+       Valid values for this attribute are "trace", "debug", "info", "warn", "error" and "fatal".
+       
+       monitorInterval: The minimum amount of time, in seconds, that must elapse before the file configuration is checked for changes.
+       
+       
+       see https://logging.apache.org/log4j/2.x/manual/configuration.html
+ -->
+<Configuration status="error" strict="true" monitorInterval="30"
+                name="XMLConfigTest" packages="org.apache.logging.log4j.test">
+                
+       <!--
+               ALL > TRACE > DEBUG > INFO > WARN > ERROR > OFF
+               
+               ERROR by default.
+       -->
+                
+    <Appenders>
+        <Appender type="Console" name="STDOUT">
+            <PatternLayout pattern="%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n"/>
+        </Appender>
+    </Appenders>
+    <Loggers>
+    
+               <!-- 
+               General logging Spring.
+        -->
+        <Logger name="org.springframework" level="INFO" additivity="false">
+            <AppenderRef ref="STDOUT" />
+        </Logger>
+    
+
+               <!-- 
+                       Anything else will be using TRACE logging level.
+                -->        
+        <Root level="DEBUG">
+            <AppenderRef ref="STDOUT"/>
+        </Root>
+    </Loggers>
+</Configuration>
diff --git a/SpringJava/SpringAOP20/src/main/resources/spring-config.xml b/SpringJava/SpringAOP20/src/main/resources/spring-config.xml
new file mode 100644 (file)
index 0000000..bda1080
--- /dev/null
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:context="http://www.springframework.org/schema/context" 
+       xmlns:aop="http://www.springframework.org/schema/aop"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans 
+                                                  http://www.springframework.org/schema/beans/spring-beans.xsd
+                                                  http://www.springframework.org/schema/aop 
+                                                  http://www.springframework.org/schema/aop/spring-aop.xsd
+                                                  http://www.springframework.org/schema/context 
+                                                  http://www.springframework.org/schema/context/spring-context.xsd
+                                                  http://www.springframework.org/schema/tx 
+                                                  http://www.springframework.org/schema/tx/spring-tx.xsd">
+  
+        <!-- 
+               To force CGLIB proxying when using Spring AOP
+               See: http://static.springsource.org/spring/docs/3.1.0.RC1/spring-framework-reference/html/aop.html#aop-proxying
+        -->
+     <aop:config proxy-target-class="true">
+       <aop:aspect id="myAspectSchemaBased" ref="generalAccess">
+               <aop:pointcut id="aspectOperation" 
+                                         expression="execution(* de.spring.example.service.*.*(..))"/>
+               <aop:before pointcut-ref="aspectOperation" method="monitor"/>
+               </aop:aspect>
+     </aop:config>
+     
+       
+       <aop:config proxy-target-class="true">
+       <aop:aspect id="myAspectwithAnnotations" ref="systemArchitecture">
+               <!-- 
+                       See: http://static.springsource.org/spring/docs/3.1.0.RC1/spring-framework-reference/html/aop.html#aop-schema-pointcuts
+                       "Note that the pointcut expression itself is using the same AspectJ pointcut expression 
+                       language as described in Section 8.2, “@AspectJ support”. If you are using the schema 
+                       based declaration style with Java 5, you can refer to named pointcuts defined in types 
+                       (@Aspects) within the pointcut expression, but this feature is not available on JDK 1.4 and below 
+                       (it relies on the Java 5 specific AspectJ reflection APIs). On JDK 1.5 therefore, another way of 
+                       defining the above pointcut would be:
+                -->
+               <aop:pointcut id="pointCutAspect" 
+                                         expression="de.spring.example.SystemArchitecture.pointCutMethod()"/>
+            <!-- This will be the Advice. You can use the same class for it or you can use the aop:advisor
+                xml Spring annotation. In that case you have to use an Advice class from AOP support of Spring 1.2
+                (below you can see an example of this)
+             -->
+               <aop:before pointcut-ref="pointCutAspect" method="monitor"/>
+               </aop:aspect>
+    </aop:config>
+     
+     
+    <!-- 
+               We are using AOP support from Spring 1.2 :/ for this Advice
+               (we use Spring beans as advices and we can use the AOP support from Spring 1.2 for this)
+               We can use and mix whatever we want. Spring is powerful but at the same time it can be a complete mess.
+        -->
+       <aop:config proxy-target-class="true">
+       <aop:advisor pointcut="de.spring.example.SystemArchitecture.pointCutMethod()"
+                                advice-ref="springAdvice" />
+    </aop:config>
+       
+       <bean id="testA" class="de.spring.example.web.TestA">
+       
+    </bean>
+    
+    <bean id="testB" class="de.spring.example.service.TestB">
+       
+    </bean>
+    
+    <bean id="generalAccess" class="de.spring.example.GeneralAccess">
+       
+    </bean>
+    
+    <bean id="systemArchitecture" class="de.spring.example.SystemArchitecture">
+       
+    </bean>
+    
+    <bean id="springAdvice" class="de.spring.example.SpringAdvice">
+       
+    </bean>
+    
+</beans>
index 61dfe24..be48cff 100644 (file)
 <?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" 
-        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
-        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 
+<project
+       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+       xmlns="http://maven.apache.org/POM/4.0.0" 
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+       
        <modelVersion>4.0.0</modelVersion>
-       <groupId>de.spring.example</groupId>
+    <groupId>de.spring.example</groupId>
        <artifactId>spring-aspectj</artifactId>
-       <version>2.0-SNAPSHOT</version>
-       <name>spring-aspect</name>
-       <url>http://www.myorganization.de</url>
-       <description>Spring AspectJ with Spring Libraries</description>
-       <organization>
-               <name>MyOrganization</name>
-               <url>http://www.myorganization.de</url>
-       </organization>
-       <packaging>pom</packaging>
-       <issueManagement>
-               <system>trac</system>
-               <url>http://noserver/</url>
-       </issueManagement>
-       <ciManagement>
-               <system>jenkins</system>
-               <url>http://noserver/jenkins/</url>
-       </ciManagement>
-       <scm>
-               <developerConnection>scm:svn:http://noserver</developerConnection>
-               <url>http://noserver</url>
-       </scm>
-       <dependencies>
-               <dependency>
-                       <groupId>com.sun.jdmk</groupId>
-                       <artifactId>jmxtools</artifactId>
-                       <version>1.2.1</version>
-               </dependency>
-               <dependency>
-                       <groupId>javax.activation</groupId>
-                       <artifactId>activation</artifactId>
-                       <version>1.1</version>
-               </dependency>
-               <dependency>
-                       <groupId>log4j</groupId>
-                       <artifactId>log4j</artifactId>
-                       <version>1.2.15</version>
-                       <exclusions>
-                               <exclusion>
-                                       <groupId>com.sun.jdmk</groupId>
-                                       <artifactId>jmxtools</artifactId>
-                               </exclusion>
-                               <exclusion>
-                                       <groupId>com.sun.jmx</groupId>
-                                       <artifactId>jmxri</artifactId>
-                               </exclusion>
-                               <exclusion>
-                                       <groupId>javax.mail</groupId>
-                                       <artifactId>mail</artifactId>
-                               </exclusion>
-                               <exclusion>
-                                       <groupId>javax.jms</groupId>
-                                       <artifactId>jms</artifactId>
-                               </exclusion>
-                       </exclusions>
-               </dependency>
-               <dependency>
-                       <groupId>junit</groupId>
-                       <artifactId>junit</artifactId>
-                       <version>4.4</version>
-                       <scope>test</scope>
-               </dependency>
-       </dependencies>
-       <dependencyManagement>
-               <dependencies>
-                       <dependency>
-                               <groupId>c3p0</groupId>
-                               <artifactId>c3p0</artifactId>
-                               <version>0.9.1.2</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>cglib</groupId>
-                               <artifactId>cglib-nodep</artifactId>
-                               <version>2.1_3</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>commons-collections</groupId>
-                               <artifactId>commons-collections</artifactId>
-                               <version>3.2.1</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>commons-configuration</groupId>
-                               <artifactId>commons-configuration</artifactId>
-                               <version>1.6</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>commons-dbcp</groupId>
-                               <artifactId>commons-dbcp</artifactId>
-                               <version>1.2.2</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>commons-io</groupId>
-                               <artifactId>commons-io</artifactId>
-                               <version>1.4</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>commons-lang</groupId>
-                               <artifactId>commons-lang</artifactId>
-                               <version>2.4</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>commons-logging</groupId>
-                               <artifactId>commons-logging</artifactId>
-                               <version>1.1.1</version>
-                       </dependency>
-                        <dependency>
-                               <groupId>commons-net</groupId>
-                                <artifactId>commons-net</artifactId>
-                               <version>2.0</version>
-                        </dependency>
-                       <dependency>
-                               <groupId>commons-pool</groupId>
-                               <artifactId>commons-pool</artifactId>
-                               <version>1.3</version>
-                       </dependency> 
-                       <dependency>
-                               <groupId>com.h2database</groupId>
-                               <artifactId>h2</artifactId>
-                               <version>1.2.130</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>dom4j</groupId>
-                               <artifactId>dom4j</artifactId>
-                               <version>1.6.1</version>
-                               <exclusions>
-                                       <exclusion>
-                                               <groupId>xml-apis</groupId>
-                                               <artifactId>xml-apis</artifactId>
-                                       </exclusion>
-                               </exclusions>
-                       </dependency>
-                       <dependency>
-                               <groupId>hsqldb</groupId>
-                               <artifactId>hsqldb</artifactId>
-                               <version>1.8.0.7</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>javatar</groupId>
-                               <artifactId>javatar</artifactId>
-                               <version>2.5</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>jpos</groupId>
-                               <artifactId>jpos</artifactId>
-                               <version>1.12.2</version>
-                               <scope>provided</scope>
-                       </dependency>
-                       <dependency>
-                               <groupId>jpos</groupId>
-                               <artifactId>jpos-controls</artifactId>
-                               <version>1.12.2</version>
-                               <scope>provided</scope>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.python</groupId>
-                               <artifactId>jython</artifactId>
-                               <version>2.5.2b2</version>
-                       </dependency>           
-                       <dependency>
-                               <groupId>urbanophile</groupId>
-                               <artifactId>java-getopt</artifactId>
-                               <version>1.0.13</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>mysql</groupId>
-                               <artifactId>mysql-connector-java</artifactId>
-                               <version>5.1.6</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.apache.ibatis</groupId>
-                               <artifactId>ibatis-sqlmap</artifactId>
-                               <version>2.3.4.726</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.apache.mina</groupId>
-                               <artifactId>mina-core</artifactId>
-                               <version>2.0.0-M6</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.aspectj</groupId>
-                               <artifactId>aspectjrt</artifactId>
-                               <version>1.6.5</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.aspectj</groupId>
-                               <artifactId>aspectjweaver</artifactId>
-                               <version>1.6.5</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.dbunit</groupId>
-                               <artifactId>dbunit</artifactId>
-                               <version>2.4.4</version>
-                               <scope>test</scope>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.eclipse.jetty</groupId>
-                               <artifactId>jetty-continuation</artifactId>
-                               <version>7.0.0.v20091005</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.eclipse.jetty</groupId>
-                               <artifactId>jetty-http</artifactId>
-                               <version>7.0.0.v20091005</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.eclipse.jetty</groupId>
-                               <artifactId>jetty-io</artifactId>
-                               <version>7.0.0.v20091005</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.eclipse.jetty</groupId>
-                               <artifactId>jetty-security</artifactId>
-                               <version>7.0.0.v20091005</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.eclipse.jetty</groupId>
-                               <artifactId>jetty-server</artifactId>
-                               <version>7.0.0.v20091005</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.eclipse.jetty</groupId>
-                               <artifactId>jetty-servlet</artifactId>
-                               <version>7.0.0.v20091005</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.eclipse.jetty</groupId>
-                               <artifactId>jetty-webapp</artifactId>
-                               <version>7.0.0.v20091005</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.eclipse.jetty</groupId>
-                               <artifactId>jetty-util</artifactId>
-                               <version>7.0.0.v20091005</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.eclipse.jetty</groupId>
-                               <artifactId>jetty-xml</artifactId>
-                               <version>7.0.0.v20091005</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.slf4j</groupId>
-                               <artifactId>slf4j-api</artifactId>
-                               <version>1.5.2</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.slf4j</groupId>
-                               <artifactId>slf4j-log4j12</artifactId>
-                               <version>1.5.2</version>
-                               <exclusions>
-                                       <exclusion>
-                                               <groupId>log4j</groupId>
-                                               <artifactId>log4j</artifactId>
-                                       </exclusion>
-                               </exclusions>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.springframework</groupId>
-                               <artifactId>spring-aop</artifactId>
-                               <version>${spring.version}</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.springframework</groupId>
-                               <artifactId>spring-beans</artifactId>
-                               <version>${spring.version}</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.springframework</groupId>
-                               <artifactId>spring-core</artifactId>
-                               <version>${spring.version}</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.springframework</groupId>
-                               <artifactId>spring-context</artifactId>
-                               <version>${spring.version}</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.springframework</groupId>
-                               <artifactId>spring-jdbc</artifactId>
-                               <version>${spring.version}</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.springframework</groupId>
-                               <artifactId>spring-tx</artifactId>
-                               <version>${spring.version}</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.springframework</groupId>
-                               <artifactId>spring-web</artifactId>
-                               <version>${spring.version}</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.springframework</groupId>
-                               <artifactId>spring-webmvc</artifactId>
-                               <version>${spring.version}</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.springframework</groupId>
-                                       <artifactId>spring-context-support</artifactId>
-                               <version>${spring.version}</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.springframework</groupId>
-                               <artifactId>spring-test</artifactId>
-                               <version>${spring.version}</version>
-                               <scope>test</scope>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.springframework.batch</groupId>
-                               <artifactId>spring-batch-test</artifactId>
-                               <version>2.0.4.RELEASE</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.springframework.batch</groupId>
-                               <artifactId>spring-batch-core</artifactId>
-                               <version>2.0.4.RELEASE</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.springframework.batch</groupId>
-                               <artifactId>spring-batch-infrastructure</artifactId>
-                               <version>2.0.4.RELEASE</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.springframework</groupId>
-                               <artifactId>spring-orm</artifactId>
-                               <version>${spring.version}</version>
-                       </dependency>
-                       <dependency>
-                           <groupId>net.sf.ehcache</groupId>
-                           <artifactId>ehcache</artifactId>
-                           <version>1.6.2</version>
-                       </dependency>
-                       <dependency>
-                           <groupId>org.springmodules</groupId>
-                           <artifactId>spring-modules-cache</artifactId>
-                           <version>0.9</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>p6spy</groupId>
-                               <artifactId>p6spy</artifactId>
-                               <version>1.3</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>javax.transaction</groupId>
-                               <artifactId>jta</artifactId>
-                               <version>1.0.1B</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>javax.servlet</groupId>
-                               <artifactId>servlet-api</artifactId>
-                               <version>2.5</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>com.caucho</groupId>
-                               <artifactId>hessian</artifactId>
-                               <version>3.1.6</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.codehaus.jettison</groupId>
-                               <artifactId>jettison</artifactId>
-                               <version>1.0</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>com.thoughtworks.xstream</groupId>
-                               <artifactId>xstream</artifactId>
-                               <version>1.3</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.ini4j</groupId>
-                               <artifactId>ini4j</artifactId>
-                               <version>0.5.1</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.easymock</groupId>
-                               <artifactId>easymock</artifactId>
-                               <version>2.4</version>
-                               <scope>test</scope>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.easymock</groupId>
-                               <artifactId>easymockclassextension</artifactId>
-                               <version>2.4</version>
-                               <scope>test</scope>
-                       </dependency>
+    <version>2.0-SNAPSHOT</version>
+       <name>spring-aspectj</name>
+       <url>http://gumartinm.name</url>
+    <properties>
+      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+       <dependencies> 
+       <dependency>
+           <groupId>org.springframework</groupId>
+           <artifactId>spring-context</artifactId>
+           <version>4.2.5.RELEASE</version>
+           <!-- 
+               Required dependency for getting rid of commons logging and use my own logging library
+               (in my case I decided to use log4j 2 under slf4j)
+           -->
+           <exclusions>
+               <exclusion>
+                   <groupId>commons-logging</groupId>
+                   <artifactId>commons-logging</artifactId>
+               </exclusion>
+           </exclusions>
+       </dependency>
+      <dependency>
+          <groupId>org.springframework</groupId>
+          <artifactId>spring-aspects</artifactId>
+          <version>4.2.5.RELEASE</version>
+          <!-- 
+              Required dependency for getting rid of commons logging and use my own logging library
+              (in my case I decided to use log4j 2 under slf4j)
+          -->
+          <exclusions>
+              <exclusion>
+                  <groupId>commons-logging</groupId>
+                  <artifactId>commons-logging</artifactId>
+              </exclusion>
+          </exclusions>
+      </dependency>
+      <dependency>
+          <groupId>org.springframework</groupId>
+          <artifactId>spring-aop</artifactId>
+          <version>4.2.5.RELEASE</version>
+          <!-- 
+              Required dependency for getting rid of commons logging and use my own logging library
+              (in my case I decided to use log4j 2 under slf4j)
+          -->
+          <exclusions>
+              <exclusion>
+                  <groupId>commons-logging</groupId>
+                  <artifactId>commons-logging</artifactId>
+              </exclusion>
+          </exclusions>
+      </dependency>
 
-                       <dependency>
-                               <groupId>org.apache.commons</groupId>
-                               <artifactId>commons-compress</artifactId>
-                               <version>1.0</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.apache.commons</groupId>
-                               <artifactId>commons-math</artifactId>
-                               <version>2.0</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>dtgjpos_forms</groupId>
-                               <artifactId>dtgjpos_forms</artifactId>
-                               <version>1.4.12</version>
-                               <scope>provided</scope>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.codehaus.castor</groupId>
-                               <artifactId>castor-xml</artifactId>
-                               <version>1.3.1</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.apache.xmlbeans</groupId>
-                               <artifactId>xmlbeans</artifactId>
-                               <version>2.5.0</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.apache.velocity.tools</groupId>
-                               <artifactId>velocity-tools-generic</artifactId>
-                               <version>1.4</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.apache.velocity</groupId>
-                               <artifactId>velocity</artifactId>
-                               <version>1.6.2</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.tmatesoft.svnkit</groupId>
-                               <artifactId>svnkit</artifactId>
-                               <version>1.3.1</version>
-                       </dependency>
-               </dependencies>
-       </dependencyManagement>
-       <modules>
-               <module>spring-aspectj-example</module>
-       </modules>
-       <build>
-               <plugins>
-                       <plugin>
-                               <groupId>org.apache.maven.plugins</groupId>
-                               <artifactId>maven-compiler-plugin</artifactId>
-                               <version>2.0.2</version>
-                               <configuration>
-                                       <source>1.6</source>
-                                       <target>1.6</target>
-                                       <encoding>${project.build.sourceEncoding}</encoding>
-                               </configuration>
-                       </plugin>
-                       <!-- Usually you will not need this plugin
-                       <plugin>
-                               <groupId>org.apache.maven.plugins</groupId>
-                               <artifactId>maven-resources-plugin</artifactId>
-                               <version>2.2</version>
-                               <configuration>
-                                       <encoding>${project.build.sourceEncoding}</encoding>
-                               </configuration>
-                       </plugin>
-                       -->
-                       <plugin>
-                               <groupId>org.apache.maven.plugins</groupId>
-                               <artifactId>maven-javadoc-plugin</artifactId>
-                               <version>2.6</version>
-                       </plugin>
-                       <plugin>
-                               <groupId>org.apache.maven.plugins</groupId>
-                               <artifactId>maven-surefire-plugin</artifactId>
-                               <version>2.4.2</version>
-                               <configuration>
-                                       <testFailureIgnore>true</testFailureIgnore>
-                               </configuration>
-                       </plugin>
-                       <plugin>
-                               <groupId>org.codehaus.mojo</groupId>
-                               <artifactId>jdepend-maven-plugin</artifactId>
-                               <version>2.0-beta-2</version>
-                       </plugin>
-                       <plugin>
-                               <groupId>org.apache.maven.plugins</groupId>
-                               <artifactId>maven-jar-plugin</artifactId>
-                               <version>2.3.1</version>
-                               <configuration>
-                                       <archive>
-                                               <manifestEntries>
-                                                       <Specification-Title>${project.description}</Specification-Title>
-                                                       <Specification-Version>${project.version}</Specification-Version>
-                                                       <Specification-Vendor>${project.organization.name}</Specification-Vendor>
-                                                       <Implementation-Title>${project.description}</Implementation-Title>
-                                                       <Implementation-Version>${project.version}</Implementation-Version>
-                                                       <Implementation-Vendor>${project.organization.name}</Implementation-Vendor>
-                                                       <Implementation-Build>${BUILD_TAG}</Implementation-Build>
-                                                       <Implementation-Build-id>${BUILD_ID}</Implementation-Build-id>
-                                                       <Implementation-Build-number>${BUILD_NUMBER}</Implementation-Build-number>
-                                                       <scm-committed-revision>${prefix.committedRevision}</scm-committed-revision>
-                                                       <scm-repository>${prefix.repository}</scm-repository>
-                                                       <scm-path>${prefix.path}</scm-path>                                                           
-                                               </manifestEntries>
-                                       </archive>
-                               </configuration>
-                       </plugin>
-                       <plugin>
-                               <groupId>com.google.code.maven-svn-revision-number-plugin</groupId>
-                               <artifactId>maven-svn-revision-number-plugin</artifactId>
-                               <version>1.6</version>
-                               <executions>
-                                       <execution>
-                                               <goals>
-                                                       <goal>revision</goal>
-                                               </goals>
-                                       </execution>
-                               </executions>
-                               <configuration>
-                                       <entries>
-                                               <entry>
-                                                       <prefix>prefix</prefix>
-                                               </entry>
-                                       </entries>
-                               </configuration>
-                       </plugin>
-               </plugins>
-       </build>
-       <!--We need this for the javadoc and reporting maven plugin -->
-       <distributionManagement>
-               <repository>
-                       <id>releases</id>
-                       <name>releases</name>
-                       <url>http://noserver/artifactory/custom-annotations-libs-releases-local</url>
-               </repository>
-               <snapshotRepository>
-                       <id>snapshots-releases</id>
-                       <name>snapshots-releases</name>
-                       <url>http://noserver/artifactory/custom-annotations-libs-snapshots-local</url>
-               </snapshotRepository>
-               <site>
-                       <id>noserver</id>
-                       <url>file:///mnt/sdb1/data/downloads/jenkins/</url>
-               </site>
+      <dependency>
+        <groupId>cglib</groupId>
+        <artifactId>cglib</artifactId>
+        <version>3.2.1</version>
+      </dependency>
 
-       </distributionManagement>
-       <reporting>
-               <plugins>
-                       <plugin>
-                               <groupId>org.apache.maven.plugins</groupId>
-                               <artifactId>maven-project-info-reports-plugin</artifactId>
-                               <version>2.1.2</version>
-                               <reportSets>
-                                       <reportSet>
-                                               <reports>
-                                                       <report>index</report>
-                                                       <report>dependencies</report>
-                                                       <report>cim</report>
-                                                       <report>issue-tracking</report>
-                                                       <report>scm</report>
-                                                       <report>summary</report>
-                                                       <report>project-team</report>
-                                               </reports>
-                                       </reportSet>
-                               </reportSets>
-                       </plugin>
-                       <plugin>
-                               <groupId>org.apache.maven.plugins</groupId>
-                               <artifactId>maven-javadoc-plugin</artifactId>
-                               <version>2.6.1</version>
-                               <reportSets>
-                                       <reportSet>
-                                               <id>html</id>
-                                               <configuration>
-                                                       <doctitle>MYPROJECT API for ${project.name} ${project.version}</doctitle>
-                                                       <windowtitle>MYPROJECT API for ${project.name} ${project.version}</windowtitle>
-                                               </configuration>
-                                               <reports>
-                                                       <report>javadoc</report>
-                                                       <report>aggregate</report>
-                                               </reports>
-                                       </reportSet>
-                               </reportSets>
-                       </plugin>
-                       <plugin>
-                               <groupId>org.codehaus.mojo</groupId>
-                               <artifactId>taglist-maven-plugin</artifactId>
-                               <version>2.3</version>
-                               <configuration>
-                                       <tags>
-                                               <tag>TODO</tag>
-                                               <tag>@todo</tag>
-                                               <tag>FIXME</tag>
-                                               <tag>XXX</tag>
-                                       </tags>
-                               </configuration>
-                       </plugin>
-                       <plugin>
-                               <groupId>org.apache.maven.plugins</groupId>
-                               <artifactId>maven-surefire-report-plugin</artifactId>
-                               <version>2.4.3</version>
-                               <reportSets>
-                                       <reportSet>
-                                               <id>integration-tests</id>
-                                               <reports>
-                                                       <report>report-only</report>
-                                               </reports>
-                                               <configuration>
-                                                       <outputName>failsafe-report</outputName>
-                                                       <reportsDirectories>
-                                                               <reportsDirectory>target/failsafe-reports</reportsDirectory>
-                                                       </reportsDirectories>
-                                               </configuration>
-                                       </reportSet>
-                                       <reportSet>
-                                               <id>junit-tests</id>
-                                               <reports>
-                                                       <report>report-only</report>
-                                               </reports>
-                                               <configuration>
-                                                       <outputName>surefire-report</outputName>
-                                                       <reportsDirectories>
-                                                               <reportsDirectory>target/surefire-reports</reportsDirectory>
-                                                       </reportsDirectories>
-                                               </configuration>
-                                       </reportSet>
-                               </reportSets>
-                       </plugin>
-               </plugins>
-       </reporting>
-       <properties>
-               <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-               <spring.version>2.5.6</spring.version>
-       </properties>
-       <repositories>
-               <!--
-               <repository>
-                       <id>central-myproject-repo</id>
-                       <name>Internal repository</name>
-                       <url>http://noserver/artifactory/my-repo</url>
-                       <snapshots>
-                               <enabled>false</enabled>
-                       </snapshots>
-               </repository>
-               <repository>
-                       <id>snapshots-releases</id>
-                       <name>snapshots-releases</name>
-                       <url>http://noserver/artifactory/custom-annotations-libs-snapshots-local</url>
-                       <snapshots>
-                               <enabled>true</enabled>
-                       </snapshots>
-               </repository>
-               -->
-       </repositories>
-       <pluginRepositories>
-               <!--
-               <pluginRepository>
-                       <id>central-myproject-plugins-repo</id>
-                       <name>Plugins internal repository</name>
-                       <url>http://noserver/artifactory/plugins-repo</url>
-                       <snapshots>
-                               <enabled>true</enabled>
-                       </snapshots>
-                       <releases>
-                               <enabled>true</enabled>
-                       </releases>
-               </pluginRepository>
-               -->
-       </pluginRepositories>
+      <!--
+          1/3 Required dependency for log4j 2 with slf4j: binding between log4j 2 and slf4j
+      -->
+      <dependency>
+          <groupId>org.apache.logging.log4j</groupId>
+          <artifactId>log4j-slf4j-impl</artifactId>
+          <version>2.3</version>
+      </dependency>
+      <!--
+          2/3 Required dependency for log4j 2 with slf4j: log4j 2 maven plugin (it is the log4j 2 implementation)
+      -->
+      <dependency>
+          <groupId>org.apache.logging.log4j</groupId>
+          <artifactId>log4j-core</artifactId>
+          <version>2.3</version>
+      </dependency>
+      <!-- 
+          3/3 Required dependency for getting rid of commons logging.
+          This is the BRIDGE (no binding) between Jakarta Commons Logging (used by Spring) and whatever
+          I am using for logging (in this case I am using log4j 2)
+          See: http://www.slf4j.org/legacy.html
+          
+          We need exclusions in every dependency using Jakarta Commons Logging (see Spring dependencies below)
+       -->
+      <dependency>
+          <groupId>org.slf4j</groupId>
+          <artifactId>jcl-over-slf4j</artifactId>
+          <version>1.7.12</version>
+      </dependency>
+
+       </dependencies>
+    <build>
+      <plugins>
+          <plugin>
+              <groupId>org.apache.maven.plugins</groupId>
+              <artifactId>maven-compiler-plugin</artifactId>
+              <version>3.3</version>
+              <configuration>
+                  <source>1.8</source>
+                  <target>1.8</target>
+                  <encoding>${project.build.sourceEncoding}</encoding>
+              </configuration>
+          </plugin>
+          <plugin>
+              <groupId>org.apache.maven.plugins</groupId>
+              <artifactId>maven-resources-plugin</artifactId>
+              <version>2.7</version>
+              <configuration>
+                  <encoding>${project.build.sourceEncoding}</encoding>
+              </configuration>
+          </plugin>
+      </plugins>
+    </build>
 </project>
diff --git a/SpringJava/SpringAspectJ/spring-aspectj-example/pom.xml b/SpringJava/SpringAspectJ/spring-aspectj-example/pom.xml
deleted file mode 100644 (file)
index 78334dc..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<project
-       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
-       xmlns="http://maven.apache.org/POM/4.0.0" 
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-       
-       <modelVersion>4.0.0</modelVersion>
-       <parent>
-               <artifactId>spring-aspectj</artifactId>
-               <groupId>de.spring.example</groupId>
-               <version>2.0-SNAPSHOT</version>
-       </parent>
-
-       <artifactId>spring-aspectj-example</artifactId>
-       <name>spring-aspectj-example</name>
-       <url>http://maven.apache.org</url>
-
-       <dependencies>
-               <dependency>
-               <groupId>org.springframework</groupId>
-               <artifactId>spring-aspects</artifactId>
-               <version>2.5.6</version>
-               </dependency>
-               <dependency>
-            <groupId>org.springframework</groupId>
-                       <artifactId>spring-context</artifactId>
-        </dependency>
-               <dependency>
-                       <groupId>cglib</groupId>
-                       <artifactId>cglib-nodep</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>org.springframework</groupId>
-                       <artifactId>spring-aop</artifactId>
-               </dependency>
-       </dependencies>
-</project>
diff --git a/SpringJava/SpringAspectJ/spring-aspectj-example/src/main/java/de/spring/example/MyAdvice.java b/SpringJava/SpringAspectJ/spring-aspectj-example/src/main/java/de/spring/example/MyAdvice.java
deleted file mode 100644 (file)
index 728b78b..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-package de.spring.example;
-
-import org.aspectj.lang.ProceedingJoinPoint;
-import org.aspectj.lang.annotation.Around;
-import org.aspectj.lang.annotation.Aspect;
-import org.aspectj.lang.annotation.Before;
-
-@Aspect
-public class MyAdvice {
-       
-       //This advice is connected with the Pointcut defined in SystemArchitecture.
-       //So, every method connected to that Pointcut will be run after the
-       //method defined in this Advice.
-       @Before("de.spring.example.SystemArchitecture.pointCutMethod())")
-       public void doAccessCheck() {
-               System.out.println("I am the Advice and I will be run before.");
-       }
-       
-       
-       //NOTICE: YOU DO NOT NEED TO CREATE A SPECIAL CLASS FOR POINTCUTS
-       //        YOU COULD DEFINE AN ADVICE WITHOUT A POINTCUT
-       //This advice has a PointCut defined like execution(* de.spring.example.web.Test.anotherExample())
-       //right here wihout a special PointCut method. This advice has itself the PointCut
-       @Around("execution(* de.spring.example.web.Test.anotherExample())")
-       public Object doAround(ProceedingJoinPoint pjp) {
-               System.out.println("I am the Advice and I will be run before and after. BEFORE");
-               // start stopwatch
-               // This local variable will store the returned value from the method anotherExample()
-           Object retVal=null;
-               try {
-                       //Calling the real method
-                       retVal = pjp.proceed();
-               } catch (Throwable e) {
-                       e.printStackTrace();
-               }
-           // stop stopwatch
-           System.out.println("I am the Advice and I will be run before and after. AFTER " + retVal);
-           return retVal;
-       }
-}
diff --git a/SpringJava/SpringAspectJ/spring-aspectj-example/src/main/java/de/spring/example/SpringAdvice.java b/SpringJava/SpringAspectJ/spring-aspectj-example/src/main/java/de/spring/example/SpringAdvice.java
deleted file mode 100644 (file)
index 90e345e..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-package de.spring.example;
-
-import java.lang.reflect.Method;
-import org.springframework.aop.MethodBeforeAdvice;
-
-/**
- * 
- * We are using here an Advice of Spring 1.2
- * See: http://static.springsource.org/spring/docs/3.1.0.RC1/spring-framework-reference/html/aop-api.html#aop-api-advice-types
- *
- */
-public class SpringAdvice implements MethodBeforeAdvice {
-
-       public void before(Method m, Object[] args, Object target) throws Throwable {
-               System.out.println("I am the SpringAdvice and I will be run before.");
-       }
-       
-}
diff --git a/SpringJava/SpringAspectJ/spring-aspectj-example/src/main/java/de/spring/example/SpringContextLocator.java b/SpringJava/SpringAspectJ/spring-aspectj-example/src/main/java/de/spring/example/SpringContextLocator.java
deleted file mode 100644 (file)
index d599c8f..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-package de.spring.example;
-
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-
-/**
- *
- */
-public final class SpringContextLocator {
-
-        // Singleton Pattern
-        private static SpringContextLocator instance;
-
-        // Spring ApplicationContext
-        private static ApplicationContext context;
-
-        // Spring Context
-        private static final String SPRING_CONFIG_CONTEXT="spring-config.xml";
-
-
-        /**
-         * Private constructor. Singleton pattern.
-         */
-        private SpringContextLocator() {
-                String[] factoryFiles = null;
-                System.out.println("Loading context files: " + SpringContextLocator.SPRING_CONFIG_CONTEXT);
-
-                factoryFiles = new String[] { SPRING_CONFIG_CONTEXT };
-
-                SpringContextLocator.context = new ClassPathXmlApplicationContext(factoryFiles);
-
-                System.out.println("The context has been loaded successfully!! ");
-        }
-
-        /**
-         * Singleton pattern not thread safety. To use SingletoHolder pattern as the best approximation 
-         * otherwise to use an Enum class (see Effective Java Second Edition and ) if we need serialization.
-         */
-        public static SpringContextLocator getInstance() {
-                if (SpringContextLocator.instance == null) {
-                        SpringContextLocator.instance = new SpringContextLocator();
-                }
-                return SpringContextLocator.instance;
-        }
-
-        /**
-         * Return bean from application context.
-         */
-        public Object getBean(final String name) {
-                return SpringContextLocator.context.getBean(name);
-        }
-}
\ No newline at end of file
diff --git a/SpringJava/SpringAspectJ/spring-aspectj-example/src/main/java/de/spring/example/SpringStart.java b/SpringJava/SpringAspectJ/spring-aspectj-example/src/main/java/de/spring/example/SpringStart.java
deleted file mode 100644 (file)
index 66285c2..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-package de.spring.example;
-
-import de.spring.example.web.Test;
-
-public class SpringStart {
-
-       /**
-        * @param args
-        */
-       public static void main(String[] args) {
-               System.out.println("Starting application");
-               SpringContextLocator.getInstance();
-               
-               Test test = (Test) SpringContextLocator.getInstance().getBean("test");
-               test.myMethod();
-               test.anotherExample();
-       }
-}
diff --git a/SpringJava/SpringAspectJ/spring-aspectj-example/src/main/java/de/spring/example/SystemArchitecture.java b/SpringJava/SpringAspectJ/spring-aspectj-example/src/main/java/de/spring/example/SystemArchitecture.java
deleted file mode 100644 (file)
index a3ec844..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-package de.spring.example;
-
-import org.aspectj.lang.annotation.AfterReturning;
-import org.aspectj.lang.annotation.Aspect;
-import org.aspectj.lang.annotation.Pointcut;
-
-/**
- * 
- * We are using here the @AspectJ annotations to declare 
- * Proxies. If we want to use these kinds of proxies on the Spring framework
- * we have to use the <aop:aspectj-autoproxy/> annotation on the Spring xml file
- * (the Spring context file)
- */
-@Aspect
-public class SystemArchitecture {
-       
-       //Coonecting to the execution of any method defined in the 
-       //package: de.spring.example.web
-       //We are connecting the methods defined in that package with this
-       //Pointcut. So, when executing any of those methods defined in that
-       //package we will run the Advice related to this Pointcut (if there is an Advice)
-       @Pointcut("execution(* de.spring.example.web.*.*(..))")
-       public void pointCutMethod() 
-       {
-               System.out.println("I am the Pointcut and you will never see me.");
-               //This is the PointCut. 
-               //You can write code here, but it will be useless because while running
-               //the methods connected to the Pointcut, this code will not be executed.
-               //Just the advice will run!!!! :/
-               //Is not this weird? We are here defining a method whose code 
-               //will never be run. When the hell should we write code here?
-               //This is a waste of time and code IMHO. Isn't it?
-       }
-       
-       //NOTICE: YOU DO NOT NEED TO CREATE A SPECIAL CLASS FOR THE ADVICE
-       //        YOU COULD USE THE SAME CLASS FOR THE POINTCUTS AND FOR THE
-       //                ADVICES. IN THIS CASE FOR EXAMPLE WE HAVE THE @AfterReturning
-       //                ADVICE IN THIS CLASS AND THE @Before ADVICE IN THE CLASS CALLED
-       //                MyAdvice
-       //This advice is connected with the another Pointcut.
-       //The returning value of every method connected to that Pointcut
-       //will be caught by this method.
-       @AfterReturning(pointcut="de.spring.example.SystemArchitecture.pointCutMethod())",
-                                       returning="retVal")
-       public void doAccessCheck(final Object retVal) {
-               System.out.println("The returned value by the method " +
-                                                                                       "connected to the Pointcut: " + retVal);
-       }
-}
\ No newline at end of file
diff --git a/SpringJava/SpringAspectJ/spring-aspectj-example/src/main/java/de/spring/example/web/Test.java b/SpringJava/SpringAspectJ/spring-aspectj-example/src/main/java/de/spring/example/web/Test.java
deleted file mode 100644 (file)
index 1a8224c..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-package de.spring.example.web;
-
-
-public class Test {
-       public int myMethod()
-       {
-               System.out.println("The Advice should be run before.");
-               
-               //This value will be caught by the Advice with the @AfterReturning annotation.
-               return 666;
-       }
-       
-       public int anotherExample()
-       {
-               System.out.println("The Advice should be run before and after.");
-               return 666;
-               
-       }
-}
diff --git a/SpringJava/SpringAspectJ/spring-aspectj-example/src/main/resources/spring-config.xml b/SpringJava/SpringAspectJ/spring-aspectj-example/src/main/resources/spring-config.xml
deleted file mode 100644 (file)
index 9081c6c..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xmlns:context="http://www.springframework.org/schema/context" 
-       xmlns:aop="http://www.springframework.org/schema/aop"
-       xsi:schemaLocation="http://www.springframework.org/schema/beans 
-                                                  http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
-                                                  http://www.springframework.org/schema/aop 
-                                                  http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
-                                                  http://www.springframework.org/schema/context 
-                                                  http://www.springframework.org/schema/context/spring-context-2.5.xsd
-                                                  http://www.springframework.org/schema/tx 
-                                                  http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
-       
-       <!-- 
-                                ************* WE HAVE TO ENABLE THE ASPECTJ SUPPORT!!!!!! ************* 
-                       Otherwise the @Aspect annotation (defines @AspectJ aspects) will not work
-                       It relies on the Java 5 specific AspectJ reflection APIs. You can not use it on
-                       JDK 1.4 and below.
-                       
-                       
-                       We could force here the use of CGLIB.
-                       See: http://static.springsource.org/spring/docs/3.1.0.RC1/spring-framework-reference/html/aop.html#aop-proxying
-                       Spring detects if the bean has an interface implementation. If it has one, Spring will use J2SE 
-                       (J2SE needs classes with interfaces) in other case it will use CGLIB. 
-                       In this example the "test" bean does not have an interface so Spring
-                       will use CGLIB. We could force the use of CGLIB in classes with interfaces.
-       -->
-       <aop:aspectj-autoproxy/>
-       
-       <!-- 
-               We can mix aspect types. Without this AOP declaration this project would be SPRING ASPECTJ
-               but, because of this, we have a Spring Advice declaration so this project will be a SPRING AOP project
-               (or at least it is not just SPRING ASPECTJ based)
-               Besides we are using AOP support used in Spring 1.2 :/
-        -->
-       <aop:config proxy-target-class="true">
-       <aop:advisor pointcut="de.spring.example.SystemArchitecture.pointCutMethod()"
-                                advice-ref="springAdvice" />
-    </aop:config>
-       
-       
-       <bean id="test" class="de.spring.example.web.Test">
-       
-    </bean>
-       
-       <bean id="myAdvice" class="de.spring.example.MyAdvice">
-       
-    </bean>
-    
-    <bean id="systemArchitecture" class="de.spring.example.SystemArchitecture">
-       
-    </bean>
-    
-    <bean id="springAdvice" class="de.spring.example.SpringAdvice">
-       
-    </bean>
-       
-</beans>
diff --git a/SpringJava/SpringAspectJ/src/main/java/de/spring/example/MyAdvice.java b/SpringJava/SpringAspectJ/src/main/java/de/spring/example/MyAdvice.java
new file mode 100644 (file)
index 0000000..5121bba
--- /dev/null
@@ -0,0 +1,44 @@
+package de.spring.example;
+
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Before;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@Aspect
+public class MyAdvice {
+       private static final Logger LOGGER = LoggerFactory.getLogger(MyAdvice.class);
+
+       
+       //This advice is connected with the Pointcut defined in SystemArchitecture.
+       //So, every method connected to that Pointcut will be run after the
+       //method defined in this Advice.
+       @Before("de.spring.example.SystemArchitecture.pointCutMethod())")
+       public void doAccessCheck() {
+               LOGGER.info("I am the Advice and I will be run before.");
+       }
+       
+       
+       //NOTICE: YOU DO NOT NEED TO CREATE A SPECIAL CLASS FOR POINTCUTS
+       //        YOU COULD DEFINE AN ADVICE WITHOUT A POINTCUT
+       //This advice has a PointCut defined like execution(* de.spring.example.web.Test.anotherExample())
+       //right here without a special PointCut method. This advice has itself the PointCut
+       @Around("execution(* de.spring.example.web.Test.anotherExample())")
+       public Object doAround(ProceedingJoinPoint pjp) {
+               LOGGER.info("I am the Advice and I will be run before and after. BEFORE");
+               // start stopwatch
+               // This local variable will store the returned value from the method anotherExample()
+           Object retVal=null;
+               try {
+                       //Calling the real method
+                       retVal = pjp.proceed();
+               } catch (Throwable e) {
+                       LOGGER.info("Error", e);
+               }
+           // stop stopwatch
+               LOGGER.info("I am the Advice and I will be run before and after. AFTER " + retVal);
+           return retVal;
+       }
+}
diff --git a/SpringJava/SpringAspectJ/src/main/java/de/spring/example/SpringAdvice.java b/SpringJava/SpringAspectJ/src/main/java/de/spring/example/SpringAdvice.java
new file mode 100644 (file)
index 0000000..e5bdf66
--- /dev/null
@@ -0,0 +1,22 @@
+package de.spring.example;
+
+import java.lang.reflect.Method;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.aop.MethodBeforeAdvice;
+
+/**
+ * 
+ * We are using here an Advice of Spring 1.2
+ * See: http://static.springsource.org/spring/docs/3.1.0.RC1/spring-framework-reference/html/aop-api.html#aop-api-advice-types
+ *
+ */
+public class SpringAdvice implements MethodBeforeAdvice {
+       private static final Logger LOGGER = LoggerFactory.getLogger(SpringAdvice.class);
+
+       public void before(Method m, Object[] args, Object target) throws Throwable {
+               LOGGER.info("I am the SpringAdvice and I will be run before.");
+       }
+       
+}
diff --git a/SpringJava/SpringAspectJ/src/main/java/de/spring/example/SpringContextLocator.java b/SpringJava/SpringAspectJ/src/main/java/de/spring/example/SpringContextLocator.java
new file mode 100644 (file)
index 0000000..ff58276
--- /dev/null
@@ -0,0 +1,57 @@
+package de.spring.example;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+
+/**
+ *
+ */
+public final class SpringContextLocator {
+       private static final Logger LOGGER = LoggerFactory.getLogger(SpringAdvice.class);
+
+
+        // Singleton Pattern
+        private static SpringContextLocator instance;
+
+        // Spring ApplicationContext
+        private static ApplicationContext context;
+
+        // Spring Context
+        private static final String SPRING_CONFIG_CONTEXT="spring-config.xml";
+
+
+        /**
+         * Private constructor. Singleton pattern.
+         */
+        private SpringContextLocator() {
+                String[] factoryFiles = null;
+                LOGGER.info("Loading context files: " + SpringContextLocator.SPRING_CONFIG_CONTEXT);
+
+                factoryFiles = new String[] { SPRING_CONFIG_CONTEXT };
+
+                SpringContextLocator.context = new ClassPathXmlApplicationContext(factoryFiles);
+
+                LOGGER.info("The context has been loaded successfully!! ");
+        }
+
+        /**
+         * Singleton pattern not thread safety. To use SingletoHolder pattern as the best approximation 
+         * otherwise to use an Enum class (see Effective Java Second Edition and ) if we need serialization.
+         */
+        public static SpringContextLocator getInstance() {
+                if (SpringContextLocator.instance == null) {
+                        SpringContextLocator.instance = new SpringContextLocator();
+                }
+                return SpringContextLocator.instance;
+        }
+
+        /**
+         * Return bean from application context.
+         */
+        public Object getBean(final String name) {
+                return SpringContextLocator.context.getBean(name);
+        }
+}
\ No newline at end of file
diff --git a/SpringJava/SpringAspectJ/src/main/java/de/spring/example/SpringStart.java b/SpringJava/SpringAspectJ/src/main/java/de/spring/example/SpringStart.java
new file mode 100644 (file)
index 0000000..f553341
--- /dev/null
@@ -0,0 +1,22 @@
+package de.spring.example;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import de.spring.example.web.Test;
+
+public class SpringStart {
+       private static final Logger LOGGER = LoggerFactory.getLogger(SpringStart.class);
+
+       /**
+        * @param args
+        */
+       public static void main(String[] args) {
+               LOGGER.info("Starting application");
+               SpringContextLocator.getInstance();
+               
+               Test test = (Test) SpringContextLocator.getInstance().getBean("test");
+               test.myMethod();
+               test.anotherExample();
+       }
+}
diff --git a/SpringJava/SpringAspectJ/src/main/java/de/spring/example/SystemArchitecture.java b/SpringJava/SpringAspectJ/src/main/java/de/spring/example/SystemArchitecture.java
new file mode 100644 (file)
index 0000000..ef83b3d
--- /dev/null
@@ -0,0 +1,53 @@
+package de.spring.example;
+
+import org.aspectj.lang.annotation.AfterReturning;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Pointcut;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * 
+ * We are using here the @AspectJ annotations to declare 
+ * Proxies. If we want to use these kinds of proxies on the Spring framework
+ * we have to use the <aop:aspectj-autoproxy/> annotation on the Spring xml file
+ * (the Spring context file)
+ */
+@Aspect
+public class SystemArchitecture {
+       private static final Logger LOGGER = LoggerFactory.getLogger(SpringStart.class);
+
+       
+       //Coonecting to the execution of any method defined in the 
+       //package: de.spring.example.web
+       //We are connecting the methods defined in that package with this
+       //Pointcut. So, when executing any of those methods defined in that
+       //package we will run the Advice related to this Pointcut (if there is an Advice)
+       @Pointcut("execution(* de.spring.example.web.*.*(..))")
+       public void pointCutMethod() 
+       {
+               LOGGER.info("I am the Pointcut and you will never see me.");
+               //This is the PointCut. 
+               //You can write code here, but it will be useless because while running
+               //the methods connected to the Pointcut, this code will not be executed.
+               //Just the advice will run!!!! :/
+               //Is not this weird? We are here defining a method whose code 
+               //will never be run. When the hell should we write code here?
+               //This is a waste of time and code IMHO. Isn't it?
+       }
+       
+       //NOTICE: YOU DO NOT NEED TO CREATE A SPECIAL CLASS FOR THE ADVICE
+       //        YOU COULD USE THE SAME CLASS FOR THE POINTCUTS AND FOR THE
+       //                ADVICES. IN THIS CASE FOR EXAMPLE WE HAVE THE @AfterReturning
+       //                ADVICE IN THIS CLASS AND THE @Before ADVICE IN THE CLASS CALLED
+       //                MyAdvice
+       //This advice is connected with the another Pointcut.
+       //The returning value of every method connected to that Pointcut
+       //will be caught by this method.
+       @AfterReturning(pointcut="de.spring.example.SystemArchitecture.pointCutMethod())",
+                                       returning="retVal")
+       public void doAccessCheck(final Object retVal) {
+               LOGGER.info("The returned value by the method " +
+                                                                                       "connected to the Pointcut: " + retVal);
+       }
+}
\ No newline at end of file
diff --git a/SpringJava/SpringAspectJ/src/main/java/de/spring/example/web/Test.java b/SpringJava/SpringAspectJ/src/main/java/de/spring/example/web/Test.java
new file mode 100644 (file)
index 0000000..d01bd5d
--- /dev/null
@@ -0,0 +1,30 @@
+package de.spring.example.web;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class Test {
+       private static final Logger LOGGER = LoggerFactory.getLogger(Test.class);
+
+       public int myMethod()
+       {
+               LOGGER.info("The Advice should be run before.");
+               
+               //This value will be caught by the Advice with the @AfterReturning annotation.
+               return 666;
+       }
+       
+       public int anotherExample()
+       {
+               LOGGER.info("The Advice should be run before and after.");
+               return 666;
+               
+       }
+       
+    public class InnerTest {
+        public void innerMethod() {
+               LOGGER.info("I am the inner class. The Advice should be run after."
+                               + " NO NEED OF DECLARING Spring BEANS WHEN WEAVING!!!!");
+        }
+    }
+}
diff --git a/SpringJava/SpringAspectJ/src/main/resources/log4j2.xml b/SpringJava/SpringAspectJ/src/main/resources/log4j2.xml
new file mode 100644 (file)
index 0000000..8b3fc3f
--- /dev/null
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- 
+       status: The level of internal Log4j events that should be logged to the console.
+       Valid values for this attribute are "trace", "debug", "info", "warn", "error" and "fatal".
+       
+       monitorInterval: The minimum amount of time, in seconds, that must elapse before the file configuration is checked for changes.
+       
+       
+       see https://logging.apache.org/log4j/2.x/manual/configuration.html
+ -->
+<Configuration status="error" strict="true" monitorInterval="30"
+                name="XMLConfigTest" packages="org.apache.logging.log4j.test">
+                
+       <!--
+               ALL > TRACE > DEBUG > INFO > WARN > ERROR > OFF
+               
+               ERROR by default.
+       -->
+                
+    <Appenders>
+        <Appender type="Console" name="STDOUT">
+            <PatternLayout pattern="%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n"/>
+        </Appender>
+    </Appenders>
+    <Loggers>
+    
+               <!-- 
+               General logging Spring.
+        -->
+        <Logger name="org.springframework" level="INFO" additivity="false">
+            <AppenderRef ref="STDOUT" />
+        </Logger>
+    
+
+               <!-- 
+                       Anything else will be using TRACE logging level.
+                -->        
+        <Root level="DEBUG">
+            <AppenderRef ref="STDOUT"/>
+        </Root>
+    </Loggers>
+</Configuration>
diff --git a/SpringJava/SpringAspectJ/src/main/resources/spring-config.xml b/SpringJava/SpringAspectJ/src/main/resources/spring-config.xml
new file mode 100644 (file)
index 0000000..6aa0317
--- /dev/null
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:context="http://www.springframework.org/schema/context" 
+       xmlns:aop="http://www.springframework.org/schema/aop"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans 
+                                                  http://www.springframework.org/schema/beans/spring-beans.xsd
+                                                  http://www.springframework.org/schema/aop 
+                                                  http://www.springframework.org/schema/aop/spring-aop.xsd
+                                                  http://www.springframework.org/schema/context 
+                                                  http://www.springframework.org/schema/context/spring-context.xsd
+                                                  http://www.springframework.org/schema/tx 
+                                                  http://www.springframework.org/schema/tx/spring-tx.xsd">
+       
+       <!-- 
+                                ************* WE HAVE TO ENABLE THE ASPECTJ SUPPORT!!!!!! ************* 
+                       Otherwise the @Aspect annotation (defines @AspectJ aspects) will not work
+                       It relies on the Java 5 specific AspectJ reflection APIs. You can not use it on
+                       JDK 1.4 and below.
+                       
+                       
+                       We could force here the use of CGLIB.
+                       See: http://static.springsource.org/spring/docs/3.1.0.RC1/spring-framework-reference/html/aop.html#aop-proxying
+                       Spring detects if the bean has an interface implementation. If it has one, Spring will use J2SE 
+                       (J2SE needs classes with interfaces) in other case it will use CGLIB. 
+                       In this example the "test" bean does not have an interface so Spring
+                       will use CGLIB. We could force the use of CGLIB in classes with interfaces.
+       -->
+       <aop:aspectj-autoproxy/>
+       
+       <!-- 
+               We can mix aspect types. Without this AOP declaration this project would be SPRING ASPECTJ
+               but, because of this, we have a Spring Advice declaration so this project will be a SPRING AOP project
+               (or at least it is not just SPRING ASPECTJ based)
+               Besides we are using AOP support used in Spring 1.2 :/
+        -->
+       <aop:config proxy-target-class="true">
+       <aop:advisor pointcut="de.spring.example.SystemArchitecture.pointCutMethod()"
+                                advice-ref="springAdvice" />
+    </aop:config>
+       
+       
+       <bean id="test" class="de.spring.example.web.Test">
+       
+    </bean>
+       
+       <bean id="myAdvice" class="de.spring.example.MyAdvice">
+       
+    </bean>
+    
+    <bean id="systemArchitecture" class="de.spring.example.SystemArchitecture">
+       
+    </bean>
+    
+    <bean id="springAdvice" class="de.spring.example.SpringAdvice">
+       
+    </bean>
+       
+</beans>
diff --git a/SpringJava/SpringLTW/README b/SpringJava/SpringLTW/README
new file mode 100644 (file)
index 0000000..9091fb8
--- /dev/null
@@ -0,0 +1,3 @@
+VM arguments:
+
+-javaagent:$HOME/.m2/repository/org/springframework/spring-instrument/4.2.5.RELEASE/spring-instrument-4.2.5.RELEASE.jar
index d55d01f..5ebc4a0 100644 (file)
 <?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" 
-        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
-        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 
+<project
+       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+       xmlns="http://maven.apache.org/POM/4.0.0" 
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+       
        <modelVersion>4.0.0</modelVersion>
-       <groupId>de.spring.example</groupId>
+    <groupId>de.spring.example</groupId>
        <artifactId>spring-ltw</artifactId>
-       <version>2.0-SNAPSHOT</version>
+    <version>2.0-SNAPSHOT</version>
        <name>spring-ltw</name>
-       <url>http://www.myorganization.de</url>
-       <description>Spring AspectJ with Spring Libraries</description>
-       <organization>
-               <name>MyOrganization</name>
-               <url>http://www.myorganization.de</url>
-       </organization>
-       <packaging>pom</packaging>
-       <issueManagement>
-               <system>trac</system>
-               <url>http://noserver/</url>
-       </issueManagement>
-       <ciManagement>
-               <system>jenkins</system>
-               <url>http://noserver/jenkins/</url>
-       </ciManagement>
-       <scm>
-               <developerConnection>scm:svn:http://noserver</developerConnection>
-               <url>http://noserver</url>
-       </scm>
-       <dependencies>
+       <url>http://gumartinm.name</url>
+    <properties>
+      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+       <dependencies> 
+       <dependency>
+           <groupId>org.springframework</groupId>
+           <artifactId>spring-context</artifactId>
+           <version>4.2.5.RELEASE</version>
+           <!-- 
+               Required dependency for getting rid of commons logging and use my own logging library
+               (in my case I decided to use log4j 2 under slf4j)
+           -->
+           <exclusions>
+               <exclusion>
+                   <groupId>commons-logging</groupId>
+                   <artifactId>commons-logging</artifactId>
+               </exclusion>
+           </exclusions>
+       </dependency>
+      <dependency>
+          <groupId>org.springframework</groupId>
+          <artifactId>spring-aspects</artifactId>
+          <version>4.2.5.RELEASE</version>
+          <!-- 
+              Required dependency for getting rid of commons logging and use my own logging library
+              (in my case I decided to use log4j 2 under slf4j)
+          -->
+          <exclusions>
+              <exclusion>
+                  <groupId>commons-logging</groupId>
+                  <artifactId>commons-logging</artifactId>
+              </exclusion>
+          </exclusions>
+      </dependency>
+      <dependency>
+          <groupId>org.springframework</groupId>
+          <artifactId>spring-aop</artifactId>
+          <version>4.2.5.RELEASE</version>
+          <!-- 
+              Required dependency for getting rid of commons logging and use my own logging library
+              (in my case I decided to use log4j 2 under slf4j)
+          -->
+          <exclusions>
+              <exclusion>
+                  <groupId>commons-logging</groupId>
+                  <artifactId>commons-logging</artifactId>
+              </exclusion>
+          </exclusions>
+      </dependency>
+      <dependency>
+               <groupId>org.springframework</groupId>
+               <artifactId>spring-instrument</artifactId>
+               <version>4.2.5.RELEASE</version>
+                         <!-- 
+              Required dependency for getting rid of commons logging and use my own logging library
+              (in my case I decided to use log4j 2 under slf4j)
+          -->
+          <exclusions>
+              <exclusion>
+                  <groupId>commons-logging</groupId>
+                  <artifactId>commons-logging</artifactId>
+              </exclusion>
+          </exclusions>
+               </dependency>
                <dependency>
-                       <groupId>javax.activation</groupId>
-                       <artifactId>activation</artifactId>
-                       <version>1.1</version>
+               <groupId>javax.cache</groupId>
+               <artifactId>cache-api</artifactId>
+               <version>1.0.0-PFD</version>
                </dependency>
                <dependency>
-                       <groupId>log4j</groupId>
-                       <artifactId>log4j</artifactId>
-                       <version>1.2.15</version>
-                       <exclusions>
-                               <exclusion>
-                                       <groupId>com.sun.jdmk</groupId>
-                                       <artifactId>jmxtools</artifactId>
-                               </exclusion>
-                               <exclusion>
-                                       <groupId>com.sun.jmx</groupId>
-                                       <artifactId>jmxri</artifactId>
-                               </exclusion>
-                               <exclusion>
-                                       <groupId>javax.mail</groupId>
-                                       <artifactId>mail</artifactId>
-                               </exclusion>
-                               <exclusion>
-                                       <groupId>javax.jms</groupId>
-                                       <artifactId>jms</artifactId>
-                               </exclusion>
-                       </exclusions>
+                   <groupId>javax.transaction</groupId>
+                   <artifactId>javax.transaction-api</artifactId>
+                   <version>1.2</version>
                </dependency>
                <dependency>
-                       <groupId>junit</groupId>
-                       <artifactId>junit</artifactId>
-                       <version>4.4</version>
-                       <scope>test</scope>
+               <groupId>org.springframework</groupId>
+               <artifactId>spring-context-support</artifactId>
+               <version>4.2.5.RELEASE</version>
+                         <!-- 
+              Required dependency for getting rid of commons logging and use my own logging library
+              (in my case I decided to use log4j 2 under slf4j)
+          -->
+          <exclusions>
+              <exclusion>
+                  <groupId>commons-logging</groupId>
+                  <artifactId>commons-logging</artifactId>
+              </exclusion>
+          </exclusions>
+               </dependency>
+      <dependency>
+          <groupId>org.springframework</groupId>
+          <artifactId>spring-jdbc</artifactId>
+          <version>4.2.5.RELEASE</version>
+          <!-- 
+              Required dependency for getting rid of commons logging and use my own logging library
+              (in my case I decided to use log4j 2 under slf4j)
+          -->
+          <exclusions>
+              <exclusion>
+                  <groupId>commons-logging</groupId>
+                  <artifactId>commons-logging</artifactId>
+              </exclusion>
+          </exclusions>
+      </dependency>
+
+      <dependency>
+        <groupId>cglib</groupId>
+        <artifactId>cglib</artifactId>
+        <version>3.2.1</version>
+      </dependency>
+
+               <dependency>
+                       <groupId>com.mchange</groupId>
+                       <artifactId>c3p0</artifactId>
+                       <version>0.9.5.2</version>
+               </dependency>
+               <dependency>
+                       <groupId>mysql</groupId>
+                       <artifactId>mysql-connector-java</artifactId>
+                       <version>5.1.38</version>
                </dependency>
-       </dependencies>
-       <dependencyManagement>
-               <dependencies>
-                       <dependency>
-                               <groupId>c3p0</groupId>
-                               <artifactId>c3p0</artifactId>
-                               <version>0.9.1.2</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>cglib</groupId>
-                               <artifactId>cglib-nodep</artifactId>
-                               <version>2.1_3</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>commons-collections</groupId>
-                               <artifactId>commons-collections</artifactId>
-                               <version>3.2.1</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>commons-configuration</groupId>
-                               <artifactId>commons-configuration</artifactId>
-                               <version>1.6</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>commons-dbcp</groupId>
-                               <artifactId>commons-dbcp</artifactId>
-                               <version>1.2.2</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>commons-io</groupId>
-                               <artifactId>commons-io</artifactId>
-                               <version>1.4</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>commons-lang</groupId>
-                               <artifactId>commons-lang</artifactId>
-                               <version>2.4</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>commons-logging</groupId>
-                               <artifactId>commons-logging</artifactId>
-                               <version>1.1.1</version>
-                       </dependency>
-                        <dependency>
-                               <groupId>commons-net</groupId>
-                                <artifactId>commons-net</artifactId>
-                               <version>2.0</version>
-                        </dependency>
-                       <dependency>
-                               <groupId>commons-pool</groupId>
-                               <artifactId>commons-pool</artifactId>
-                               <version>1.3</version>
-                       </dependency> 
-                       <dependency>
-                               <groupId>com.h2database</groupId>
-                               <artifactId>h2</artifactId>
-                               <version>1.2.130</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>dom4j</groupId>
-                               <artifactId>dom4j</artifactId>
-                               <version>1.6.1</version>
-                               <exclusions>
-                                       <exclusion>
-                                               <groupId>xml-apis</groupId>
-                                               <artifactId>xml-apis</artifactId>
-                                       </exclusion>
-                               </exclusions>
-                       </dependency>
-                       <dependency>
-                               <groupId>hsqldb</groupId>
-                               <artifactId>hsqldb</artifactId>
-                               <version>1.8.0.7</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>javatar</groupId>
-                               <artifactId>javatar</artifactId>
-                               <version>2.5</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>jpos</groupId>
-                               <artifactId>jpos</artifactId>
-                               <version>1.12.2</version>
-                               <scope>provided</scope>
-                       </dependency>
-                       <dependency>
-                               <groupId>jpos</groupId>
-                               <artifactId>jpos-controls</artifactId>
-                               <version>1.12.2</version>
-                               <scope>provided</scope>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.python</groupId>
-                               <artifactId>jython</artifactId>
-                               <version>2.5.2b2</version>
-                       </dependency>           
-                       <dependency>
-                               <groupId>urbanophile</groupId>
-                               <artifactId>java-getopt</artifactId>
-                               <version>1.0.13</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>mysql</groupId>
-                               <artifactId>mysql-connector-java</artifactId>
-                               <version>5.1.6</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.apache.ibatis</groupId>
-                               <artifactId>ibatis-sqlmap</artifactId>
-                               <version>2.3.4.726</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.apache.mina</groupId>
-                               <artifactId>mina-core</artifactId>
-                               <version>2.0.0-M6</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.aspectj</groupId>
-                               <artifactId>aspectjrt</artifactId>
-                               <version>1.6.5</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.aspectj</groupId>
-                               <artifactId>aspectjweaver</artifactId>
-                               <version>1.6.5</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.dbunit</groupId>
-                               <artifactId>dbunit</artifactId>
-                               <version>2.4.4</version>
-                               <scope>test</scope>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.eclipse.jetty</groupId>
-                               <artifactId>jetty-continuation</artifactId>
-                               <version>7.0.0.v20091005</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.eclipse.jetty</groupId>
-                               <artifactId>jetty-http</artifactId>
-                               <version>7.0.0.v20091005</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.eclipse.jetty</groupId>
-                               <artifactId>jetty-io</artifactId>
-                               <version>7.0.0.v20091005</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.eclipse.jetty</groupId>
-                               <artifactId>jetty-security</artifactId>
-                               <version>7.0.0.v20091005</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.eclipse.jetty</groupId>
-                               <artifactId>jetty-server</artifactId>
-                               <version>7.0.0.v20091005</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.eclipse.jetty</groupId>
-                               <artifactId>jetty-servlet</artifactId>
-                               <version>7.0.0.v20091005</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.eclipse.jetty</groupId>
-                               <artifactId>jetty-webapp</artifactId>
-                               <version>7.0.0.v20091005</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.eclipse.jetty</groupId>
-                               <artifactId>jetty-util</artifactId>
-                               <version>7.0.0.v20091005</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.eclipse.jetty</groupId>
-                               <artifactId>jetty-xml</artifactId>
-                               <version>7.0.0.v20091005</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.slf4j</groupId>
-                               <artifactId>slf4j-api</artifactId>
-                               <version>1.5.2</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.slf4j</groupId>
-                               <artifactId>slf4j-log4j12</artifactId>
-                               <version>1.5.2</version>
-                               <exclusions>
-                                       <exclusion>
-                                               <groupId>log4j</groupId>
-                                               <artifactId>log4j</artifactId>
-                                       </exclusion>
-                               </exclusions>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.springframework</groupId>
-                               <artifactId>spring-aop</artifactId>
-                               <version>${spring.version}</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.springframework</groupId>
-                               <artifactId>spring-beans</artifactId>
-                               <version>${spring.version}</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.springframework</groupId>
-                               <artifactId>spring-core</artifactId>
-                               <version>${spring.version}</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.springframework</groupId>
-                               <artifactId>spring-context</artifactId>
-                               <version>${spring.version}</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.springframework</groupId>
-                               <artifactId>spring-jdbc</artifactId>
-                               <version>${spring.version}</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.springframework</groupId>
-                               <artifactId>spring-tx</artifactId>
-                               <version>${spring.version}</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.springframework</groupId>
-                               <artifactId>spring-web</artifactId>
-                               <version>${spring.version}</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.springframework</groupId>
-                               <artifactId>spring-webmvc</artifactId>
-                               <version>${spring.version}</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.springframework</groupId>
-                                       <artifactId>spring-context-support</artifactId>
-                               <version>${spring.version}</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.springframework</groupId>
-                               <artifactId>spring-test</artifactId>
-                               <version>${spring.version}</version>
-                               <scope>test</scope>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.springframework.batch</groupId>
-                               <artifactId>spring-batch-test</artifactId>
-                               <version>2.0.4.RELEASE</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.springframework.batch</groupId>
-                               <artifactId>spring-batch-core</artifactId>
-                               <version>2.0.4.RELEASE</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.springframework.batch</groupId>
-                               <artifactId>spring-batch-infrastructure</artifactId>
-                               <version>2.0.4.RELEASE</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.springframework</groupId>
-                               <artifactId>spring-orm</artifactId>
-                               <version>${spring.version}</version>
-                       </dependency>
-                       <dependency>
-                           <groupId>net.sf.ehcache</groupId>
-                           <artifactId>ehcache</artifactId>
-                           <version>1.6.2</version>
-                       </dependency>
-                       <dependency>
-                           <groupId>org.springmodules</groupId>
-                           <artifactId>spring-modules-cache</artifactId>
-                           <version>0.9</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>p6spy</groupId>
-                               <artifactId>p6spy</artifactId>
-                               <version>1.3</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>javax.transaction</groupId>
-                               <artifactId>jta</artifactId>
-                               <version>1.0.1B</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>javax.servlet</groupId>
-                               <artifactId>servlet-api</artifactId>
-                               <version>2.5</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>com.caucho</groupId>
-                               <artifactId>hessian</artifactId>
-                               <version>3.1.6</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.codehaus.jettison</groupId>
-                               <artifactId>jettison</artifactId>
-                               <version>1.0</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>com.thoughtworks.xstream</groupId>
-                               <artifactId>xstream</artifactId>
-                               <version>1.3</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.ini4j</groupId>
-                               <artifactId>ini4j</artifactId>
-                               <version>0.5.1</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.easymock</groupId>
-                               <artifactId>easymock</artifactId>
-                               <version>2.4</version>
-                               <scope>test</scope>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.easymock</groupId>
-                               <artifactId>easymockclassextension</artifactId>
-                               <version>2.4</version>
-                               <scope>test</scope>
-                       </dependency>
 
-                       <dependency>
-                               <groupId>org.apache.commons</groupId>
-                               <artifactId>commons-compress</artifactId>
-                               <version>1.0</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.apache.commons</groupId>
-                               <artifactId>commons-math</artifactId>
-                               <version>2.0</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>dtgjpos_forms</groupId>
-                               <artifactId>dtgjpos_forms</artifactId>
-                               <version>1.4.12</version>
-                               <scope>provided</scope>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.codehaus.castor</groupId>
-                               <artifactId>castor-xml</artifactId>
-                               <version>1.3.1</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.apache.xmlbeans</groupId>
-                               <artifactId>xmlbeans</artifactId>
-                               <version>2.5.0</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.apache.velocity.tools</groupId>
-                               <artifactId>velocity-tools-generic</artifactId>
-                               <version>1.4</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.apache.velocity</groupId>
-                               <artifactId>velocity</artifactId>
-                               <version>1.6.2</version>
-                       </dependency>
-                       <dependency>
-                               <groupId>org.tmatesoft.svnkit</groupId>
-                               <artifactId>svnkit</artifactId>
-                               <version>1.3.1</version>
-                       </dependency>
-               </dependencies>
-       </dependencyManagement>
-       <modules>
-               <module>spring-ltw-example</module>
-       </modules>
-       <build>
-               <plugins>
-                       <plugin>
-                               <groupId>org.apache.maven.plugins</groupId>
-                               <artifactId>maven-compiler-plugin</artifactId>
-                               <version>2.0.2</version>
-                               <configuration>
-                                       <source>1.6</source>
-                                       <target>1.6</target>
-                                       <encoding>${project.build.sourceEncoding}</encoding>
-                               </configuration>
-                       </plugin>
-                       <!-- Usually you will not need this plugin
-                       <plugin>
-                               <groupId>org.apache.maven.plugins</groupId>
-                               <artifactId>maven-resources-plugin</artifactId>
-                               <version>2.2</version>
-                               <configuration>
-                                       <encoding>${project.build.sourceEncoding}</encoding>
-                               </configuration>
-                       </plugin>
-                       -->
-                       <plugin>
-                               <groupId>org.apache.maven.plugins</groupId>
-                               <artifactId>maven-javadoc-plugin</artifactId>
-                               <version>2.6</version>
-                       </plugin>
-                       <plugin>
-                               <groupId>org.apache.maven.plugins</groupId>
-                               <artifactId>maven-surefire-plugin</artifactId>
-                               <version>2.4.2</version>
-                               <configuration>
-                                       <testFailureIgnore>true</testFailureIgnore>
-                               </configuration>
-                       </plugin>
-                       <plugin>
-                               <groupId>org.codehaus.mojo</groupId>
-                               <artifactId>jdepend-maven-plugin</artifactId>
-                               <version>2.0-beta-2</version>
-                       </plugin>
-                       <plugin>
-                               <groupId>org.apache.maven.plugins</groupId>
-                               <artifactId>maven-jar-plugin</artifactId>
-                               <version>2.3.1</version>
-                               <configuration>
-                                       <archive>
-                                               <manifestEntries>
-                                                       <Specification-Title>${project.description}</Specification-Title>
-                                                       <Specification-Version>${project.version}</Specification-Version>
-                                                       <Specification-Vendor>${project.organization.name}</Specification-Vendor>
-                                                       <Implementation-Title>${project.description}</Implementation-Title>
-                                                       <Implementation-Version>${project.version}</Implementation-Version>
-                                                       <Implementation-Vendor>${project.organization.name}</Implementation-Vendor>
-                                                       <Implementation-Build>${BUILD_TAG}</Implementation-Build>
-                                                       <Implementation-Build-id>${BUILD_ID}</Implementation-Build-id>
-                                                       <Implementation-Build-number>${BUILD_NUMBER}</Implementation-Build-number>
-                                                       <scm-committed-revision>${prefix.committedRevision}</scm-committed-revision>
-                                                       <scm-repository>${prefix.repository}</scm-repository>
-                                                       <scm-path>${prefix.path}</scm-path>                                                           
-                                               </manifestEntries>
-                                       </archive>
-                               </configuration>
-                       </plugin>
-                       <plugin>
-                               <groupId>com.google.code.maven-svn-revision-number-plugin</groupId>
-                               <artifactId>maven-svn-revision-number-plugin</artifactId>
-                               <version>1.6</version>
-                               <executions>
-                                       <execution>
-                                               <goals>
-                                                       <goal>revision</goal>
-                                               </goals>
-                                       </execution>
-                               </executions>
-                               <configuration>
-                                       <entries>
-                                               <entry>
-                                                       <prefix>prefix</prefix>
-                                               </entry>
-                                       </entries>
-                               </configuration>
-                       </plugin>
-               </plugins>
-       </build>
-       <!--We need this for the javadoc and reporting maven plugin -->
-       <distributionManagement>
-               <repository>
-                       <id>releases</id>
-                       <name>releases</name>
-                       <url>http://noserver/artifactory/custom-annotations-libs-releases-local</url>
-               </repository>
-               <snapshotRepository>
-                       <id>snapshots-releases</id>
-                       <name>snapshots-releases</name>
-                       <url>http://noserver/artifactory/custom-annotations-libs-snapshots-local</url>
-               </snapshotRepository>
-               <site>
-                       <id>noserver</id>
-                       <url>file:///mnt/sdb1/data/downloads/jenkins/</url>
-               </site>
+      <!--
+          1/3 Required dependency for log4j 2 with slf4j: binding between log4j 2 and slf4j
+      -->
+      <dependency>
+          <groupId>org.apache.logging.log4j</groupId>
+          <artifactId>log4j-slf4j-impl</artifactId>
+          <version>2.3</version>
+      </dependency>
+      <!--
+          2/3 Required dependency for log4j 2 with slf4j: log4j 2 maven plugin (it is the log4j 2 implementation)
+      -->
+      <dependency>
+          <groupId>org.apache.logging.log4j</groupId>
+          <artifactId>log4j-core</artifactId>
+          <version>2.3</version>
+      </dependency>
+      <!-- 
+          3/3 Required dependency for getting rid of commons logging.
+          This is the BRIDGE (no binding) between Jakarta Commons Logging (used by Spring) and whatever
+          I am using for logging (in this case I am using log4j 2)
+          See: http://www.slf4j.org/legacy.html
+          
+          We need exclusions in every dependency using Jakarta Commons Logging (see Spring dependencies below)
+       -->
+      <dependency>
+          <groupId>org.slf4j</groupId>
+          <artifactId>jcl-over-slf4j</artifactId>
+          <version>1.7.12</version>
+      </dependency>
 
-       </distributionManagement>
-       <reporting>
-               <plugins>
-                       <plugin>
-                               <groupId>org.apache.maven.plugins</groupId>
-                               <artifactId>maven-project-info-reports-plugin</artifactId>
-                               <version>2.1.2</version>
-                               <reportSets>
-                                       <reportSet>
-                                               <reports>
-                                                       <report>index</report>
-                                                       <report>dependencies</report>
-                                                       <report>cim</report>
-                                                       <report>issue-tracking</report>
-                                                       <report>scm</report>
-                                                       <report>summary</report>
-                                                       <report>project-team</report>
-                                               </reports>
-                                       </reportSet>
-                               </reportSets>
-                       </plugin>
-                       <plugin>
-                               <groupId>org.apache.maven.plugins</groupId>
-                               <artifactId>maven-javadoc-plugin</artifactId>
-                               <version>2.6.1</version>
-                               <reportSets>
-                                       <reportSet>
-                                               <id>html</id>
-                                               <configuration>
-                                                       <doctitle>MYPROJECT API for ${project.name} ${project.version}</doctitle>
-                                                       <windowtitle>MYPROJECT API for ${project.name} ${project.version}</windowtitle>
-                                               </configuration>
-                                               <reports>
-                                                       <report>javadoc</report>
-                                                       <report>aggregate</report>
-                                               </reports>
-                                       </reportSet>
-                               </reportSets>
-                       </plugin>
-                       <plugin>
-                               <groupId>org.codehaus.mojo</groupId>
-                               <artifactId>taglist-maven-plugin</artifactId>
-                               <version>2.3</version>
-                               <configuration>
-                                       <tags>
-                                               <tag>TODO</tag>
-                                               <tag>@todo</tag>
-                                               <tag>FIXME</tag>
-                                               <tag>XXX</tag>
-                                       </tags>
-                               </configuration>
-                       </plugin>
-                       <plugin>
-                               <groupId>org.apache.maven.plugins</groupId>
-                               <artifactId>maven-surefire-report-plugin</artifactId>
-                               <version>2.4.3</version>
-                               <reportSets>
-                                       <reportSet>
-                                               <id>integration-tests</id>
-                                               <reports>
-                                                       <report>report-only</report>
-                                               </reports>
-                                               <configuration>
-                                                       <outputName>failsafe-report</outputName>
-                                                       <reportsDirectories>
-                                                               <reportsDirectory>target/failsafe-reports</reportsDirectory>
-                                                       </reportsDirectories>
-                                               </configuration>
-                                       </reportSet>
-                                       <reportSet>
-                                               <id>junit-tests</id>
-                                               <reports>
-                                                       <report>report-only</report>
-                                               </reports>
-                                               <configuration>
-                                                       <outputName>surefire-report</outputName>
-                                                       <reportsDirectories>
-                                                               <reportsDirectory>target/surefire-reports</reportsDirectory>
-                                                       </reportsDirectories>
-                                               </configuration>
-                                       </reportSet>
-                               </reportSets>
-                       </plugin>
-               </plugins>
-       </reporting>
-       <properties>
-               <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-               <spring.version>2.5.6</spring.version>
-       </properties>
-       <repositories>
-               <!--
-               <repository>
-                       <id>central-myproject-repo</id>
-                       <name>Internal repository</name>
-                       <url>http://noserver/artifactory/my-repo</url>
-                       <snapshots>
-                               <enabled>false</enabled>
-                       </snapshots>
-               </repository>
-               <repository>
-                       <id>snapshots-releases</id>
-                       <name>snapshots-releases</name>
-                       <url>http://noserver/artifactory/custom-annotations-libs-snapshots-local</url>
-                       <snapshots>
-                               <enabled>true</enabled>
-                       </snapshots>
-               </repository>
-               -->
-       </repositories>
-       <pluginRepositories>
-               <!--
-               <pluginRepository>
-                       <id>central-myproject-plugins-repo</id>
-                       <name>Plugins internal repository</name>
-                       <url>http://noserver/artifactory/plugins-repo</url>
-                       <snapshots>
-                               <enabled>true</enabled>
-                       </snapshots>
-                       <releases>
-                               <enabled>true</enabled>
-                       </releases>
-               </pluginRepository>
-               -->
-       </pluginRepositories>
+       </dependencies>
+    <build>
+      <plugins>
+          <plugin>
+              <groupId>org.apache.maven.plugins</groupId>
+              <artifactId>maven-compiler-plugin</artifactId>
+              <version>3.3</version>
+              <configuration>
+                  <source>1.8</source>
+                  <target>1.8</target>
+                  <encoding>${project.build.sourceEncoding}</encoding>
+              </configuration>
+          </plugin>
+          <plugin>
+              <groupId>org.apache.maven.plugins</groupId>
+              <artifactId>maven-resources-plugin</artifactId>
+              <version>2.7</version>
+              <configuration>
+                  <encoding>${project.build.sourceEncoding}</encoding>
+              </configuration>
+          </plugin>
+      </plugins>
+    </build>
 </project>
diff --git a/SpringJava/SpringLTW/spring-ltw-example/pom.xml b/SpringJava/SpringLTW/spring-ltw-example/pom.xml
deleted file mode 100644 (file)
index 03f917f..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<project
-       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
-       xmlns="http://maven.apache.org/POM/4.0.0" 
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-       
-       <modelVersion>4.0.0</modelVersion>
-       <parent>
-               <artifactId>spring-ltw</artifactId>
-               <groupId>de.spring.example</groupId>
-               <version>2.0-SNAPSHOT</version>
-       </parent>
-
-       <artifactId>spring-ltw-example</artifactId>
-       <name>spring-ltw-example</name>
-       <url>http://maven.apache.org</url>
-
-       <dependencies>
-               <dependency>
-               <groupId>org.springframework</groupId>
-               <artifactId>spring-aspects</artifactId>
-               <version>2.5.6</version>
-               </dependency>
-               <dependency>
-            <groupId>org.springframework</groupId>
-                       <artifactId>spring-context</artifactId>
-        </dependency>
-               <dependency>
-                       <groupId>cglib</groupId>
-                       <artifactId>cglib-nodep</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>org.springframework</groupId>
-                       <artifactId>spring-aop</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>org.springframework</groupId>
-                       <artifactId>spring-jdbc</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>c3p0</groupId>
-                       <artifactId>c3p0</artifactId>
-               </dependency>
-               <dependency>
-                       <groupId>mysql</groupId>
-                       <artifactId>mysql-connector-java</artifactId>
-               </dependency>
-       </dependencies>
-</project>
diff --git a/SpringJava/SpringLTW/spring-ltw-example/src/main/java/de/spring/example/MyAdvice.java b/SpringJava/SpringLTW/spring-ltw-example/src/main/java/de/spring/example/MyAdvice.java
deleted file mode 100644 (file)
index bee04c1..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-package de.spring.example;
-
-import org.aspectj.lang.annotation.After;
-import org.aspectj.lang.annotation.Aspect;
-import org.aspectj.lang.annotation.Before;
-
-@Aspect
-public class MyAdvice {
-
-
-    @Before("@annotation(de.spring.example.annotation.initTransactional)")
-    public void initTransactional()
-    {
-        System.out.println("I am the Advice initTransaction.");
-        TransactionManager.getInstance().initTransaction();
-    }
-
-
-    @After("@annotation(de.spring.example.annotation.commitTransactional)")
-    public void commitTransactional() {
-        System.out.println("I am the Advice commitTransaction.");
-        TransactionManager.getInstance().commitTransaction();
-    }
-}
diff --git a/SpringJava/SpringLTW/spring-ltw-example/src/main/java/de/spring/example/SpringContextLocator.java b/SpringJava/SpringLTW/spring-ltw-example/src/main/java/de/spring/example/SpringContextLocator.java
deleted file mode 100644 (file)
index 2ece260..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-package de.spring.example;
-
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-
-/**
- *
- */
-public final class SpringContextLocator {
-
-        // Singleton Pattern
-        private static SpringContextLocator instance;
-
-        // Spring ApplicationContext
-        private static ApplicationContext context;
-
-        // Spring Context
-        private static final String SPRING_CONFIG_CONTEXT="/spring-config.xml";
-
-
-        /**
-         * Private constructor. Singleton pattern.
-         */
-        private SpringContextLocator() {
-                String[] factoryFiles = null;
-                System.out.println("Loading context files: " + SpringContextLocator.SPRING_CONFIG_CONTEXT);
-
-                factoryFiles = new String[] { SPRING_CONFIG_CONTEXT };
-
-                SpringContextLocator.context = new ClassPathXmlApplicationContext(factoryFiles);
-
-                System.out.println("The context has been loaded successfully!! ");
-        }
-
-        /**
-         * Singleton pattern not thread safety. To use SingletoHolder pattern as the best approximation 
-         * otherwise to use an Enum class (see Effective Java Second Edition and ) if we need serialization.
-         */
-        public static SpringContextLocator getInstance() {
-                if (SpringContextLocator.instance == null) {
-                        SpringContextLocator.instance = new SpringContextLocator();
-                }
-                return SpringContextLocator.instance;
-        }
-
-        /**
-         * Return bean from application context.
-         */
-        public Object getBean(final String name) {
-                return SpringContextLocator.context.getBean(name);
-        }
-}
\ No newline at end of file
diff --git a/SpringJava/SpringLTW/spring-ltw-example/src/main/java/de/spring/example/SpringStart.java b/SpringJava/SpringLTW/spring-ltw-example/src/main/java/de/spring/example/SpringStart.java
deleted file mode 100644 (file)
index a9da7cb..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-package de.spring.example;
-
-import de.spring.example.web.Test;
-
-public class SpringStart {
-
-       /**
-        * @param args
-        */
-       public static void main(String[] args) {
-               System.out.println("Starting application");
-               SpringContextLocator.getInstance();
-               
-               Test test = (Test) SpringContextLocator.getInstance().getBean("testOuter");
-               test.myMethod();
-               
-               Test.InnerTest testInner = (Test.InnerTest) SpringContextLocator.getInstance().getBean("testInner");
-               testInner.innerMethod();
-       }
-}
diff --git a/SpringJava/SpringLTW/spring-ltw-example/src/main/java/de/spring/example/TransactionManager.java b/SpringJava/SpringLTW/spring-ltw-example/src/main/java/de/spring/example/TransactionManager.java
deleted file mode 100644 (file)
index d8657f2..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-package de.spring.example;
-
-import org.aspectj.lang.annotation.Aspect;
-import org.springframework.jdbc.datasource.DataSourceTransactionManager;
-import org.springframework.transaction.TransactionStatus;
-
-@Aspect
-public class TransactionManager {
-    private static TransactionManager instance = new TransactionManager();
-    private DataSourceTransactionManager transactionManager;
-    private TransactionStatus transactionStatus;
-
-    //Why could you want to extend this class?
-    private TransactionManager() {
-    }
-
-    public static TransactionManager getInstance() {
-        return instance;
-    }
-
-    public void initTransaction()
-    {
-        System.out.println("initTRANSACTION");
-        // transactionStatus = this.transactionManager.getTransaction(null);
-    }
-
-    public void rollbackTransaction()
-    {
-        this.transactionManager.rollback(this.transactionStatus);
-    }
-
-
-    public void commitTransaction()
-    {
-        System.out.println("commitTRANSACTION");
-        // this.transactionManager.commit(this.transactionStatus);
-    }
-
-
-    /************************* Setters and getters *******************************************/
-    public void setTransactionManager(final DataSourceTransactionManager  transactionManager)
-    {
-        this.transactionManager = transactionManager;
-    }
-}
diff --git a/SpringJava/SpringLTW/spring-ltw-example/src/main/java/de/spring/example/annotation/commitTransactional.java b/SpringJava/SpringLTW/spring-ltw-example/src/main/java/de/spring/example/annotation/commitTransactional.java
deleted file mode 100644 (file)
index 1fda03f..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-package de.spring.example.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import org.springframework.stereotype.Component;
-
-@Target({ElementType.METHOD, ElementType.TYPE})
-@Retention(RetentionPolicy.RUNTIME)
-@Component
-public @interface commitTransactional {
-}
diff --git a/SpringJava/SpringLTW/spring-ltw-example/src/main/java/de/spring/example/annotation/initTransactional.java b/SpringJava/SpringLTW/spring-ltw-example/src/main/java/de/spring/example/annotation/initTransactional.java
deleted file mode 100644 (file)
index dad0b3e..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-package de.spring.example.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import org.springframework.stereotype.Component;
-
-@Target({ElementType.METHOD, ElementType.TYPE})
-@Retention(RetentionPolicy.RUNTIME)
-@Component
-public @interface initTransactional {
-}
diff --git a/SpringJava/SpringLTW/spring-ltw-example/src/main/java/de/spring/example/web/Test.java b/SpringJava/SpringLTW/spring-ltw-example/src/main/java/de/spring/example/web/Test.java
deleted file mode 100644 (file)
index cc21d8f..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-package de.spring.example.web;
-
-import de.spring.example.annotation.commitTransactional;
-import de.spring.example.annotation.initTransactional;
-
-
-public class Test {
-    @initTransactional
-    public int myMethod()
-    {
-        System.out.println("The Advice should be run before.");
-
-        //This value will be caught by the Advice with the @AfterReturning annotation.
-        return 666;
-    }
-
-    public class InnerTest {
-        @commitTransactional
-        public void innerMethod() {
-            System.out.println("I am the inner class. The Advice should be run after. ");
-        }
-    }
-}
diff --git a/SpringJava/SpringLTW/spring-ltw-example/src/main/resources/META-INF/aop.xml b/SpringJava/SpringLTW/spring-ltw-example/src/main/resources/META-INF/aop.xml
deleted file mode 100644 (file)
index 9f6ee4b..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-<!DOCTYPE aspectj PUBLIC
-        "-//AspectJ//DTD//EN" "http://www.eclipse.org/aspectj/dtd/aspectj.dtd">
-
-<aspectj>
-       <!--
-               With or without logs
-               <weaver options="-verbose -showWeaveInfo">
-       -->     
-       <weaver>
-               <!-- only weave classes in our application-specific packages -->
-                       <include within="de.spring..*"/>
-               <!--
-                       Dump all types within the "somepack" package before they are woven
-                       to the "./_ajdump" folder on disk
-               <dump within="de.spring..*"/>
-               -->
-       </weaver>
-       <aspects>
-               <aspect name="de.spring.example.MyAdvice"/>        
-       </aspects>
-</aspectj>
diff --git a/SpringJava/SpringLTW/spring-ltw-example/src/main/resources/spring-config.xml b/SpringJava/SpringLTW/spring-ltw-example/src/main/resources/spring-config.xml
deleted file mode 100644 (file)
index fee0328..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xmlns:context="http://www.springframework.org/schema/context" 
-       xsi:schemaLocation="http://www.springframework.org/schema/beans 
-                                                  http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
-                                                  http://www.springframework.org/schema/context 
-                                                  http://www.springframework.org/schema/context/spring-context-2.5.xsd">
-
-       <!-- 
-                       We have to use SPRING ASPECTJ (no SPRING AOP 2.0/1.2) because we want to use
-               annotations with inner classes.
-                       AspectJ under this configuration requires at least one 'META-INF/aop.xml' file
-               with the configuration about the Advices.
-                       
-               This switches on the load-time weaving 
-           See: http://static.springsource.org/spring/docs/3.1.0.M2/spring-framework-reference/html/aop.html#aop-aj-ltw-spring
-       -->
-    <context:load-time-weaver  weaver-class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver"
-                                                  aspectj-weaving="autodetect"/>
-    
-       
-       <bean id="myAdvice" class="de.spring.example.MyAdvice">
-       
-    </bean>
-
-       <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
-                <property name="user" value="root"/>
-                <property name="password" value=""/>
-                <property name="driverClass" value="com.mysql.jdbc.Driver"/>
-                <property name="jdbcUrl" value="jdbc:mysql://127.0.0.1:3306/example?autoReconnect=true"/>
-                <property name="initialPoolSize" value="5"/>
-                <property name="maxPoolSize" value="20"/>
-                <property name="minPoolSize" value="10"/>
-                <property name="acquireIncrement" value="1"/>
-                <property name="acquireRetryAttempts" value="5"/>
-                <property name="acquireRetryDelay" value="1000"/>
-                <property name="automaticTestTable" value="con_test"/>
-                <property name="checkoutTimeout" value="5000"/>
-    </bean>
-    <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
-               <property name="dataSource" ref="dataSource"/>
-       </bean>
-       
-       <bean id="myTransactionManager"
-              class="de.spring.example.TransactionManager"
-              factory-method="getInstance">
-        <property name="transactionManager">
-            <ref bean="transactionManager" />
-        </property>
-    </bean>
-       
-       <!-- 
-               In order to find annotations in inner classes we have to create Spring 
-       beans of them.
-    -->
-    <bean id="testOuter" class="de.spring.example.web.Test"/> 
-    <bean id="testInner" class="de.spring.example.web.Test$InnerTest">
-        <constructor-arg ref="testOuter"/>
-    
-    </bean>
-    
-</beans>
diff --git a/SpringJava/SpringLTW/src/main/java/de/spring/example/MyAdvice.java b/SpringJava/SpringLTW/src/main/java/de/spring/example/MyAdvice.java
new file mode 100644 (file)
index 0000000..6e25974
--- /dev/null
@@ -0,0 +1,28 @@
+package de.spring.example;
+
+import org.aspectj.lang.annotation.After;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Before;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@Aspect
+public class MyAdvice {
+       private static final Logger LOGGER = LoggerFactory.getLogger(MyAdvice.class);
+
+       // With execution we avoid double weaving (when call and when execution)
+    @Before("@annotation(de.spring.example.annotation.initTransactional) && execution(* *(..))")
+    public void initTransactional()
+    {
+       LOGGER.info("I am the Advice initTransaction.");
+        TransactionManager.getInstance().initTransaction();
+    }
+
+
+       // With execution we avoid double weaving (when call and when execution)
+    @After("@annotation(de.spring.example.annotation.commitTransactional) && execution(* *(..))")
+    public void commitTransactional() {
+       LOGGER.info("I am the Advice commitTransaction.");
+        TransactionManager.getInstance().commitTransaction();
+    }
+}
diff --git a/SpringJava/SpringLTW/src/main/java/de/spring/example/SpringContextLocator.java b/SpringJava/SpringLTW/src/main/java/de/spring/example/SpringContextLocator.java
new file mode 100644 (file)
index 0000000..8a82a3a
--- /dev/null
@@ -0,0 +1,57 @@
+package de.spring.example;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+
+/**
+ *
+ */
+public final class SpringContextLocator {
+       private static final Logger LOGGER = LoggerFactory.getLogger(SpringContextLocator.class);
+
+
+        // Singleton Pattern
+        private static SpringContextLocator instance;
+
+        // Spring ApplicationContext
+        private static ApplicationContext context;
+
+        // Spring Context
+        private static final String SPRING_CONFIG_CONTEXT="/spring-config.xml";
+
+
+        /**
+         * Private constructor. Singleton pattern.
+         */
+        private SpringContextLocator() {
+                String[] factoryFiles = null;
+                LOGGER.info("Loading context files: " + SpringContextLocator.SPRING_CONFIG_CONTEXT);
+
+                factoryFiles = new String[] { SPRING_CONFIG_CONTEXT };
+
+                SpringContextLocator.context = new ClassPathXmlApplicationContext(factoryFiles);
+
+                LOGGER.info("The context has been loaded successfully!! ");
+        }
+
+        /**
+         * Singleton pattern not thread safety. To use SingletoHolder pattern as the best approximation 
+         * otherwise to use an Enum class (see Effective Java Second Edition and ) if we need serialization.
+         */
+        public static SpringContextLocator getInstance() {
+                if (SpringContextLocator.instance == null) {
+                        SpringContextLocator.instance = new SpringContextLocator();
+                }
+                return SpringContextLocator.instance;
+        }
+
+        /**
+         * Return bean from application context.
+         */
+        public Object getBean(final String name) {
+                return SpringContextLocator.context.getBean(name);
+        }
+}
\ No newline at end of file
diff --git a/SpringJava/SpringLTW/src/main/java/de/spring/example/SpringStart.java b/SpringJava/SpringLTW/src/main/java/de/spring/example/SpringStart.java
new file mode 100644 (file)
index 0000000..2aba4c2
--- /dev/null
@@ -0,0 +1,22 @@
+package de.spring.example;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import de.spring.example.web.Test;
+
+public class SpringStart {
+       private static final Logger LOGGER = LoggerFactory.getLogger(SpringStart.class);
+
+       
+       /**
+        * @param args
+        */
+       public static void main(String[] args) {
+               LOGGER.info("Starting application");
+               SpringContextLocator.getInstance();
+               
+               Test test = (Test) SpringContextLocator.getInstance().getBean("testOuter");
+               test.myMethod();
+       }
+}
diff --git a/SpringJava/SpringLTW/src/main/java/de/spring/example/TransactionManager.java b/SpringJava/SpringLTW/src/main/java/de/spring/example/TransactionManager.java
new file mode 100644 (file)
index 0000000..53f3c59
--- /dev/null
@@ -0,0 +1,48 @@
+package de.spring.example;
+
+import org.aspectj.lang.annotation.Aspect;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.jdbc.datasource.DataSourceTransactionManager;
+import org.springframework.transaction.TransactionStatus;
+
+@Aspect
+public class TransactionManager {
+       private static final Logger LOGGER = LoggerFactory.getLogger(TransactionManager.class);
+    private static TransactionManager instance = new TransactionManager();
+    private DataSourceTransactionManager transactionManager;
+    private TransactionStatus transactionStatus;
+
+    //Why could you want to extend this class?
+    private TransactionManager() {
+    }
+
+    public static TransactionManager getInstance() {
+        return instance;
+    }
+
+    public void initTransaction()
+    {
+       LOGGER.info("initTRANSACTION");
+        // transactionStatus = this.transactionManager.getTransaction(null);
+    }
+
+    public void rollbackTransaction()
+    {
+        this.transactionManager.rollback(this.transactionStatus);
+    }
+
+
+    public void commitTransaction()
+    {
+       LOGGER.info("commitTRANSACTION");
+        // this.transactionManager.commit(this.transactionStatus);
+    }
+
+
+    /************************* Setters and getters *******************************************/
+    public void setTransactionManager(final DataSourceTransactionManager  transactionManager)
+    {
+        this.transactionManager = transactionManager;
+    }
+}
diff --git a/SpringJava/SpringLTW/src/main/java/de/spring/example/annotation/commitTransactional.java b/SpringJava/SpringLTW/src/main/java/de/spring/example/annotation/commitTransactional.java
new file mode 100644 (file)
index 0000000..1fda03f
--- /dev/null
@@ -0,0 +1,14 @@
+package de.spring.example.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.springframework.stereotype.Component;
+
+@Target({ElementType.METHOD, ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Component
+public @interface commitTransactional {
+}
diff --git a/SpringJava/SpringLTW/src/main/java/de/spring/example/annotation/initTransactional.java b/SpringJava/SpringLTW/src/main/java/de/spring/example/annotation/initTransactional.java
new file mode 100644 (file)
index 0000000..dad0b3e
--- /dev/null
@@ -0,0 +1,14 @@
+package de.spring.example.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.springframework.stereotype.Component;
+
+@Target({ElementType.METHOD, ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Component
+public @interface initTransactional {
+}
diff --git a/SpringJava/SpringLTW/src/main/java/de/spring/example/web/Test.java b/SpringJava/SpringLTW/src/main/java/de/spring/example/web/Test.java
new file mode 100644 (file)
index 0000000..5cd7d2a
--- /dev/null
@@ -0,0 +1,40 @@
+package de.spring.example.web;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import de.spring.example.annotation.commitTransactional;
+import de.spring.example.annotation.initTransactional;
+
+
+public class Test {
+       private static final Logger LOGGER = LoggerFactory.getLogger(Test.class);
+
+    @initTransactional
+    public int myMethod()
+    {
+       LOGGER.info("The Advice should be run before.");
+
+       annotatedPrivateMethod();
+       
+       InnerTest innerTest = new InnerTest();
+       innerTest.innerMethod();
+       
+        return 666;
+    }
+
+    public class InnerTest {
+        @commitTransactional
+        public void innerMethod() {
+               LOGGER.info("I am the inner class. The Advice should be run after."
+                               + " NO NEED OF DECLARING Spring BEANS WHEN WEAVING!!!!");
+        }
+    }
+    
+    // IT WORKS WHEN WEAVING!!!
+    @initTransactional
+    private void annotatedPrivateMethod() {
+       LOGGER.info("The Advice should be run before even with private methods because I AM WEAVING."
+                       + " IT WORKS EVEN CALLING FROM METHOD OF THE SAME CLASS. It doesn't when using proxies AOP.");
+    }
+}
diff --git a/SpringJava/SpringLTW/src/main/resources/META-INF/aop.xml b/SpringJava/SpringLTW/src/main/resources/META-INF/aop.xml
new file mode 100644 (file)
index 0000000..2345268
--- /dev/null
@@ -0,0 +1,23 @@
+<!DOCTYPE aspectj PUBLIC
+        "-//AspectJ//DTD//EN" "http://www.eclipse.org/aspectj/dtd/aspectj.dtd">
+
+<aspectj>
+       <!--
+               With or without logs
+       <weaver>
+       -->     
+       <weaver options="-verbose -showWeaveInfo">
+        <!-- only weave classes in our application-specific packages -->
+               <include within="de.spring..*"/>
+               <!--
+                       Dump all types within the "somepack" package before they are woven
+                       to the "./_ajdump" folder on disk
+               -->
+               <dump within="de.spring..*"/>   
+    </weaver>
+    
+    <aspects>
+        <aspect name="de.spring.example.MyAdvice"/>        
+    </aspects>
+
+</aspectj>
diff --git a/SpringJava/SpringLTW/src/main/resources/log4j2.xml b/SpringJava/SpringLTW/src/main/resources/log4j2.xml
new file mode 100644 (file)
index 0000000..8b3fc3f
--- /dev/null
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- 
+       status: The level of internal Log4j events that should be logged to the console.
+       Valid values for this attribute are "trace", "debug", "info", "warn", "error" and "fatal".
+       
+       monitorInterval: The minimum amount of time, in seconds, that must elapse before the file configuration is checked for changes.
+       
+       
+       see https://logging.apache.org/log4j/2.x/manual/configuration.html
+ -->
+<Configuration status="error" strict="true" monitorInterval="30"
+                name="XMLConfigTest" packages="org.apache.logging.log4j.test">
+                
+       <!--
+               ALL > TRACE > DEBUG > INFO > WARN > ERROR > OFF
+               
+               ERROR by default.
+       -->
+                
+    <Appenders>
+        <Appender type="Console" name="STDOUT">
+            <PatternLayout pattern="%d{HH:mm:ss.SSS} %-5level %class{36} %L %M - %msg%xEx%n"/>
+        </Appender>
+    </Appenders>
+    <Loggers>
+    
+               <!-- 
+               General logging Spring.
+        -->
+        <Logger name="org.springframework" level="INFO" additivity="false">
+            <AppenderRef ref="STDOUT" />
+        </Logger>
+    
+
+               <!-- 
+                       Anything else will be using TRACE logging level.
+                -->        
+        <Root level="DEBUG">
+            <AppenderRef ref="STDOUT"/>
+        </Root>
+    </Loggers>
+</Configuration>
diff --git a/SpringJava/SpringLTW/src/main/resources/spring-config.xml b/SpringJava/SpringLTW/src/main/resources/spring-config.xml
new file mode 100644 (file)
index 0000000..ffb978c
--- /dev/null
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:context="http://www.springframework.org/schema/context" 
+       xsi:schemaLocation="http://www.springframework.org/schema/beans 
+                                                  http://www.springframework.org/schema/beans/spring-beans.xsd
+                                                  http://www.springframework.org/schema/context 
+                                                  http://www.springframework.org/schema/context/spring-context.xsd">
+
+       <!-- 
+                       We have to use SPRING ASPECTJ (no SPRING AOP 2.0/1.2) because we want to use
+               annotations with inner classes.
+                       AspectJ under this configuration requires at least one 'META-INF/aop.xml' file
+               with the configuration about the Advices.
+                       
+               This switches on the load-time weaving 
+           See: http://static.springsource.org/spring/docs/3.1.0.M2/spring-framework-reference/html/aop.html#aop-aj-ltw-spring
+       -->
+    <context:load-time-weaver  weaver-class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver"
+                                                  aspectj-weaving="autodetect"/>
+    
+       
+       <bean id="myAdvice" class="de.spring.example.MyAdvice">
+       
+    </bean>
+
+       <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
+                <property name="user" value="root"/>
+                <property name="password" value=""/>
+                <property name="driverClass" value="com.mysql.jdbc.Driver"/>
+                <property name="jdbcUrl" value="jdbc:mysql://127.0.0.1:3306/example?autoReconnect=true"/>
+                <property name="initialPoolSize" value="5"/>
+                <property name="maxPoolSize" value="20"/>
+                <property name="minPoolSize" value="10"/>
+                <property name="acquireIncrement" value="1"/>
+                <property name="acquireRetryAttempts" value="5"/>
+                <property name="acquireRetryDelay" value="1000"/>
+                <property name="automaticTestTable" value="con_test"/>
+                <property name="checkoutTimeout" value="5000"/>
+    </bean>
+    <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
+               <property name="dataSource" ref="dataSource"/>
+       </bean>
+       
+       <bean id="myTransactionManager"
+              class="de.spring.example.TransactionManager"
+              factory-method="getInstance">
+        <property name="transactionManager">
+            <ref bean="transactionManager" />
+        </property>
+    </bean>
+       
+       <!-- 
+               In order to find annotations in inner classes we have to create Spring 
+       beans of them. NO WHEN WEAVING!!! :)
+    -->
+    <bean id="testOuter" class="de.spring.example.web.Test"/>
+    
+    <!--
+       WHEN WEAVING WE MAY ANNOTATE METHODS IN INNER CLASSES. SO, WE DO NOT NEED TO CREATE
+       Spring BEANS OF THEM. WITH PROXY AOP WE HAVE TO, BUT WHEN WEAVING NO!!!  
+    <bean id="testInner" class="de.spring.example.web.Test$InnerTest">
+        <constructor-arg ref="testOuter"/>
+    </bean>
+    -->
+    
+</beans>