This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to branch jpa-SNAPSHOT
in repository https://gitbox.apache.org/repos/asf/isis-app-helloworld.git


The following commit(s) were added to refs/heads/jpa-SNAPSHOT by this push:
     new f56ba3d  enables load time weaving
f56ba3d is described below

commit f56ba3d7209a644b3666dd5f93b056ec78df4c7d
Author: Dan Haywood <[email protected]>
AuthorDate: Fri Aug 26 14:23:07 2022 +0100

    enables load time weaving
---
 .run/HelloWorldApp.run.xml                      |   3 +-
 README.adoc                                     |  48 ++++++++++++++++++++----
 lib/README.txt                                  |   3 --
 lib/spring-instrument-5.3.5.jar                 | Bin 7429 -> 0 bytes
 lib/spring-instrument.jar                       | Bin 0 -> 7454 bytes
 pom.xml                                         |  19 +++++++++-
 src/main/java/domainapp/webapp/AppManifest.java |   2 +
 7 files changed, 62 insertions(+), 13 deletions(-)

diff --git a/.run/HelloWorldApp.run.xml b/.run/HelloWorldApp.run.xml
index 85d65f3..fc89df7 100644
--- a/.run/HelloWorldApp.run.xml
+++ b/.run/HelloWorldApp.run.xml
@@ -3,8 +3,9 @@
     <option name="ACTIVE_PROFILES" />
     <module name="helloworld-jpa" />
     <option name="SPRING_BOOT_MAIN_CLASS" 
value="domainapp.webapp.HelloWorldApp" />
+    <option name="VM_PARAMETERS" value="-javaagent:lib/spring-instrument.jar" 
/>
     <method v="2">
       <option name="Make" enabled="true" />
     </method>
   </configuration>
-</component>
\ No newline at end of file
+</component>
diff --git a/README.adoc b/README.adoc
index a3718ac..3994129 100644
--- a/README.adoc
+++ b/README.adoc
@@ -42,7 +42,16 @@ cd $REPO
 mvn clean install
 ----
 
