What is Java Spring Framework?

Spring is frame work for different kinds of application development. It can provide bunch classes which is internally used the J2EE supplied classes. Meaning, we can say that spring is an alternate to struts but complement to J2EE.

Spring Framework Features 

Spring Framework is non invasive: No need for you to implement any interface or inherit any class from this framework to your classes.

Spring Framework is Light weight: Spring is a vast framework so users divide the whole spring in to different modules which are dependent to other module , except Spring core module.

End-to-end Development : Spring framwork supports almost all aspects of application development,  so users would be able to develop a complete application using it.

Spring Framework supports differet types of application development: We can develop any type of applications using Spring Framework. Example: Core java, web Application, Distributed application, Enterprise application.

Spring Framework is versatile: It can be integrated into any technology.

Spring Framework ports dependency injection: The dependency between classes are managed by spring framework.

Dependency injection:

Spring core is one module which deals with dependency management. This means that arbitrary classes provided to spring, can manage dependency.

What is dependency?

From a project point of view, multiple classes are specified with different functionality. Each of these classes required some functionality of other classes, Example:

  1. class Engine
  2. {
  3. public void start()
  4. {
  5. System.out.println(“Engine started”);
  6. }
  7.  
  8. }
  9.  
  10. class Car
  11. {
  12. public void move()
  13. {
  14. // For moving start() method of engine class is required
  15. }
  16. }

Here class Engine is required by class car so we can say class engine is dependent to class Car, So instead of we managing those dependency by Inheritance or creating object as fallows.

By Inheritance:

  1. class Engine
  2. {
  3. public void start()
  4. {
  5. System.out.println(“Engine started”);
  6. }
  7.  
  8. }
  9. class Car extends Engine
  10. {
  11. public void move()
  12. {
  13. start(); //Calling super class start method,
  14. }
  15. }

By creating object of dependent class:

  1. class Engine
  2. {
  3. public void start()
  4. {
  5. System.out.println(“Engine started”);
  6. }
  7.  
  8. }
  9. class Car
  10. {
  11. Engine eng=new Engine();
  12. public void move()
  13. {
  14. eng.start();
  15. }
  16. }

Instead of managing dependency between classes, spring core handles the dependency management. However, the classes must be designed with some design technique that is Strategy design pattern.

Thanks for reading our “What is Java Spring Framework?” article. If you liked it, then please share with your friends and colleagues. If you have any feedback or doubt then please leave us a comment.

By the way, I am also really happy to announce some very exciting news: to celebrate the imminent release of Spring 5 and Java 9,  we launched our simulators SALE CAMPAIGN. We halved the price of our simulators at www.springmockexams.com and www.javamockexams.com for limited time only. Take a look here bit.ly/SMEBP and here bit.ly/JMEBP

If you are interested in collaborating with us, you can join our partner program at bit.ly/SMEPART  and here bit.ly/JMEPART

Java 9 Reactive Streams

What is Java 9 Reactive Streams

“When Reactive Streams started their work, following the path established by the Reactive Manifesto, they indicated that their aim was to provide “a standard for asynchronous stream processing with non-blocking back pressure”. The main challenge, however, wasn’t to find a solution, in particular since there were already a number of them out there. The challenge was to coalesce the different existing patterns into a common one to maximise interoperability. More precisely, the objective of Reactive Streams was “to find a minimal set of interfaces, methods and protocols that will describe the necessary operations and entities to achieve the goal—asynchronous streams of data with non-blocking back pressure”.

The concept of “back pressure” is key. When an asynchronous consumer subscribes to receive messages from a producer, it will typically provide some form of callback method to be invoked whenever a new message becomes available. If the producer emits messages at a higher rate than the consumer can handle, the consumer could be forced to seize an increasing amount of resources and potentially crash. In order to prevent this, a mechanism is needed by which consumers can notify producers that the message rate needs to be reduced. Producers can then adopt one of multiple strategies to achieve this. This mechanism is called back pressure.

Blocking back pressure is easy to achieve. If, for instance, producer and consumer are running under the same thread, the execution of one will block the execution of the other. This means that, while the consumer is being executed, the producer cannot emit any new messages, and therefore a natural way to balance input and output occurs. However, there are scenarios where blocking back pressure is undesirable (for instance when a producer has multiple consumers, not all of them consuming messages at the same rate) or simply unattainable (for instance when consumer and producer run in different environments). In these cases it is necessary that the back pressure mechanism works in a non-blocking way.

