Guice

Is it possible to use Spring Security with Google Guice?

让人想犯罪 __ 提交于 2019-12-06 07:26:09
I would like to change Spring Framework to Google Guice, because it's lighter and has almost everything I need. Is it possible to use Spring Security with Google Guice instead of Spring Framework? No. Spring Security makes extensive use of the core Spring Framework. (I guess, in theory you could use Spring + Spring Security for the security filters, and Google Guice for the servlet wiring ... but I expect there would be a few traps and pitfalls on that road.) 来源: https://stackoverflow.com/questions/5484568/is-it-possible-to-use-spring-security-with-google-guice

Guice - Jersey - Servlet binding

冷暖自知 提交于 2019-12-06 05:56:22
问题 I recently switched to two phase injection and this has created an error in my servlet binding. I am currently toggling between two error modes and not sure which direction is best to pursue. The first error I encountered was: com.sun.jersey.api.container.ContainerException: The ResourceConfig instance does not contain any root resource classes. My servlet module looked like this: public class MyServletModule extends JerseyServletModule { @Override protected void configureServlets() { bind

Using GWT source code in Android

回眸只為那壹抹淺笑 提交于 2019-12-06 05:51:27
问题 I have a web app based on GWT. I use the same code base to target desktop as well as mobile platforms. I am using Model-View-Presenter and Dependency Injection based on GIN to achieve the goal of being cross platform compatible. However for better performance and native look-and-feel on Android, I would like to write to a fully native app. I want start by migrating the same GWT Java code to a new Android project and replace just the View implementations with native views that make use of

How can i use Guice in JavaFX controllers?

老子叫甜甜 提交于 2019-12-06 05:12:11
问题 I have a JavaFX application where I would like to introduce Guice because my Code is full of factorys right now, only for the purpose of testing. I have one use case where i have a controller class of a certain view. This controller class has a viewmodel and I pass the model to the viewmodel via the constructor of the controller class. In the controller class I have a contactservice object that provides the edit/save/delete operations. As of now I have an interface of that object and provide

When using the guice servlet extension is it possible to react to servlet destruction?

南楼画角 提交于 2019-12-06 04:57:30
I need to do some cleanup when guice servlet is removed. Is it possible to hook into the servlet destruction when using a guice servlet? I need to use the Injector to do the cleanup work. I can override the contextDestroyed method in GuiceServletContextListener , but then how do I get access to the injector? Is there a better way to react to servlet destruction? I can override the contextDestroyed method in GuiceServletContextListener, but then how do I get access to the injector? You could do it like this: public class MyGuiceServletConfig extends GuiceServletContextListener { private final

Google Auto Factory: not annotated with @Provided?

别来无恙 提交于 2019-12-06 04:51:08
问题 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; }

Equivalent of MyBatis XML multiple environments in MyBatis Guice

旧城冷巷雨未停 提交于 2019-12-06 04:25:42
I'm writing a service that needs to use a different database depending on context (a simple string label). Each database has exactly the same schema. The list of databases is dynamic. Looking through MyBatis-Guice documentation on multiple data sources , the example is where the list of datasources are known upfront, and each datasource has a different mapper. Similarly, a question found here on SO assumes the same requirements. As stated, my requirements are much more dynamic and fluid. The idea is to have all the currently known databases (with their connection information) in a config and

Replacing abstract factory with Guice?

微笑、不失礼 提交于 2019-12-06 04:06:10
问题 I am new to Guice and I was wondering how far I can take it. I have an interface UserInfo with multiple implementing classes GoogleUserInfo , FacebookUserInfo , TwitterUserInfo etc. These classes are created using a factory public class UserInfoFactory { public UserInfo createFromJsonString(String jsonspec) { . . . } } The creation is controlled by the JSON string jsonspec which controls which of the implementing classes of UserInfo is returned. Specifically, there is a JSON string element

Play Framework Dependency Injection

旧巷老猫 提交于 2019-12-06 02:36:18
I've been looking all over Google to find some useful information on how to use Guice/Spring DI in Play Framework 2.1 What I want to do is to Inject several Services in some DAO's and vice versa. Just need some clarification on this - With play 2.1, do you have to use an @ annotation within the routes file for DI? I've looked at this guide here - https://github.com/playframework/Play20/blob/master/documentation/manual/javaGuide/main/inject/JavaInjection.md and applied the following steps creating a Global class in app and adding the GUICE dependencies in Build.scala but keep on getting a null

How to exclude/redirect certain url pattern in web.xml or Guice servlet module?

谁说我不能喝 提交于 2019-12-06 02:01:14
问题 I need to serve my main application with the url pattern "/*" so this pattern is matched to a Servlet. The problem I am having is now all the css files and images located at "/css/all.css", "/images/" etc are going through this Servlet which is undesirable. I want these files to be directly accessed. What is the better way to handle this situation? Note: I am using Guice's Servlet Module to configure the patterns. Thanks! 回答1: We need to know specifically which requests should be routed to