petclinic-uncached

removed cache and added tracer

4/9/2019 2:14:30 AM

Details

diff --git a/docker-compose.yml b/docker-compose.yml
index 35e16f9..f079574 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -3,9 +3,15 @@ services:
   application:
     build: .
     container_name: petclinic
+    environment:
+      - TRACER_SERIALISE_INTERNALS=false
+      - TRACER_VERBOSE=true
+      - TRACER_ENABLE=true
+      - TRACER_TRACES=/caching-approaches-comparison/applications/traces/petclinic
     volumes:
       - application:/application
       - /root/.m2:/root/.m2
+      - ../../../:/caching-approaches-comparison
     restart: unless-stopped
     ports:
       - 8080:8080

ignored 8(+8 -0)

diff --git a/ignored b/ignored
new file mode 100644
index 0000000..88750e3
--- /dev/null
+++ b/ignored
@@ -0,0 +1,8 @@
+br.ufrgs.inf.prosoft.applicationtracer.
+javax.cache.
+mysql.
+nz.net.ultraq.thymeleaf.
+org.ehcache.
+org.hsqldb.
+org.springframework.boot.
+org.webjars.
\ No newline at end of file

pom.xml 62(+58 -4)

diff --git a/pom.xml b/pom.xml
index afcf49b..cb32d5b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -38,10 +38,10 @@
       <groupId>org.springframework.boot</groupId>
       <artifactId>spring-boot-starter-actuator</artifactId>
     </dependency>
-    <dependency>
+<!--     <dependency>
       <groupId>org.springframework.boot</groupId>
       <artifactId>spring-boot-starter-cache</artifactId>
-    </dependency>
+    </dependency> -->
     <dependency>
       <groupId>org.springframework.boot</groupId>
       <artifactId>spring-boot-starter-data-jpa</artifactId>
@@ -79,14 +79,14 @@
     </dependency>
 
     <!-- caching -->
-    <dependency>
+<!--     <dependency>
       <groupId>javax.cache</groupId>
       <artifactId>cache-api</artifactId>
     </dependency>
     <dependency>
       <groupId>org.ehcache</groupId>
       <artifactId>ehcache</artifactId>
-    </dependency>
+    </dependency> -->
 
     <!-- webjars -->
     <dependency>
@@ -115,10 +115,64 @@
       <artifactId>spring-boot-devtools</artifactId>
       <scope>runtime</scope>
     </dependency>
+
+        <dependency>
+            <groupId>br.ufrgs.inf.prosoft.applicationtracer</groupId>
+            <artifactId>ApplicationTracer</artifactId>
+            <version>1.0</version>
+        </dependency>
+
   </dependencies>
 
   <build>
     <plugins>
+
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>aspectj-maven-plugin</artifactId>
+                <version>1.11</version>
+                <configuration>
+                    <showWeaveInfo>false</showWeaveInfo>
+                    <complianceLevel>1.8</complianceLevel>
+                    <source>1.6</source>
+                    <target>1.6</target>
+                    <Xlint>ignore</Xlint>
+                    <encoding>UTF-8</encoding>
+                    <verbose>false</verbose>
+                    <forceAjcCompile>true</forceAjcCompile>
+                    <sources/>
+                    <weaveDirectories>
+                        <weaveDirectory>${project.build.directory}/classes</weaveDirectory>
+                    </weaveDirectories>
+                    <aspectLibraries>
+                        <aspectLibrary>
+                            <groupId>br.ufrgs.inf.prosoft.applicationtracer</groupId>
+                            <artifactId>ApplicationTracer</artifactId>
+                        </aspectLibrary>
+                    </aspectLibraries>
+                </configuration>
+                <executions>
+                    <execution>
+                        <phase>process-classes</phase>
+                        <goals>
+                            <goal>compile</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <dependencies>
+                    <dependency>
+                        <groupId>org.aspectj</groupId>
+                        <artifactId>aspectjrt</artifactId>
+                        <version>1.9.1</version>
+                    </dependency>
+                    <dependency>
+                        <groupId>org.aspectj</groupId>
+                        <artifactId>aspectjtools</artifactId>
+                        <version>1.9.1</version>
+                    </dependency>
+                </dependencies>
+            </plugin>
+
       <plugin>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-maven-plugin</artifactId>
diff --git a/src/main/java/org/springframework/samples/petclinic/system/CacheConfig.java b/src/main/java/org/springframework/samples/petclinic/system/CacheConfig.java
index 13e194c..8d7291f 100755
--- a/src/main/java/org/springframework/samples/petclinic/system/CacheConfig.java
+++ b/src/main/java/org/springframework/samples/petclinic/system/CacheConfig.java
@@ -1,10 +1,10 @@
 package org.springframework.samples.petclinic.system;
 
-import javax.cache.configuration.Configuration;
-import javax.cache.configuration.MutableConfiguration;
+// import javax.cache.configuration.Configuration;
+// import javax.cache.configuration.MutableConfiguration;
 
-import org.springframework.boot.autoconfigure.cache.JCacheManagerCustomizer;
-import org.springframework.cache.annotation.EnableCaching;
+// import org.springframework.boot.autoconfigure.cache.JCacheManagerCustomizer;
+// import org.springframework.cache.annotation.EnableCaching;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Profile;
 
@@ -12,21 +12,21 @@ import org.springframework.context.annotation.Profile;
  * Cache could be disabled in unit test.
  */
 @org.springframework.context.annotation.Configuration
-@EnableCaching
+// @EnableCaching
 @Profile("production")
 class CacheConfig {
 
-    @Bean
-    public JCacheManagerCustomizer cacheManagerCustomizer() {
-        return cm -> {
-            Configuration<Object, Object> cacheConfiguration = createCacheConfiguration();
-            cm.createCache("vets", cacheConfiguration);
-        };
-    }
+    // @Bean
+    // public JCacheManagerCustomizer cacheManagerCustomizer() {
+    //     return cm -> {
+    //         Configuration<Object, Object> cacheConfiguration = createCacheConfiguration();
+    //         cm.createCache("vets", cacheConfiguration);
+    //     };
+    // }
 
-    private Configuration<Object, Object> createCacheConfiguration() {
+    // private Configuration<Object, Object> createCacheConfiguration() {
         // Create a cache using infinite heap. A real application will want to use an
         // implementation dependent configuration that will better fit your needs
-        return new MutableConfiguration<>().setStatisticsEnabled(true);
-    }
+        // return new MutableConfiguration<>().setStatisticsEnabled(true);
+    // }
 }
diff --git a/src/main/java/org/springframework/samples/petclinic/vet/VetRepository.java b/src/main/java/org/springframework/samples/petclinic/vet/VetRepository.java
index 20863ce..c96b7a4 100644
--- a/src/main/java/org/springframework/samples/petclinic/vet/VetRepository.java
+++ b/src/main/java/org/springframework/samples/petclinic/vet/VetRepository.java
@@ -17,7 +17,7 @@ package org.springframework.samples.petclinic.vet;
 
 import java.util.Collection;
 
-import org.springframework.cache.annotation.Cacheable;
+// import org.springframework.cache.annotation.Cacheable;
 import org.springframework.dao.DataAccessException;
 import org.springframework.data.repository.Repository;
 import org.springframework.transaction.annotation.Transactional;
@@ -39,7 +39,7 @@ public interface VetRepository extends Repository<Vet, Integer> {
      * @return a <code>Collection</code> of <code>Vet</code>s
      */
     @Transactional(readOnly = true)
-    @Cacheable("vets")
+    // @Cacheable("vets")
     Collection<Vet> findAll() throws DataAccessException;