lazy/on-demand binding?

60 views
Skip to first unread message

stephanos

unread,
Oct 29, 2014, 7:19:24 AM10/29/14
to google...@googlegroups.com
Hey there,

we are using Guice on App Engine. One trick we have used is to annotate all classes we want to bind to Guice with @AutoBind and use the fantastic classindex library to simply read them all from a compile-time generated file. No classpath scanning! Unfortunately, as we were adding class after class, now the Guice setup takes around 1.5 seconds. In a cloud environment where instances are constantly started and shut down this has a big impact. The profiler tells us that classpath loading is responsible for the lion share.

So long story short: How to delay the classloading until it is really needed? Something like bind("com.example.MyClass")?

Regards
Stephan

stephanos

unread,
Oct 31, 2014, 6:46:01 AM10/31/14
to google...@googlegroups.com
Great news! The classindex library just added the ability to get a list of all annotated class names, without actually loading the class. This would allow us to lazy load all our classes that are annotated with @AutoBInd. Now the missing piece is figuring out how to delay the classloading in Guice ...
Reply all
Reply to author
Forward
0 new messages