Re: @Transactional commit issue

2019-06-26 Thread Thomas Broyer
On Wednesday, June 26, 2019 at 9:10:24 AM UTC+2, Kasper Nielsen wrote: > > > > > though generally-speaking I avoid Guice Persist in new projects; if only > because there's no validation that @Transactional is correctly applied and > will have any effect (and we've had bugs because of that:

Re: @Transactional commit issue

2019-06-26 Thread Thomas Broyer
On Tuesday, June 25, 2019 at 7:23:07 PM UTC+2, Viraj Jasani wrote: > > Although this thread is old, I just happened to come across while trying > to understands internals of guice @Transactional. > > If class A has caller method that calls a public @Transactional method in > it's own class,

Re: Feature Request Guice automatically builder pattern

2019-02-27 Thread Thomas Broyer
Would that work? @ProvidedBy(AutoValue_ExampleB.Builder.class) @AutoValue abstract class ExampleB { … @AutoValue.Builder abstract static class Builder implements Provider { @Inject abstract Builder setA(A a); @Inject abstract Builder setB(B b); … abstract ExampleB get();

guide extra filter does not bind.

2018-06-22 Thread Thomas Broyer
If you explicitly call the JWTFilter() method, then don't annotate it with `@Provides`. The error is that you have more than one bindings for the Filter class with no qualifier annotation, and not providing into a set (multibinding); but you don't actually need those bindings. -- You

Re: Guice injection not working in web application

2018-06-19 Thread Thomas Broyer
On Tuesday, June 19, 2018 at 12:44:07 AM UTC+2, scl wrote: > > Unless you tell guice that a dependency is optional it will never inject > null. It would fail with an exception if it could not fullfil a dependency. > > So for me the most likely cause of you seeing null is that the instance >

Re: Preventing others from using 'new' when object is created by Guice?

2018-02-02 Thread Thomas Broyer
FYI https://github.com/google/guice/wiki/KeepConstructorsHidden -- You received this message because you are subscribed to the Google Groups "google-guice" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-guice+unsubscr...@googlegroups.com. To

how to retrieve objects / values directly from the scope they are bound to using the binding key ?

2017-02-27 Thread Thomas Broyer
Couldn't you inject the Injector? -- You received this message because you are subscribed to the Google Groups "google-guice" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-guice+unsubscr...@googlegroups.com. To post to this group, send email

Re: How do i return a proxied object from provider ?

2016-11-04 Thread Thomas Broyer
AFAIK, Guice doesn't create a proxy, it synthesizes a subclass that overrides matched methods and then instantiate them instead of the original class. -- You received this message because you are subscribed to the Google Groups "google-guice" group. To unsubscribe from this group and stop

Re: How do i return a proxied object from provider ?

2016-11-04 Thread Thomas Broyer
Could you maybe create a Foo subclass? class SubFoo extends Foo { public SubFoo() { super(10); } } … bind(Foo.class).to(SubFoo.class); bindInterceptor(…)… On Friday, November 4, 2016 at 3:48:42 AM UTC+1, lei wang wrote: > > I want to add an interceptor to a 3rd party class. Since it does

Re: requireBinding for a BindingAnotation possible?

2016-09-19 Thread Thomas Broyer
You need to require the Map, not the raw Map class. requireBinding(Key.get(new TypeLiteral>(){}, MyMap)) On Monday, September 19, 2016 at 3:25:03 PM UTC+2, Steve Storck wrote: > > Some of my modules require a binding from another module. I want to set > up a

Guice Persist support for Neo4j

2016-09-13 Thread Thomas Broyer
Hi, A few years ago, I did a similar thing at https://github.com/tbroyer/guice-persist-neo4j Feel free to borrow some code, but IIRC it didn't do more than yours. -- You received this message because you are subscribed to the Google Groups "google-guice" group. To unsubscribe from this group

Re: Spam in digest emails

2016-01-02 Thread Thomas Broyer
I've seen several spams the past two weeks. Can't remember if they were all in this group or possibly also in Guava. As soon as I see one I try to report it as spam (can't do that on mobile though). Note: I follow the group on the web, not by mail; so u don't have the additional layer of gmail

Using ProvisionListener to Find Bindings in(Singleton.class)

2015-11-03 Thread Thomas Broyer
The Car binding isn't a Singleton; the Vehicle one is. Using separate bind() calls might do what you want: bind(Vehicle.class).to(Car.class); bind(Car.class).in(Singleton.class); (I don't know listeners much so can't really help beyond the above) -- You received this message because you are

Re: Guice Servlets

2015-07-10 Thread Thomas Broyer
On Friday, July 10, 2015 at 12:04:20 PM UTC+2, Naresh Janarthanam wrote: web.xml configuration for servlets can also be removed using javax.servlet.annotation.WebServlet. Any thoughts, if other Guice servlet module functionalities like Scopes and filter will be supported by standard

Re: MultiBinder - injecting CollectionProviderT

2015-06-11 Thread Thomas Broyer
Which version are you using? This will only work starting with 4.0-beta5: https://github.com/google/guice/commit/4faa20e3081448792933834aedfe972add806292 On Thursday, June 11, 2015 at 2:10:56 PM UTC+2, Suma Shivaprasad wrote: Trying to inject a collection of providers which implement an

Re: Can one module installed twice?

2014-09-09 Thread Thomas Broyer
On Tuesday, September 9, 2014 3:09:21 AM UTC+2, Hanlu Chen wrote: There are four modules A, B, C, D. Their dependency is like graph below A D | \ / | B | / C Could I install C B in A and then install C in B again? The experiment would just work, but I failed to find

Re: how to use guice properly.

2014-08-21 Thread Thomas Broyer
On Thursday, August 21, 2014 8:43:18 AM UTC+2, Jochen Wiedmann wrote: I'm not sure, whether I get you right. But to me this sounds like a situation where I would create child injectors and somehow make sure that they are accessible. For example, in a web application, I might create a

Re: Module, Test and Mock

2014-08-21 Thread Thomas Broyer
On Thursday, August 21, 2014 2:42:04 PM UTC+2, scl wrote: If you pass dependencies in you constructor which are not required for the test then your class has most likely too many responsibilities. If all your dependencies are required for the test you have to adapt the test any ways and

Re: idle thought: host code on github instead?

2014-05-28 Thread Thomas Broyer
On Tuesday, May 27, 2014 10:31:37 PM UTC+2, Sam Berlin wrote: What do folks think of the idea? It'd make accepting patches easier (with pull requests, etc), and I'm sure there's other benefits for folks using the code too. +1 We could also migrate issues if anyone knows a way to do

Re: [OSGi] NoClassDefFoundError: com/google/inject/internal/util/$StackTraceElements

2014-05-21 Thread Thomas Broyer
I had a similar exception when mixing extensions from Guice 3 with Guice 4. In my project, I use Guice 4.0-beta4, but a few dependencies (namely Jukito and Closure Templates) use Guice 3.0 and bring guice-multibinding and guice-assistedinject in their version 3.0. Because the jarjar-ing

Re: guice / java8

2014-03-19 Thread Thomas Broyer
And if you could push that beta to Central, that'd be even better! Last one was beta1 AFAICT: http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.google.inject%22%20AND%20a%3A%22guice%22 On Wednesday, March 19, 2014 2:41:44 PM UTC+1, Sam Berlin wrote: Perfect. I'll fix this up today or

Re: Jax-rs and guice

2014-03-03 Thread Thomas Broyer
I really dislike how Jersey 2 does DI: https://java.net/jira/browse/JERSEY-1933 In one project, I use Resteasy, with a custom Guice-based InjectorFactory; that doesn't provide fail-fast behavior given that resources are not instantiated at launch time but only lazily, as needed. I could

Re: Open Question / Poll: Guava dependency and Java5 minimum requirement.

2013-12-16 Thread Thomas Broyer
+1, and as Christian say, rather than override guice to provided in 3) it's easier/better/clearer to exclude the transitive guice dependency (the fact that it could be verbose when you use many extension is a problem with Maven that other libs have too; it's much more concise with Gradle for

Re: Open Question / Poll: Guava dependency and Java5 minimum requirement.

2013-12-11 Thread Thomas Broyer
On Tuesday, December 10, 2013 7:24:56 PM UTC+1, Sam Berlin wrote: So far, it's pretty much unanimous that we should make Guava a real dependency and bump to Java6. So, we're going to do that. If you don't want us to do that, please speak up and explain why! We're probably going to

Re: @Transactional does not commit...

2013-10-18 Thread Thomas Broyer
Who's responsible for instantiating the TestEndpoint class? Is it really instantiated by Guice or is Guice only injecting its members (in which case AOP won't work) ? On Friday, October 18, 2013 11:06:53 AM UTC+2, Dirk Vranckaert wrote: I'm building a backend application for one of my Android

Re: @Transactional does not commit...

2013-10-18 Thread Thomas Broyer
to RESOURCE_LOCAL that I would have a session per transaction... Kr Dirk Op vrijdag 18 oktober 2013 11:27:40 UTC+2 schreef Thomas Broyer: Who's responsible for instantiating the TestEndpoint class? Is it really instantiated by Guice or is Guice only injecting its members (in which case AOP won't

Re: Guice and Resteasy

2013-06-11 Thread Thomas Broyer
On Wednesday, June 5, 2013 11:49:04 AM UTC+2, Moandji Ezana wrote: Resteasy 3.0 (JBoss's JAX-RS implementation) is coming out soon. I just wanted to let people know that I and a few others have been giving its Guice integration some much-needed attention and new features for the first

Re: Guice and Resteasy

2013-06-11 Thread Thomas Broyer
On Tuesday, June 11, 2013 8:49:13 PM UTC+2, Moandji Ezana wrote: On Tue, Jun 11, 2013 at 2:47 PM, Thomas Broyer t.br...@gmail.comjavascript: wrote: Am I missing something or each and every resource or provider has to be explicitly bound in the Guice Module? No, you aren't missing

Re: Quick question about providing values to a module

2013-04-27 Thread Thomas Broyer
On Thursday, April 25, 2013 8:04:49 AM UTC+2, mmonti wrote: Hi guys, I really appreciate your replies. I took a look at both solutions Tim's micro-fwk and magic-config, but unfortunately I couldn't make it work, and also I am not sure if what i need. To be honest I think that I am pretty

Re: Servlet filter not working

2013-04-18 Thread Thomas Broyer
On Thursday, April 18, 2013 3:41:11 PM UTC+2, Robert Voliva wrote: Try filter(/*/abc/*).through(MyFilter.class, params). I would advise you to be careful, however. You might want to make the path a little more explicit incase you have other servlets that might erroneously match that

Re: Help with the basics - Injecting field in a new class

2013-04-10 Thread Thomas Broyer
Dependency Injection 101: only objects created by the DI container (Guice in this case) are injected; this means only objects that have been retrieved from the Injector (through its getInstance method generally) or have themselves been injected into other classes. It's possible to inject

Re: Why provider is in different scope by defining it in two similar ways ?

2013-01-05 Thread Thomas Broyer
On Saturday, January 5, 2013 11:34:22 AM UTC+1, Michael wrote: Hi All, I found a very interesting thing about the scope of the provider. Here is the code of BaseModelProvider public class BaseModelProvider implements ProviderModel { private int num; @Override public Model get() {

Re: Specify concrete implementation for class

2012-12-17 Thread Thomas Broyer
On Monday, December 17, 2012 3:52:51 PM UTC+1, Dirk Nimerem wrote: Hello Moandji, could you please make an example how to specifiy a binding via annotation for this? Any other class should use the CachedFileReader for an IFileReader, only the CachedFileReader itself should use the

Re: Injecting into classes that are constructed by framework code

2012-11-12 Thread Thomas Broyer
On Monday, November 12, 2012 10:55:32 PM UTC+1, Alper Akture wrote: I'm using a game server that instantiates objects (Event handlers, etc) that I would like to inject references into. Since they construct these instances, is there an approach other than doing something in a default

Re: Guice injector exception on Tomcat

2012-10-05 Thread Thomas Broyer
On Friday, October 5, 2012 8:24:23 PM UTC+2, Arthur Gregório wrote: Yes, in the initial message I sent a code where I set the injector in the session, No, it was put in the ServletContext. and this was exactly my question: is it correct to do that? how to handle the injector so

Re: Default binding (How to)

2012-09-06 Thread Thomas Broyer
This is known as the robot legs problem, see http://code.google.com/p/google-guice/wiki/FrequentlyAskedQuestions#How_do_I_build_two_similar_but_slightly_different_trees_of_objec On Thursday, September 6, 2012 9:14:24 AM UTC+2, robertdup wrote: Hello there, I trying to implement default

Announcing guice-persist-neo4j

2012-09-06 Thread Thomas Broyer
Hi all, I was playing with Neo4j lately at work and missed Guice Persist's @Transactional, so I created guice-persist-neo4j. https://github.com/tbroyer/guice-persist-neo4j For now only used it with the *impermanent* and *remote* databases (where it proved to work great), and I'm struggling as

Re: Retreiving Object with specific annotation

2012-05-25 Thread Thomas Broyer
On Friday, May 25, 2012 10:35:27 AM UTC+2, Roger Gilliar wrote: Is it possible to retrieve an object with a specific annotation. Example: @ExtensionId(value=123) class Test { } @ExtensionId(value=124) class Test2 { } Object obj = injector.getInstance(???); // retrieve the object

Re: Injecting generic types

2012-04-21 Thread Thomas Broyer
On Saturday, April 21, 2012 3:52:48 AM UTC+2, Mirko Raner wrote: On Apr 19, 11:04 am, Mirko Raner mi...@raner.ws wrote: The closest I can come expressing this in Guice is binder.bind(new TypeLiteralMap?,?(){}).to(new TypeLiteralHashMap?,?(){}); but that doesn't seem to

Re: Order of injection when mixing constructor/setter injection (and even subclassing)

2012-03-07 Thread Thomas Broyer
Is this what you're looking for: http://code.google.com/p/google-guice/wiki/InjectionPoints Injections are performed in a specific order. All fields are injected and then all methods. Within the fields, supertype fields are injected before subtype fields. Similarly, supertype methods are

Re: Unit test and RequestScoped ?

2012-02-09 Thread Thomas Broyer
Isn't that what ServletScopes.scopeRequesthttp://google-guice.googlecode.com/git/javadoc/com/google/inject/servlet/ServletScopes.html#scopeRequest(java.util.concurrent.CallableT, java.util.Mapcom.google.inject.Key?, java.lang.Object) is for? (never used it though, so I can't help using it,

Re: how to define the initial method ?

2012-01-10 Thread Thomas Broyer
See http://code.google.com/p/google-guice/issues/detail?id=62 (commit for the linked issue 78 is now http://code.google.com/p/google-guice/source/detail?r=132a5db7c643b8f367eb5f09024cf13ea37c9831 ) According to the javadoc, you should be able to do something similar (that wouldn't work in all

Re: Newbie Question ! - dependencies objects

2012-01-08 Thread Thomas Broyer
On Sunday, January 8, 2012 7:08:21 AM UTC+1, Aladdin wrote: @Thomas I think you MultiBinder is what I need but I'm using GIN and it's not supported :( Any other suggestions ? Could possibly be as simple as (in your GinModule): @Provides SetServiceConsumer?

Re: Newbie Question ! - dependencies objects

2011-12-21 Thread Thomas Broyer
As others, I'm not sure I understood your problem, but maybe you're looking for the multibindings extensionhttp://code.google.com/p/google-guice/wiki/Multibindings : MultiBinderServiceConsumer multi = Multibinder.newSetBinder(binder(), ServiceConsumer.class);

Re: Plugin factory using Multibinder in Guice 3.0?

2011-11-12 Thread Thomas Broyer
How about using a MapBinder and injecting a MapString, ProviderPlugin? That way, you could get the ProviderPlugin from the map for a given name, and then get a new Plugin instance by calling the Provider's get(). -- You received this message because you are subscribed to the Google Groups

Re: How to override some bindings in a child injector?

2011-10-03 Thread Thomas Broyer
How about trying to use AssistedInject instead? -- You received this message because you are subscribed to the Google Groups google-guice group. To view this discussion on the web visit https://groups.google.com/d/msg/google-guice/-/vQXgGZZ_Q_4J. To post to this group, send email to

Re: Some things I don't like about Guice.

2011-05-10 Thread Thomas Broyer
On Tuesday, May 10, 2011 9:25:08 AM UTC+2, dhoffer wrote: Thanks for the reply... Regarding 1 at a minimum I need the code/refactoring support one would get if using manual factories. E.g. If I add a constructor parameter or change parameter order I need it to keep the module/factory in

Re: Some things I don't like about Guice.

2011-05-10 Thread Thomas Broyer
On Tuesday, May 10, 2011 10:47:51 AM UTC+2, dhoffer wrote: 1. Hum, perhaps I'm doing more work than I need to...perhaps just out of habit of previously using manual factories...but I think I got this from the Guice online docs. Here is what I do: Class A takes 4 parameters where all are

Re: For GinFactoryModuleBuilder,can it be possiable to implement one factory interface with multiple factory methods for the different types?

2011-04-30 Thread Thomas Broyer
It should work. I mean, I *do* that and it just works! (my factory return types are the concrete types though, so I install them as simply as new GinFactoryModuleBuilder().build(MyFactory.class) so maybe it makes a difference with having to use implement()) -- You received this message

Re: Module versus AbstractModule

2011-02-16 Thread Thomas Broyer
On Wednesday, February 16, 2011 1:34:23 AM UTC+1, mcculls wrote: On 15 February 2011 05:40, Josh paces...@gmail.com wrote: This question is somewhat related to Guice, but I think this is a good place to ask... I'm currently working on an API where I need to wrap the usage of the API to

Re: Allowing scope annotations on abstract types?

2011-01-27 Thread Thomas Broyer
[cc: google-gin group] Phil, to make it clearer on the GIN side, how about a GinScope annotation taking as value a scope annotation, and having GIN use that scope annotation when JIT-binding to the GWT.create() call? I.e. @GinScope(@Singleton) public interface MyRequestFactory extends