Spring annotation problem

Hi,

Is it not possible to combine @CommandHandler and @PreAuthorize(...)
annotations on a method?

When I do, I get a

java.lang.ClassFormatError: Duplicate method name&signature in class
file no/origin/axon/TestCommandHandler$$EnhancerByCGLIB$$ff55cf57_2$
$Enhanceraxon$$fc6cc56f

It would be nice to be able to authorize commandhandlers.

public class TestCommandHandler {

  @Autowired
  private EventBus eventBus;

  @CommandHandler
  @PreAuthorize("hasRole('ROLE_ADMIN')")
  public Integer handle(TestCommand command) {
    TestEvent event = new TestEvent();
    eventBus.publish(event);
    return 9;
  }

}

Geir

Hmm… interesting one. I agree 100% that this is a useful feature to have. And there’s probably a whole lot of other useful annotations you could put on a command handler.

The problem is related to a CGLib Proxy being proxied again.

I will look into it shortly. You can track progress here: http://code.google.com/p/axonframework/issues/detail?id=111

Thanks.

Allard

Allard,

the same happens if you annotate a @CommandHandler and @EventHandler
on two different methods in the same class. Probably the same issue
and not as interesting as the other one.

Geir