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.)
Related
My problem is when we use Spring boot like framework, we can easily handle AOP. but how we handle AOP with jersy jaxrs project
Spring Boot is just a bootstrapping framework. For REST we can use Spring Boot to bootstrap Spring MVC or Jersey fully integrated with Spring. If you choose the latter route, then you can use the Spring AOP with Jersey. All you need to do is make your Jersey resources Spring #Components to able to intercept them. See an official example of Spring Boot and Jersey.
If you don't want to use Spring Boot to bootstrap your Jersey app, then you can still integrate Spring with Jersey. Remember the AOP is not tied to Spring Boot, it is tied to the Spring Framework, which are different things. You can see an example of Jersey with Spring (without Spring Boot) here.
If you don't want to involve Spring at all, then Jersey has a DI framework, HK2, which has it's own AOP. You can see a full example here
I want to create a REST web service using Jersey. I also want to use Spring in the project. Now, my questions is the following:
I don't see any reason for integrating these 2 together in my application. So, I should be able to use Spring for bean management and Jersey for creating the web service. Am I correct, or Spring and Jersey somehow have to be integrated.
I see that there is a jersey-spring maven project, and so, I assume that this is for the purpose of integrating jersey and spring together. My question here is do I get any benefit of using this integrated form rather than simply use Jersey and Spring separately each for its own functionality?
Thanks,
Cyrus
You can absolutely combine the two projects. However, I would encourage you to look at Spring-MVC for doing REST as it is very powerful and easy to use. If memory serves, the jersey-spring project was helpful in integration of JAXB and other touch points. Again, this is all built into Spring. And if you use Spring-Boot it is amazingly simple to get running.
The jersey-spring project provides integration between Jersey and Spring. It allows you to wire in any beans in your Spring context into Jersey and vice-versa.
For instance, if you are using spring-security, it will provide your spring-security principal when wiring the Jersey specific SecurityContext into any of your REST resources.
If you want to access Spring beans from your Jersey REST endpoints (or use Spring Beans as implementations for your JAX-RS interfaces) you need to integrate Spring and Jersey, otherwise it won't work. If you don't have any connections between Spring beans and your REST endpoints, then it is not necessary.
I think your first statement is correct. I have used Jersey and Sprint as separate entities.
Jersey is really awesome to create a web server.
Spring is useful for dependency injection (beans) and other cools stuff.
About your second statement, I do not know anything jersey-spring maven project.
My suggestion/opinion is to do as your first comment. Use them in a separate way. You will have the best of both worlds. Using jersey-spring maven project might be a complication and maybe it is not what you want. Libraries usually are intend to be independent.
I want to use spring's dependency injection for now(other core functionalites later maybe) in tomcat application.
I want to set up spring 2.5.5 in tomcat7, But don't have clarity on how to do this.
Specifically I am confused because I don't know whether to use Spring MVC or use just spring in tomcat.
I found this question helpful: Tomcat with Spring, But still didn't get the whole scenario on how to setup tomcat with spring.
You can do either, using just core spring with tomcat is fine. MVC provides additional functionality.
Take a look at the spring source examples on github, and read their docs.
(BTW I thouroughy spring-MVC component - it really saves time developing webapps)
I am trying to change Dropwizard to support Shiro.
I have read documentation and am little puzzled. I would like to utilize Shiro in conjunction with form login authentication and Apache Shiro Annotations. I think that I need to use Jersey Filters to support Shiro.
Is this the correct way to support Shiro annotations at Jersey instead of classic Shiro Filter approach?
Since Jersey Filters have decent access to resources with annotations, it seems perfect for me to use annotations.
I rather not use the AOP approach, and It could be really great to have on the fly integration with JAX-RS as a separated module.
Someone has already created a solution for what you are asking.
Shiro with Jersey.
https://github.com/javajack/shiro-jersey
Shiro For Dropwizard
https://github.com/javajack/shiro-jdbi-realm
Dropwizard Shiro Budle Example
https://github.com/javajack/dw-shiro-bundle
I am currently developing my project using Spring, Sutruts2 & Hibernate. Now i want to apply acegi security for authentication & authrization purpose.
But, i m totally new with acegi, so i want to use acegisecurity framework with spring configuration.
If anyone have link for an simple example of acegi with spring, struts2 & hibernate then please provide me it.
Thanx in advance.....
Are you using acegi or spring security? Acegi has been repackaged (and simplified with respect to configuration) to become spring security, as described on the homepage
Acegi Security is now Spring Security, the official security project of the Spring Portfolio. If you are planning a new project, we'd recommend you consider using Spring Security. Acegi Security 1.0.7 will be the last non-critical release of the 1.0.x series.
See also Ben Alex's blog
Update: A spring security tutorial is available here
There is a tutorial sample available as part of the acegi distribution.