Can I use Struts2 without Spring IoC?
5 Answers
Spring is only one option. You can work with others like Google Guice or without IOC.
Yes you can, even when you can integrate both on your project, it is not required.
Struts2 was designed with dependency injection in mind and adheres to the principles pretty well (the underlying XWork framework uses an early version of Guice). You can step up to Guice or Spring later using the appropriate plug-in.
Yes
Spring IOC is just a pluggable object dependency container, which manages objects for you. It is optional.
-
1+1. Thanks, But I find quote in Starting Struts2 '...And finally, dependency injection is now a first class citizen – provided via the Spring Framework...' by Ian Roughley, How I should understand it? Jan 24, 2011 at 15:57
-
1
-
IoC is a good thing, it is generally best to start with the struts2 documentation (using the struts2-spring-plugin) struts.apache.org/2.0.8/docs/spring-plugin.html Jan 24, 2011 at 16:28
-
1@Quat Yes, Spring IOC is very good thing, but as beginner I would recommend OP to quick start plain struts and then he will automatically switch with Spring :)– jmjJan 24, 2011 at 16:35
Basically both are independent. You can definitely use Struts 2 without Spring IOC.