Skip to main content

Posts

Spring Boot Introduction

Recent posts

Spring MVC Introduction:

 It is one of the frame work in the spring where it is used to develop web applications and distributed application. As there is servlets and jsp is in place to develop the web applications. But what is the need of spring MVC. But the problem in the normal servlet and jsp we need to write lots of boiler plate code. So the Spring MVC framework will reduce totally the boiler plate code. The Boiler plate code is the code which is common for all the classes is called the boiler plate code. In the project if there is 100 servlets then there should be 100 java beans will be prepared by the developer. This will cause the mixing of business logic and presentation logic which means we write the both the logics in same file so that it is difficult to modify the source code if the developer wants. Spring MVC Advantages: Spring MVC will remove the boiler plate code using the Front controller(Dispatcher Servlet). It will separate the Business logic and presentation logic. MODEL(M) VIEW(V) CONTR...

Properties and Primitive Insertion in Spring:

 Property Files and Values: The Properties is a subclass of Hashtable class and it represents a persistent set of properties. The Properties can be saved to a stream or loaded from a stream. Each key and its corresponding value in the property list is a string. .properties is a file extension for files mainly used in Java-related technologies to store the configurable parameters of an application The Properties file can be used in Java to externalize the configuration and to store the key-value pairs. The Properties.load() method of Properties class is convenient to load .properties file in the form of key-value pairs. In normal java syntax we will use the util.*. to load the properties, URL,  etc. Then we use the load method to load any file and we can use that to retrieve properties. But in spring we can use only one annotation to load the whole properties file and the Annotation is @PropertySource:(file path). The main important job of the property file is to reduce the har...

Annotations and Scope in Spring:

 Basic Annotations: Component: It is used to create the bean without the configuration files like xml and java configurations The auto wired is used along with it to do the dependency injection Autowired: The Autowired annotation is used for the dependency injection the main types are the: Autowired in constructor Autowired in setter Autowired in the field Note : Using the field injection is not recommended. Fig 1. Autowired in constructor. Fig 2. Autowired in the field. Import: It is used to import other configuration files into the class file.  This will be helpful in the scenario of multiple configuration files are there. Fig 3. Import method usage Primary: The @Primary annotation can be present at the starting of a class where it represent the primary class. For example if we implement two classes using a interface and we gave two classes the @Component annotation the spring will be confused.  So when we add the primary tag on any one of them then that one will be cho...

Java Spring Framework:

CORE: BASICS:           The new technology I had learned is the spring Framework core which is the base of the Spring technology or framework in Java. The main feature of the spring is that it is light weight where the run time is very less. Then the next advantage is the framework use the dependency injection in the object reference in Java where java is a OOPs programming language. The spring framework was found by rod johnson in the year of 2002 and licensed in the apache company in 2003. The other advantages of the Spring is that it can be used to build every application or software which is currently in the market. The framework supports: AOP Spring Boot Spring JDBC Spring MVC Spring EJB Spring Hibernate.           The diagram from the official website of the Spring is a good representation of the Spring Framework architecture which relies on the Spring Core. Fig 1: Spring Framework       ...