Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between spring-context and spring-core dependencies?

Hello I am new to the Spring and maven world, and I want to know what is the difference between this 2 dependencies?

Its a simple question.. I am having trouble with my pom.xml file, so I want to know everything :).

Thanks in advance.

like image 454
Juano7894 Avatar asked Apr 05 '12 23:04

Juano7894


People also ask

What is spring core and spring-context?

The Core Container consists of the spring-core , spring-beans , spring-context , spring-context-support , and spring-expression (Spring Expression Language) modules. The spring-core and spring-beans modules provide the fundamental parts of the framework, including the IoC and Dependency Injection features.

What is the difference between spring and spring core?

This contains the fundamental modules that are the cornerstone of the Spring framework. Core (spring-core) is the core of the framework that power features such as Inversion of Control and dependency injection. Beans (spring-beans) provides Beanfactory, which is a sophisticated implementation of the factory pattern.

What is Spring-context dependency?

This dependency – spring-context – defines the actual Spring Injection Container and has a small number of dependencies: spring-core, spring-expression, spring-aop, and spring-beans.

What is Spring-context for?

Spring contexts are also called Spring IoC containers, which are responsible for instantiating, configuring, and assembling beans by reading configuration metadata from XML, Java annotations, and/or Java code in the configuration files.


1 Answers

These are actually 2 of many Spring Framework modules. You can easily find what packages these artifacts contain, using this site:

http://mvnrepository.com/artifact/org.springframework/spring-core/3.1.1.RELEASE

This can give you information about classes contained within a particular artifact and probably about the its purpose.

For Spring Framework, spring-core contains mainly core utilities and common stuff (like enums) and because it's really critical for Spring, probably all other Spring modules depend on it (directly or transitively).

In turn spring-context provides Application Context, that is Spring's Dependency Injection Container and it is probably always defined in POMs of artifacts that use Spring Framework somehow. In fact, spring-context depends on spring-core so by defining spring-context as your dependency, you have spring-core in your classpath as well.

like image 136
Michał Kalinowski Avatar answered Oct 04 '22 12:10

Michał Kalinowski