Spring Framework usage - spring

Usually how would each of the module in the Spring framework is used in a web project. I am trying to get an idea about it, as i am on a fast track to learn and implement it.
I know it does have below modules in it, but any help in explaining why and where they are useful would help me a lot in learning.
The Core container module
Application context module
AOP module (Aspect Oriented Programming)
JDBC abstraction and DAO module
O/R mapping integration module (Object/Relational)
Web module
MVC framework module
Thanks,
SS

This page might be helpful to you: Introduction to Spring Framework: Modules. Spring provides a very good, free reference manual that covers much of this and more.
Here's my short summary of why you would use any of these:
Core - This allows you to use the dependency-injection pattern to construct your application, which can greatly simplify your classes and unit testing.
Application Context - This provides support code for many common problems.
AOP - This provides support for Aspect Oriented Programming, which can help you separate "cross cutting concerns" like logging and transaction management from your business logic.
JDBC - Provides support code that makes JDBC easier to use.
OR/Mapping - Provides support code to integrate popular ORM frameworks into Spring.
Web MVC - Provides support for the Model-View-Controller pattern using Spring beans (several other frameworks, such as JSF, provide this as well).
To sum it up, the Core module contains most of what people think of when they think of Spring, and the other modules provide code help you implement your application in a cleaner, more supportable way, without re-inventing the wheel.

The Core container module
Application context module
This is the dependency injection piece - the bean factory and application context where you wire bean dependencies together.
AOP module (Aspect Oriented
Programming)
Cross-cutting concerns like logging, security, transactions, etc. are handled using either Spring interceptors (dynamically generated proxies) or AspectJ (byte code generation).
JDBC abstraction and DAO module
Persistence using a lightweight JDBC template that takes the boilerplate out of using JDBC.
O/R mapping integration module
(Object/Relational)
For folks who prefer Hibernate.
Web module MVC framework module
Web MVC module for JSP, browser based user interfaces based on front controller and view dispatchers.

Related

This is in the company requirement list, I want to know the difference between them

what is the difference between spring core, spring boot, and spring MVC?
In Simple terms,
Spring MVC
Spring - It is a Inversion of control (IOC) and Dependency Injection (DI) framework. Spring helps you develop enterprise applications. Most information you can read here https://spring.io/projects/spring-framework
MVC - It is a design pattern (Model - View - Controller ) MVC , by definition, they are proven patterns and methods to design your application well. We have several design patterns such as Singleton, Factory pattern etc Read more about it here https://refactoring.guru/design-patterns
Spring-boot - It is a library built on top of Spring framework (like we have JARs) which helps develop production ready quick service oriented applications. You can still use typical Spring features. Read more about it here https://spring.io/projects/spring-boot
Spring-core - Just a named terminology representing core features of Spring framework such as IOC container, Dependency Injection, Bean scopes, Autowiring etc
Hope this helps!

What Spring projects are libraries (not framework-oriented)?

I do not wish to use Spring annotations or xml or any declarative, non-compile-time-safe code or anything that relies on reflection. However, I'm guessing Spring does have traditional libraries (like Apache Commons libraries) that you can call from your code rather than your annotated code getting called by the framework.
What Spring projects are libraries? I'm assuming some of them are.
The core of Spring is the Spring Framework. Which is uses reflection, annotations etc without remorse. Using spring as a library completely misses the point. You could use, say JdbcTemplates with the correct dependency but why?
If you do use Spring as a Library bare in mind you are only getting tiny bits of functionality, most of which is just bootstrap code you avoid writing. Spring is designed to be used within it's framework and built upon. Some do use libraries such as Apache Commons. Using Spring Framework as a library however does just complicate your own project and people would probably ask - "why".

what is difference between spring framework and spring roo

Can anyone clarify what are the differences between Spring Framework, Spring ROO, and Spring MVC ? I am really puzzled by these similar terms and cannot mangage find an answer.
It's really easy:
Spring Roo is a DEVELOPMENT-TIME tool, similar to Eclipse, IntelliJ, etc.
Spring Framework is a RUN-TIME framework.
Applications generated with Spring Roo at development time use Spring Framework at run time.
Hope this helps.
I do not want to be rude, but also from SO tags we know:
spring
The Spring Framework is an open source framework for application development on the Java platform. At its core is rich support for component based architectures, and it currently has over a dozen highly integrated modules.
https://stackoverflow.com/tags/spring/info
spring-mvc
Based on the Model-View-Controller (MVC) pattern, Spring MVC helps you build web-based applications that are flexible and decoupled from the underlying view technologies.
https://stackoverflow.com/tags/spring-mvc/info
spring-roo
Spring Roo is a lightweight tool aimed at developer productivity. Via an intuitive command line interface it supports operations such as Java web project creation, persistence configuration and view scaffolding. Roo creates a Java web project that uses the Spring framework, and leverage some best ...
https://stackoverflow.com/tags/spring-roo/info
My own brief description would be: Spring framework is the framework providing some functionalities for example dependency injection. Spring MVC is for creating web projects as you mentioned already. Finally Spring Roo is a tool, that helps you increase productivity, I'd say that instead of manual configuration changes you are using this tool.
Hopefully, this was not too brief...

Can we use Spring MVC Framework and other components of Spring framework (like AOP) together?

I am new to Spring. Just having basic understanding of it.
I am curious to know, can we use Spring MVC Framework and other components of Spring framework (like AOP) together?
Thanks!
Briefly yes.
quote
Spring could potentially be a one-stop shop for all your enterprise applications, however, Spring is modular, allowing you to pick and choose which modules are applicable to you, without having to bring in the rest. You can read details about modules available in Spring Framework.Here

Why to use Spring not JSF (Advantages of spring over JSF)?

i don't know JSF very well, and i have a friend who is using only JSF
and he asked me a very open question, why do you use spring not jsf ?
and because of there are a lot of things about spring in my mind
i wasn't able to give some straight answers
so what are the advantages of spring over JSF ?
Spring and JSF are quite a different frameworks.
JSF is more of a web application framework and you can still use spring with JSF to manage the relationship and creations of the objects.
Spring is more of an entire j2ee application framework/plaform.
Spring MVC and web flow will help you to design web applications similar to JSF.
But spring with its IOC concept also brings a lot of other modules such as dependency injection, aop, DAO, ORM, integration, batch and social tools and much more.
You can also check the JSF-Spring combination - http://www.springsource.org/node/422
JSF is presentation layer, Spring business layer (roughly said), they can be used together and do not compete.
As said before, JSF is a request-driven, MVC web-framework, built around a light-weight IoC container and is designed to simplify and standardize the way UI-layer of a web-application is built.
Spring, on the other hand, is less concerned with UI-layer but its precise definition is hard to formulate. It can be said that the primary function of SF is to tie together different layers of a web application in a standardized way, at the same time abstracting away the implementation details of a particular web technology from the developer. As one of the consequences, the developer is freed from implementing "plumbing" and instead gets working module interconnections which are tested, implemented and used relatively easily. This should provide a boost to productivity and shortens development cycle.
This abstraction can be viewed through various Spring modules - Spring is heavily modularized, so you choose which components of the framework will you be using. Though it features a MVC framework (SpringMVC is mostly written as a reaction to the Jakarta Struts, whom the Spring developers deemed poorly written), Spring lacks a dedicated presentation module so you're free to use most of existing UI technologies (e.g. JSF, GWT-oids, etc.) - once you properly configure them in Spring.
In another words, the "scopes" of JSF and Spring are quite different (though not totally disjunct).

Resources