The way to achieve non-blocking back pressure is to move from a push strategy, where the producer sends messages to the consumer as soon as these are available, to a pull strategy, where the consumer requests a number of messages to the producer and this sends only up to this amount, waiting for further requests before sending any more.” – Aboullaite

What’s the point of reactive programming in Java 9?

Well, the classes or interfaces present in Java 9 are the glue between the reactive streams implementations. Meaning, they automatically have back pressure between them.

The user API and features are the task of the respective libraries (implementations of reactive streams specifications: Akka streams or RxJava). The Java 9 package focuses on the API for Reactive Pull, a manner of coupling producing and consuming systems to ensure backpressure over an async boundary.

Thanks for reading our “Java 9 Reactive Streams” article. If you liked it, then please share with your friends and colleagues. If you have any feedback or doubt then please leave us a comment.

By the way, I am also really happy to announce some very exciting news: to celebrate the imminent release of Spring 5 and Java 9,  we launched our simulators SALE CAMPAIGN. We halved the price of our simulators at www.springmockexams.com and www.javamockexams.com for limited time only. Take a look here bit.ly/SMEBP and here bit.ly/JMEBP

If you are interested in collaborating with us, you can join our partner program at bit.ly/SMEPART  and here bit.ly/JMEPART

OOPs Concepts in Java

There are four basic OOPs Concepts in Java

  1.  Abstraction
  2.  Encapsulation
  3.  Polymorphism
  4.  Inheritance

Definition of Class / Object

Class describes all the attributes of object, as well as the methods that implements the behavior of member object. That means this is a template or blue print.
In object-oriented programming , a class is a template definition of the method s and variable s in a particular kind of object . Thus, an object is a specific instance of a class; it contains real values instead of variables.

Object is an instance of a class, it contains real values instead of variables.

Person employee=new Person();

OOPs Concepts in Java

Abstraction

Abstraction is separating the functions and properties that logically can be separated to a separate entity.
Abstraction in Object Oriented Programming helps to hide the irrelevant details of an object.

Encapsulation

Encapsulation is an OOPS concept to create and define the permissions and restrictions of an object and its member variables and methods. A very simple example to explain the concept is to make the member variables of a class private and providing public getter and setter methods. Java provides four types of access level modifiers: public, protected, no modifier and private.

Polymorphism

Polymorphism is the occurrence of something in various forms. Java supports various forms of polymorphism like polymorphic reference variables, polymorphic method, polymorphic return types and polymorphic argument types.

Polymorphic reference variables can hold any of its subtype class reference.

class A extends C{}
class B extends C{}
C cType = new A();
cType = new B();

Polymorphic method can be overloading or overriding.

Polymorphic return types and polymorphic argument types:

public class Poly {
public static void main(String[] args) {
setNumber(new Integer(1));
System.out.println(getNumber());
}

public static Number getNumber() {
Integer i = new Integer(1);
return i;
}

public static void setNumber(Number n) {
}
}

Inheritance

In object-oriented programming (OOP), inheritance is a way to reuse code of existing objects.
A class can inherit attributes and behavior from pre-existing class called base classes, superclasses, or parent classes. The resulting class is known as derived classes, subclasses, or child classes

Thanks for reading our “OOPs Concepts in Java” article. If you liked it, then please share with your friends and colleagues. If you have any feedback or doubt then please leave us a comment.

By the way, I am also really happy to announce some very exciting news: to celebrate the imminent release of Spring 5 and Java 9,  we launched our simulators SALE CAMPAIGN. We halved the price of our simulators at www.springmockexams.com and www.javamockexams.com for limited time only. Take a look here bit.ly/SMEBP and here bit.ly/JMEBP

If you are interested in collaborating with us, you can join our partner program at bit.ly/SMEPART  and here bit.ly/JMEPART

What is new in Spring Framework 5?

What is new in Spring Framework 5?

  • JDK 8+9 and Java EE 7 Baseline
  • Minimum Java requirement will be raised to JDK 8.
  • Also there is upgrade to the minimum Java EE versions. The current minimum version is Servlet 2.5, this will be raised to Servlet 3.0.
  • JPA 1.1+ and Bean Valication API 1.1+ will be the minimum requirements.
  • Reactive Programming Model

Reference Links:

By the way, I am also really happy to announce some very exciting news: to celebrate the imminent release of Spring 5 and Java 9,  we launched our simulators SALE CAMPAIGN. We halved the price of our simulators at www.springmockexams.com and www.javamockexams.com for limited time only. Take a look here bit.ly/SMEBP and here bit.ly/JMEBP

If you are interested in collaborating with us, you can join our partner program at bit.ly/SMEPART  and here bit.ly/JMEPART