-* Run from Maven:
+* Download the `spring-instrument.jar` for load-time weaving (discussed in 
more detail xref:#orm-support[below]):
++
+[source,bash]
+----
+mvn dependency:get -DgroupId=org.springframework 
-DartifactId=spring-instrument -Dversion=XXX
+----
++
+Change "XXX" to the value that `${spring-framework.version}` resolves to in 
the webapp `pom.xml`
+
+* Run using Maven:
 +
 [source,bash]
 ----
@@ -56,23 +65,48 @@ mvn spring-boot:run
 ** username: `sven`
 ** password: `pass`
 
++
 The app runs with H2 running in-memory.
 
 
 
-== Development
+[#orm-support]
+== ORM Support
 
-Apache Isis uses DataNucleus as its ORM, which requires that any entities are 
"enhanced", a post-compile process.
+This version of the application uses EclipseLink JPA as its ORM, configured 
with load-time weaving.
+This requires that the application be run with a Java agent.
 
-Normally this is done as part of a "mvn clean install", but the entities can 
also be enhanced explicity using:
+The spring-boot plugin is configured to run with this agent already.
+If you want to run from an IDE:
 
+* first, you might wish to copy the file locally:
++
+[source,bash]
+----
+cp 
~/.m2/repository/org/springframework/spring-instrument/XXX/spring-instrument-XXX.jar
 lib/spring-instrument.jar
+----
++
+Change "XXX" to the value that `${spring-framework.version}` resolves to in 
the webapp `pom.xml`
+
+* Then specify the agent as a VM option:
++
 [source,bash]
 ----
-mvn datanucleus:enhance -o
+-javaagent:lib/spring-instrument.jar
 ----
 
-This is useful to know if the application fails to bootstrap, complaining of 
"unenhanced entities".
 
-TIP: You can also use `enhance-all.sh`
 
+//This version of the application uses DataNucleus as its ORM, which requires 
that any entities are "enhanced", a post-compile process.
+//
+//Normally this is done as part of a "mvn clean install", but the entities can 
also be enhanced explicity using:
+//
+//[source,bash]
+//----
+//mvn -pl module-simple datanucleus:enhance -o
+//----
+//
+//This is useful to know if the application or integration test fails to 
bootstrap, complaining of "unenhanced entities".
+//
+//TIP: You can also use `enhance-all.sh`
 
diff --git a/lib/README.txt b/lib/README.txt
deleted file mode 100644
index 8cd1712..0000000
--- a/lib/README.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-If eclipselink.weaving=true, then run using JVM argument:
-
- -javaagent:lib/spring-instrument-5.3.5.jar
diff --git a/lib/spring-instrument-5.3.5.jar b/lib/spring-instrument-5.3.5.jar
deleted file mode 100644
index 164db3b..0000000
Binary files a/lib/spring-instrument-5.3.5.jar and /dev/null differ
diff --git a/lib/spring-instrument.jar b/lib/spring-instrument.jar
new file mode 100644
index 0000000..4d53771
Binary files /dev/null and b/lib/spring-instrument.jar differ
diff --git a/pom.xml b/pom.xml
index b9f799a..41c1cd3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -25,6 +25,13 @@
 
     <build>
         <resources>
+            <resource>
+                <filtering>true</filtering>
+                <directory>src/main/resources</directory>
+                <includes>
+                    <include>application.yml</include>
+                </includes>
+            </resource>
             <resource>
                 <filtering>false</filtering>
                 <directory>src/main/resources</directory>
@@ -47,6 +54,9 @@
                 <artifactId>spring-boot-maven-plugin</artifactId>
                 <configuration>
                     <classifier>exec</classifier>
+                    <agents>
+                        
<agent>${env.HOME}/.m2/repository/org/springframework/spring-instrument/${spring-framework.version}/spring-instrument-${spring-framework.version}.jar</agent>
+                    </agents>
                 </configuration>
             </plugin>
         </plugins>
@@ -71,8 +81,8 @@
         </dependency>
 
         <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-actuator-autoconfigure</artifactId>
+            <groupId>org.apache.isis.viewer</groupId>
+            <artifactId>isis-viewer-wicket-applib</artifactId>
         </dependency>
 
         <dependency>
@@ -80,6 +90,11 @@
             <artifactId>isis-testing-h2console-ui</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-actuator-autoconfigure</artifactId>
+        </dependency>
+
     </dependencies>
 
     <profiles>
diff --git a/src/main/java/domainapp/webapp/AppManifest.java 
b/src/main/java/domainapp/webapp/AppManifest.java
index 4f2e6cd..71924b4 100644
--- a/src/main/java/domainapp/webapp/AppManifest.java
+++ b/src/main/java/domainapp/webapp/AppManifest.java
@@ -13,6 +13,7 @@ import 
org.apache.isis.persistence.jpa.eclipselink.IsisModulePersistenceJpaEclip
 import org.apache.isis.security.shiro.IsisModuleSecurityShiro;
 import org.apache.isis.testing.h2console.ui.IsisModuleTestingH2ConsoleUi;
 import 
org.apache.isis.viewer.restfulobjects.jaxrsresteasy4.IsisModuleViewerRestfulObjectsJaxrsResteasy4;
+import org.apache.isis.viewer.wicket.applib.IsisModuleViewerWicketApplibMixins;
 import org.apache.isis.viewer.wicket.viewer.IsisModuleViewerWicketViewer;
 
 import domainapp.modules.hello.HelloWorldModule;
@@ -26,6 +27,7 @@ import domainapp.modules.hello.HelloWorldModule;
         IsisModuleSecurityShiro.class,
         IsisModulePersistenceJpaEclipselink.class,
         IsisModuleViewerRestfulObjectsJaxrsResteasy4.class,
+        IsisModuleViewerWicketApplibMixins.class,
         IsisModuleViewerWicketViewer.class,
 
         IsisModuleTestingH2ConsoleUi.class,

Reply via email to