Guice

A Guice-ready security framework?

懵懂的女人 提交于 2019-12-04 16:41:51
问题 Has anybody seen a framework which is either written to work with Guice or a library that integrates an existing security system (ie: Acegi) with Guice? I have found the following thus far... http://code.google.com/p/warp-security/ (I think this abandonware) http://code.google.com/p/warp-security/ (no documentation) 回答1: Apache Shiro 1.2 and later has native support for Guice applications: http://shiro.apache.org/guice.html HTH! 回答2: For whatever it's worth (being quite a late answer), I've

Guice: how do you configure an @Provides and @Singleton in a module in this case?

对着背影说爱祢 提交于 2019-12-04 15:39:03
问题 I have a provider method in a module annotated with @Provides : @Provides public ChatServicePerformanceMonitor getChatServicePerfMon() { ... } and I have annotated my ChatServicePerformanceMonitor with @Singleton . In my code, where I use this instance, I can't have guice "passively" inject it, due to a framework I'm using that's constructing the enclosing class (it does not use Guice, so this is the only way I know of to get the reference): chatServicePerfMon = injector.getInstance

MyBatis-guice 3.3 + Multiple datasources + properties + scriptrunner

独自空忆成欢 提交于 2019-12-04 14:23:18
I'm using MyBatis-guice 3.3 to connect to a first database using a java Properties object and a ScriptRunner to run few scripts: Environment environment = injector.getInstance(SqlSessionFactory.class).getConfiguration().getEnvironment(); DataSource source = environment.getDataSource(); ScriptRunner runner = new ScriptRunner(source.getConnection()); runner.setLogWriter(null); runner.setStopOnError(true); runner.runScript(Resources.getResourceAsReader(properties.getProperty("script.dbA.create.schema"))); Now I would like to add a second datasource (dbB) using the same approach. Following the

Guice SPI: find bindings by wildcard types

…衆ロ難τιáo~ 提交于 2019-12-04 14:17:50
Guice provides a means to find all bindings for a given type ( Injector#findBindingsByType ) and it also provides a TypeLiteral class from which it seems possible to construct a wildcard type. What I would like to do is find all bindings for some type that is parameterised by a wildcard type but I can't figure out how to do it. A look at the guice src suggests I might be barking up the wrong tree but I figured I'd ask around anyway... so for example given a type Foo<E extends Bar> BarImplOne implements Bar BarImplTwo implements Bar and some bindings like bind(new TypeLiteral<Foo<BarImplOne>>()

Using guice when creating a custom Action using ActionBuilder in play

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-04 13:10:43
How can I use guice when creating a custom Action using ActionBuilder? It seems to complain with "not found: value MyAction" if I change the ActionBuilder from a object to a class. I have this but it doesn't work: case class MyModel(name: String, request: Request[A]) extends WrappedRequest[A](request) class MyAction @Inject()(userService: UserService) extends ActionBuilder[MyModel] { def invokeBlock[A](request: Request[A], block: (MyModel[A]) => Future[SimpleResult]) = { val abc = loadAbc(request) block(new MyModel(abc, request)) } def loadAbc(rh: RequestHeader): String { "abc" // just for

Using Guice 3 with JAX-WS in Java 6 outside web container

做~自己de王妃 提交于 2019-12-04 13:06:29
问题 We have a situation where we use JSR-330 based injections to configure our stand-alone Java 6 applications, which works very well for getting configuration parameters across all the layers. We have also used JAX-WS web services for quite a while by using first stand-alone Metro distribution with Java 5 inside a web container, but with Java 6 we just use the Endpoint class to get a smaller footprint. So now I have a situation where I have A stand-alone Java 6 application - no servlet container

Guice JPA - “This connection has been closed.” error

元气小坏坏 提交于 2019-12-04 12:32:25
After DB dropps an idle connection or DB is down and back up I'm receiving the following error in my webapp: javax.persistence.PersistenceException: org.hibernate.exception.JDBCConnectionException: could not inspect JDBC autocommit mode at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1365) at org.hibernate.ejb.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1293) at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:265) ... 60 more Caused by: org.hibernate.exception.JDBCConnectionException: could not inspect JDBC autocommit mode at

Guice runtime dependency parameters reinjection

非 Y 不嫁゛ 提交于 2019-12-04 11:48:32
问题 A question about Guice. I'm still learning it, but I can understand the fundamentals. This question was already asked a couple of times on the net, but never with a concrete answer(none that I could find). Say I have a situation like on the picture(a similar example was somewere on the net). public class Dog {} public class Walk implements Walkable { private final Dog dog; private final boolean leash; @Inject public Walk(Dog dog, @Assisted boolean leash) { this.dog = dog; this.leash = leash;

JAX-WS and Guice 3

∥☆過路亽.° 提交于 2019-12-04 11:42:14
Is there some way to take SOAP web service classes creates with JAX-WS and inject them with, say, Guice 3.0 (guice-persist) transactions or even just plain ol' dependency injection? The guiceyfruit package provided a @GuiceManaged annotation that made this possible with Guice 2.0, but guiceyfruit (from my testing) appears to be incompatible with Guice 3, and I don't think the project is active any longer. Perhaps because there is another way of doing this? Maybe a JSR standard way? I came across this same issue a while back and I had a look at the Guicyfruit code and decided to extract what I

Google Auto Factory: not annotated with @Provided?

隐身守侯 提交于 2019-12-04 11:17:30
So I'm trying out google auto factory but I get a strange error. Factory class: @AutoFactory( className = "MembersAdapterFactoryImpl" ) public class MembersAdapter extends ArrayAdapter<Member> { /** * Get an instance of the helper */ private MembersAdapterHelper mMembersAdapterHelper; public MembersAdapter(@Provided MembersAdapterHelper membersAdapterHelper, Context context, int resource, List<Member> members){ super(context, resource, members); mMembersAdapterHelper = membersAdapterHelper; } } Generated class: package me.magneto.groups.adapters; import javax.annotation.Generated; import javax