Stranger things have happened. But this blows many a mind. mvn test on a restful services project with spring mvc succeeds but mvn sonar:sonar fails with 404s on controllers. This happens when the controllers are marked @transactional for the restful service to be exposed as a unit of work. Don't fret. Its easy to solve this.
This happens because unlike services which are generally proxied by thier interfaces, Controllers are generally defined without interfaces. The Controller methods are then proxied by cglib (when no interfaces exist) and are no longer visible in their qualified name after instrumention by sonar for code analysis.
Just add proxy-target-class="true" instruction to tx annotation driven in the test context. so the testContext.xml should have the following
This happens because unlike services which are generally proxied by thier interfaces, Controllers are generally defined without interfaces. The Controller methods are then proxied by cglib (when no interfaces exist) and are no longer visible in their qualified name after instrumention by sonar for code analysis.
Just add proxy-target-class="true" instruction to tx annotation driven in the test context. so the testContext.xml should have the following
<tx:annotation-driven proxy-target-class="true"/>Where as the main application context can remain without proxying
<tx:annotation-driven/>