2 Replies Latest reply on Nov 17, 2012 6:59 AM by smsiebe

    Custom framework lifecycle callback

    smsiebe

      I'm developing a framework for resource injection based on the CDI/Weld container.  I would like to create framework-specific/custom application lifecycle annotations, such as @CreateOnStartup and @DestroyOnStartup that would annotate methods that would be invoked by the framework.  I have a working implementation, but it leaves me with a "SEVERE warning" bit of a sour code smell, hoping to get some advice.

       

      Basically, in the framework Extension, I observe ProcessAnnotatedType, storing the metadata about the methods that are annotated with the framework lifecycle annotations.  Later, when observing the AfterDeploymentValidation, I iterate over the metadata, calling using an InjectionTarget to get an instance of the bean and injecting any dependencies, and (gulp) using java.lang.Method to invoke the method.  This is where I feel I might not be doing the right thing. 

       

      When I run an application using the framework, it works....but I do get a SEVERE "warning" in the glassfish server log stating: SEVERE: No valid EE environment for injection of <classname>. I say warning because I don't get a corresponding stack trace....and everything works.

       

      So, two questions:

      1) Will using java.lang.Method cause unforeseen pain and ridicule from my peers?

      2) Any idea what is going on with these SEVERE warnin