Announcement Announcement Module
Collapse
No announcement yet.
@configurable & Exception in Post-processor Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • @configurable & Exception in Post-processor

    Hi,

    I am new to AOP and have been trying for a while to get this working so any help would be...well, helpful.

    I have a domain object which I have annotated with @Configurable.

    I have included this domain object in the spring-beans file and set the scope to prototype. I have also been foreced to make it abstract=true, otherwise I get an error that the class could not be constructed (as there is no no-arg constructor) .

    My Spring beans file includes the XML <context:spring-configured/>

    I have a aop.xml file in META-INF with the following options
    Code:
    <!DOCTYPE aspectj PUBLIC "-//AspectJ//DTD//EN" 
       "http://www.eclipse.org/aspectj/dtd/aspectj.dtd">
    <aspectj>
    	 <weaver options="-verbose -Xset:weaveJavaxPackages=true">
              <include  within="x.y.z.*"/>
         </weaver>
    </aspectj>
    I have put the following plugin into my Maven POM
    Code:
    <plugins>
          <plugin>
    		<groupId>org.codehaus.mojo</groupId>
    		<artifactId>aspectj-maven-plugin</artifactId>
    		<configuration>
    			<source>1.5</source>
    			<target>1.5</target>
    			<aspectLibraries>
    				<aspectLibrary>
    					<groupId>org.springframework</groupId>
    					<artifactId>spring-aspects</artifactId>
    				</aspectLibrary>
    			</aspectLibraries>
    		</configuration>
    		<executions>
    			<execution>
    				<goals>
    					<goal>compile</goal>
    					<!-- use this goal to weave all your main classes -->
    					<goal>test-compile</goal>
    					<!-- use this goal to weave all your test classes -->
    				</goals>
    			</execution>
    		</executions>
    	</plugin>
    And I have set up a test case - which I run with the param : -javaagent:c:/tmp/aspectjweaver-1.6.8.jar

    When I run my test I am able to step through the code and see that AspectJ does indeed intercept my construcuted object, and it does inject the correct property into the object.

    Unfortunately it fails on BeanConfigurerSupport.checkExposedObject The error message is:

    Code:
    Post-processor tried to replace bean instance of type [x.y.z.StructureStorageImpl] with (proxy) object of type [$Proxy31] - not supported for aspect-configured classes!
    Can anyone please help me? I really really want to get this working and I'm so close....

  • #2
    AHA!!!

    I have the cause, but not the solution.......

    <tx:annotation-driven transaction-manager="transactionManager"/>

    Causes this to happen.....The domain object I am creating contains beans which contain DAO's and transationctional annotations......

    Still looking for a solution to the problem though....

    Comment


    • #3
      Solution

      <tx:annotation-driven transaction-manager="transactionManager" mode="aspectj"/>

      Comment

      Working...
      X