By now, most web containers have an annotation variant of their xml configurations for Java EE. I’m guessing this is because it’s better to keep things in Java where they can be managed, coded with and controlled. The problem, however, still remains that with annotations you cannot efficiently debug and diagnose an issue because when an exception is thrown it doesn’t give you the full stack but instead, just the head.
The reason why this happens is because annotations use reflection and debugging will not work in reflection unless a coder places their own breakpoints which is not always possible.
Does anyone have a way around this or has anyone experienced the same problem when fixing issues on a Java EE web application?
Annotations by design, aren’t meant to be debugged. They’re just markers on your code, for instance in Hibernate, to say if a entity is related to another entity.
To put that into perspective, you wouldn’t debug a table relationship or the actual
@OneToMany(fetch=FetchType.LAZY, mappedBy="person")
Just as if you were using Spring for MVC as you mention web applications, if you were debugging a web application, you wouldn’t actually be debugging the @Controller
annotation, you’d be debugging what the controller method actually did.
1