java - Using object from other module in aspect -


i have 1 aspect using aspectj below:

public aspect testaspect {      pointcut classicpointcut(persistencemanagerimpl object) : execution(manager.persistencemanagerimpl.new(..)) && target(object);      after(persistencemanagerimpl object) : classicpointcut(object){         system.err.println(object.getclass().getsimplename());     } } 

this aspect in module aspect. module packaking jar. persistencemanagerimpl in other module need use in module aspect. dependency management use maven. here of course problem cyclic reference. exists way how can resolve problem ?

----------edit----------

i error:

java.lang.nosuchmethoderror:testaspect.ajc$after$testaspect$1$cc149106(ljava/lang/object;)v 

when move aspect same module, when persistencemanagerimpl obtain correct solution(of course). not, wanted.

could put error result of compiling code? try put module dependency first later put dependency on aspectj maven plugin @ weavedependency in pom.xml follow:

.... <dependency>             <groupid>com.maventest</groupid>             <artifactid>mytest</artifactid>             <version>1.0-snapshot</version>             <scope>compile</scope>         </dependency> ....  .... <plugin>                                                                <groupid>org.codehaus.mojo</groupid>                                <artifactid>aspectj-maven-plugin</artifactid>                       <version>1.8</version>                                              <executions>                                                            <execution>                                                             <goals>                                                                 <goal>compile</goal>                                            </goals>                                                         </execution>                                                     </executions>                                                       <configuration>                                                          <source>${maven.compiler.source}</source>                            <target>${maven.compiler.target}</target>                            <showweaveinfo>true</showweaveinfo>                                 <compliancelevel>${maven.compiler.target}</compliancelevel>         <encoding>${project.build.sourceencoding}</encoding>                 <weavedependencies>                                                      <weavedependency>                                                       <groupid>com.maventest</groupid>                 <artifactid>mytest</artifactid>                               </weavedependency>                                               </weavedependencies>                                             </configuration>                                                     <dependencies>                                                           <dependency>                                                             <groupid>org.aspectj</groupid>                                       <artifactid>aspectjrt</artifactid>                                   <version>${aspectj.version}</version>                            </dependency>                                                       <dependency>                                                            <groupid>org.aspectj</groupid>                                       <artifactid>aspectjtools</artifactid>                                <version>${aspectj.version}</version>                            </dependency>                                                    </dependencies>                                                 </plugin>  

ps: see question post asking same thing here


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -