Re: [ANN] WOInject 1.0
Re: [ANN] WOInject 1.0
- Subject: Re: [ANN] WOInject 1.0
- From: Ron X <email@hidden>
- Date: Thu, 12 Apr 2012 14:04:44 +0300
please tell me - how you start app with woinject?
i can't do that!
everytime i have
Exception in thread "main" java.lang.NoClassDefFoundError: com/ronx/Application
Caused by: java.lang.ClassNotFoundException: com.ronx.Application
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
or if i comment ERXApplication.main(argv, Application.class);
than every class in my app is not visible in classpath!
12 апреля 2012 г. 0:12 пользователь Henrique Prange
<email@hidden> написал:
Hi Lachlan,
Indeed, that is a much simpler and straight to the point solution. :)
Cheers,
Henrique
On 11/04/2012, at 15:55, Lachlan Deck wrote:
> On 11/04/2012, at 12:28 PM, Ramsey Gurley wrote:
>
>> What if I want an advanced service on component one and a basic service on component two?
>
> class ComponentOne
> {
> @Inject
> AdvancedService service;
> }
> class ComponentTwo
> {
> @Inject
> BasicService service;
> }
>
> <...>
> class AppModule
> {
> void configure()
> {
> bind(BasicService.class).to(BasicServiceImpl.class);
> bind(AdvancedService.class).to(AdvancedServiceImpl.class);
> }
> }
>
> Next you'll ask, what if I have two types of advanced services and depending on certain conditions I want one or the other (e.g., session-aware or not). It's quite flexible and can be nicely done. Refer to guice docs.
>
> e.g.,
> bind(ConditionalService.class).toProvider(ConditionalServiceProvider.class);
>
> class ConditionalServiceProvider implements Provider<ConditionalService>
> {
> @Inject @Current
> WOContext context;
>
> public ConditionalService get()
> {
> <...>
> }
> }
>
> The other thing to say about IoC is that it serves another purpose, that of allowing for easy mocking in unit tests, and testing that 'thing' separately.
>
> cheers,
> Lachlan Deck
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (
email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden