[weld-dev] Adding Classes at Run-time

Pete Muir pmuir at redhat.com
Mon Feb 15 10:41:44 EST 2010


Or, if you mean doing this at runtime (once the app has started), then there isn't currently a way to do this. 

There are essentially two options for how to do this. We can do either, neither or both.

1) Allow the user to request a "reload" of Weld, which rebuilds the Weld metadata for all classes, without clearing the session or application state. This is reasonably straightforward to do, as long as we have a consistent id for the beans (all built in beans are)
2) Allow the user to request a reload of the metadata for a given class. This is trickier as it raises the question of what validation to trigger.

there is also the option of allowing the addition of classes to a deployment, which is simpler than (2).

Anyway, please file a JIRA feature request in WELD to start with.

Pete

On 15 Feb 2010, at 05:07, Stuart Douglas wrote:

> Are you opening the jars before weld starts? If so you can add the classes from a PE using BeforeBeanDiscovery.addAnnotatedType().
> 
> Stuart
> 
> ________________________________________
> From: weld-dev-bounces at lists.jboss.org [weld-dev-bounces at lists.jboss.org] On Behalf Of Jason Lee [jason at steeplesoft.com]
> Sent: Monday, 15 February 2010 4:06 PM
> To: Weld-Dev
> Subject: [weld-dev] Adding Classes at Run-time
> 
> I have an odd question.  I have a situation where I'm manually opening a
> JAR and adding its classes to the ClassLoader.  What I'd like to be able
> to do is have Weld scan these classes for any relevant annotations and
> take the proper actions, just as if the JARs were in the classpath when
> the application started.  I've been staring at the JavaDocs (build
> locally, btw, as I can't find them on the web :| ) but I don't see any
> way to request that Weld inspect a given class.  Is it there and I'm
> missing it?  Am I going to have cobble together that functionality?  Am
> I asking for something that can't be done (right now)?  Any nudges in
> the right direction would be much appreciated. :)
> 
> --
> Jason Lee, SCJP
> President, Oklahoma City Java Users Group
> Senior Java Developer, Sun Microsystems
> http://blogs.steeplesoft.com
> 
> _______________________________________________
> weld-dev mailing list
> weld-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/weld-dev
> 
> _______________________________________________
> weld-dev mailing list
> weld-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/weld-dev




More information about the weld-dev mailing list