load-time-weaving

Spring AOP and AspectJ Load-Time Weaving: Around advice will be invoked twice for private methods

此生再无相见时 提交于 2020-03-05 07:53:46
问题 I will use Spring AOP and AspectJ Load-Time Weaving to measure execution time of specific private/protected/public methods in my code. To do this I wrote following annotation with one I will annotate the methods which execution time should be measured: package at.scan.spring.aop.measuring; import org.aspectj.lang.ProceedingJoinPoint; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target;

@SpringBootTest interferes with EclipseLink dynamic weaving

﹥>﹥吖頭↗ 提交于 2020-02-24 11:54:30
问题 My company is developing a web application using Spring Boot, Spring MVC, JPA with EclipseLink and dynamic weaving. My task is to prepare implementation of UI and integration tests spinning up the application using JUnit and @SpringBootTest and interacting with it using Selenium. As stated at Spring Boot Testing Features, Tests using the @SpringBootApplication annotation can make use of the @MockBean annotation to define Mockito mocks for beans within the ApplicationContext. This is achieved

Aspect weaving at runtime

依然范特西╮ 提交于 2020-01-31 09:38:33
问题 I'm looking for a Java solution that would allow me to use AOP to weave new code on top of already running code at runtime. The key is not to require the restart of the JVM. Also, I'd like to remove the woven at runtime, leaving the old code running the way it was before weaving. I'm thinking AspectJ load time weaving + runtime class loading/unloading would do it. Has anyone tried it? Any recommendations? Thank you. 回答1: A few things to consider: True, you can do LTW during class loading, but

LazyToOne and Spring LoadTimeWeaver

回眸只為那壹抹淺笑 提交于 2020-01-13 14:44:47
问题 I have the known problem, that Hibernate loads the data eager even with the annotation fetchtype.lazy (described for example here: http://justonjava.blogspot.de/2010/09/lazy-one-to-one-and-one-to-many.html). So I added the annotation @LazyToOne(LazyToOneOption.NO_PROXY) to my attributes and enabled bytecode Instrumentation with springs loadtimeweaver. But hibernate still loads my properties eagerly. I have tested the loadtimeweaver by weaving own code and it works. Does anyone know what I

LazyToOne and Spring LoadTimeWeaver

早过忘川 提交于 2020-01-13 14:44:02
问题 I have the known problem, that Hibernate loads the data eager even with the annotation fetchtype.lazy (described for example here: http://justonjava.blogspot.de/2010/09/lazy-one-to-one-and-one-to-many.html). So I added the annotation @LazyToOne(LazyToOneOption.NO_PROXY) to my attributes and enabled bytecode Instrumentation with springs loadtimeweaver. But hibernate still loads my properties eagerly. I have tested the loadtimeweaver by weaving own code and it works. Does anyone know what I

Is it possible to exclude interface classes from AspectJ weaving

拈花ヽ惹草 提交于 2020-01-02 04:38:07
问题 Scenario: I have a mix of source files for classes, interfaces, and enums all together in one package like so: package com.mycompany.data; class Dog { // implementation } package com.mycompany.data; class Cat { // implementation } package com.mycompany.data; enum Gender { // gender options } package com.mycompany.data; interface Animal { // methods } // ... plus a lot more concrete classes and a few more interfaces ... The Goal : To have all of the classes implement a new interface and a new

Running Unit Tests using Maven in Spring LTW Environment

自作多情 提交于 2020-01-01 09:10:33
问题 I am developing an application in a ddd architecture using Spring LoadTimeWeaving feature. The problem is i can run my Junit tests using eclipse but not through Maven. I have tried all the options given on various sites but it simply isn't working. I get the following exception: Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'loadTimeWeaver': Initialization of bean failed; nested exception is java.lang.IllegalStateException: ClassLoader [sun

WebSphere Load-Time weaving not enhancing jpa entities

Deadly 提交于 2019-12-25 02:37:29
问题 I have re-written my entire question with my latest configuration. I have been changing and testing multiple times and still have not found the proper solution. I am having difficulty enabling load-time-weaving for jpa class enhancement in my project. I am using Websphere 8.5 which in turn uses openjpa 2.2.2 . I have one Ear file with one War and many dependant jars that contain JPA entities and custom named persistence.xml files. like so: MyApp.ear |-- lib ## contains spring files and other

How to ensure load time weaving takes place for Eclipselink when using SpringBootTest with other tests running beforethe Spring one

[亡魂溺海] 提交于 2019-12-24 08:36:02
问题 I'm using Spring Rest Docs to generate documentation for my REST services. This involves running unit(strictly integration) tests that run against a live Spring Boot Container that is kicked off by the test. The test class looks like this: @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest(classes = MySpringConfiguration.class) @WebAppConfiguration public class ApiDocumentation { private MockMvc mockMvc; @Rule public final JUnitRestDocumentation restDocumentation = new

AspectJ load-time weaving for signed jars

旧时模样 提交于 2019-12-21 04:42:15
问题 Does anybody success in using AspectJ load-time weaving with signed jars? I got an exception and have no idea how to fix it (tested with AspectJ 1.6.8-16.10): Exception in thread "main" java.lang.NoClassDefFoundError: com/package/clazz$AjcClosure1 at com.package.test.main(test.java:55) Caused by: java.lang.ClassNotFoundException: com.package.clazz$AjcClosure1 at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net