Search This Blog

Tuesday, September 1, 2020

Interface is Used in Java?

  Interface is Used in Java?

Ans-> Because it is a good practice for Software engineer is to make the generic things as a part of Interface.


Q. . What is IOC?

Ref: https://docs.spring.io/spring/docs/3.2.x/spring-framework-reference/html/beans.html

Q. What is  classpath xml application context ??


Q. What is Spring Bean?

Ans--> Spring Bean is an Object that are managed by Spring IOC internally.

Beans are created and wired  by the  spring framework put it into a bag of objects  (The Container).

from there we cab get them.

features of Beans:

1. Control Bean Lifecycle.

2. Can initialize or destroy the Objects. 

Q. What are bean Scope?

1. Has effect on Bean Lifecycle -- when it will created or destroy.

 2. How many instances get created.

3. How bean is shared.

  1. singleton – only one instance of the spring bean will be created for the spring container. This is the default spring bean scope. While using this scope, make sure bean doesn’t have shared instance variables otherwise it might lead to data inconsistency issues.
  2. prototype – A new instance will be created every time the bean is requested from the spring container.
  3. request – This is same as prototype scope, however it’s meant to be used for web applications. A new instance of the bean will be created for each HTTP request.
  4. session – A new bean will be created for each HTTP session by the container.
  5. global-session – This is used to create global session beans for Portlet applications.

Spring Bean Singleton and Prototype Scope

Spring bean singleton and prototype scopes can be used in standalone spring apps. Let’s see how we can easily configure these scopes using @Scope annotation.


 Ref: https://docs.spring.io/spring/docs/3.0.0.M3/reference/html/ch04s04.html

ScopeDescription

singleton

Scopes a single bean definition to a single object instance per Spring IoC container.

prototype

Scopes a single bean definition to any number of object instances.

request

Scopes a single bean definition to the lifecycle of a single HTTP request; that is each and every HTTP request will have its own instance of a bean created off the back of a single bean definition. Only valid in the context of a web-aware Spring ApplicationContext.

session

Scopes a single bean definition to the lifecycle of a HTTP Session. Only valid in the context of a web-aware Spring ApplicationContext.

global session

Scopes a single bean definition to the lifecycle of a global HTTP Session. Typically only valid when used in a portlet context. Only valid in the context of a web-aware Spring ApplicationContext.


What is Scrum?

 What is Scrum?

Scrum is a framework that helps teams work together. Much like a rugby team (where it gets its name) training for the big game, Scrum encourages teams to learn through experiences, self-organize while working on a problem, and reflect on their wins and losses to continuously improve.

While the Scrum I’m talking about is most frequently used by software development teams, its principles and lessons can be applied to all kinds of teamwork. This is one of the reasons Scrum is so popular. Often thought of as an agile project management framework, Scrum describes a set of meetings, tools, and roles that work in concert to help teams structure and manage their work.

In this article, we’ll discuss how a traditional scrum framework is comprised with the help of the Scrum Guide and David West, CEO of Scrum.org. We’ll also include examples of how we see our customers stray from these fundamentals to fit their specific needs. For that, our own Megan Cook, Group Product Manager for Jira Software and former agile coach, will give tips and tricks in our Agile Coach video series:

Note: What is sprint?

Ans--> A sprint is a time frame whew we will have different parts.

1. Sprint planning.

2. Sprint scrum.

3. Sprint review.

4. Sprint retrospective.


Ref: https://www.scrum.org/resources/what-is-scrum

https://www.atlassian.com/agile/scrum


What is Agile?

 What is Agile?

Ref: https://www.atlassian.com/agile

https://www.agilealliance.org/member-portal/

https://www.tutorialspoint.com/sdlc/sdlc_agile_model.htm

Note: Overall concept behind Agile is  Distribute and Conquire.

A Short History of Agile

Here is a look at how Agile emerged, how it acquired the label Agile, and where it went from there. It’s important to take a look at where Agile software development came from to get an understanding of where things are at today.

Agile is an iterative approach to project management and software development that helps teams deliver value to their customers faster and with fewer headaches. Instead of betting everything on a "big bang" launch, an agile team delivers work in small, but consumable, increments. Requirements, plans, and results are evaluated continuously so teams have a natural mechanism for responding to change quickly.

Whereas the traditional "waterfall" approach has one discipline contribute to the project, then "throw it over the wall" to the next contributor, agile calls for collaborative cross-functional teams. Open communication, collaboration, adaptation, and trust amongst team members are at the heart of agile. Although the project lead or product owner typically prioritizes the work to be delivered, the team takes the lead on deciding how the work will get done, self-organizing around granular tasks and assignments.

Agile isn't defined by a set of ceremonies or specific development techniques. Rather, agile is a group of methodologies that demonstrate a commitment to tight feedback cycles and continuous improvement.


application.properties and Devtools

What is use of spring.jpa.hibernate.ddl-auto=create??

What are values we can provide for spring.jpa.hibernate.ddl-auto ??


Spring Boot 1.3 provides another module called Spring Boot DevTools. DevTools stands for Developer Tool. The aim of the module is to try and improve the development time while working with the Spring Boot application. Spring Boot DevTools pick up the changes and restart the application.

We can implement the DevTools in our project by adding the following dependency in the pom.xml file.

Advantages:

  • Property Defaults
  • Automatic Restart
  • LiveReload
  • Remote Debug Tunneling
  • Remote Update and Restart

Sunday, August 30, 2020

How to Create Eureka Server?

 How to Create Eureka Server?

Note : Eureka default port is 8761.

How to use Eureka in Project for Client side Discovery.

Step 1. Must add eureka dependency in pom.xml

Step 2. Add Eureka application property given flowing

  server.port=8761


eureka.client.register-with-eureka=false
eureka.client.fetch-registry=false

logging.level.com.netflix.eureka=OFF

logging.level.com.netflix.discovery=OFF

  Ref Doc: https://spring.io/guides/gs/service-registration-and-discovery/

Note: We must need to add eureka discovery Clint dependency 

Q. How to Use Load balancing?

Q. What is restTemplate and How to use It?



What is Rest template?

 What is Rest template ?

 Rest template is one of the way , using which we can communicate with microservices.

Note:  we have another way communicate with web services is web-client.

M V V I:  Whenever we are using  @Restcontroller  use @PathParam  and Whenever we are using Spring MVC or @Controller  use @PathVariable


Q. When to use JSTL??


Q. Addrases?

Solution:

1. Hard-code the URL.

2. Use Discovery the Service.

There re two types of Discovery Service:

1. Client side service Discovery.

2. Server Side service Discovery.

Pattern: Client-side service discovery

Context

Services typically need to call one another. In a monolithic application, services invoke one another through language-level method or procedure calls. In a traditional distributed system deployment, services run at fixed, well known locations (hosts and ports) and so can easily call one another using HTTP/REST or some RPC mechanism. However, a modern microservice-based application typically runs in a virtualized or containerized environments where the number of instances of a service and their locations changes dynamically.

Consequently, you must implement a mechanism for that enables the clients of service to make requests to a dynamically changing set of ephemeral service instances.

Problem

How does the client of a service - the API gateway or another service - discover the location of a service instance?

Forces

  • Each instance of a service exposes a remote API such as HTTP/REST, or Thrift etc. at a particular location (host and port)
  • The number of services instances and their locations changes dynamically.
  • Virtual machines and containers are usually assigned dynamic IP addresses.
  • The number of services instances might vary dynamically. For example, an EC2 Autoscaling Group adjusts the number of instances based on load.

Solution

When making a request to a service, the client obtains the location of a service instance by querying a Service Registry, which knows the locations of all service instances.

The following diagram shows the structure of this pattern.


Pattern: Server-side service discovery

Context

Services typically need to call one another. In a monolithic application, services invoke one another through language-level method or procedure calls. In a traditional distributed system deployment, services run at fixed, well known locations (hosts and ports) and so can easily call one another using HTTP/REST or some RPC mechanism. However, a modern microservice-based application typically runs in a virtualized or containerized environments where the number of instances of a service and their locations changes dynamically.

Consequently, you must implement a mechanism for that enables the clients of service to make requests to a dynamically changing set of ephemeral service instances.

Problem

How does the client of a service - the API gateway or another service - discover the location of a service instance?

Forces

  • Each instance of a service exposes a remote API such as HTTP/REST, or Thrift etc. at a particular location (host and port)
  • The number of services instances and their locations changes dynamically.
  • Virtual machines and containers are usually assigned dynamic IP addresses.
  • The number of services instances might vary dynamically. For example, an EC2 Autoscaling Group adjusts the number of instances based on load.

Solution

When making a request to a service, the client makes a request via a router (a.k.a load balancer) that runs at a well known location. The router queries a service registry, which might be built into the router, and forwards the request to an available service instance.

The following diagram shows the structure of this pattern.

Examples

An AWS Elastic Load Balancer (ELB) is an example of a server-side discovery router. A client makes HTTP(s) requests (or opens TCP connections) to the ELB, which load balances the traffic amongst a set of EC2 instances. An ELB can load balance either external traffic from the Internet or, when deployed in a VPC, load balance internal traffic. An ELB also functions as a Service Registry. EC2 instances are registered with the ELB either explicitly via an API call or automatically as part of an auto-scaling group.

Some clustering solutions such as Kubernetes and Marathon run a proxy on each host that functions as a server-side discovery router. In order to access a service, a client connects to the local proxy using the port assigned to that service. The proxy then forwards the request to a service instance running somewhere in the cluster.

Resulting context

Server-side service discovery has a number of benefits:

  • Compared to client-side discovery, the client code is simpler since it does not have to deal with discovery. Instead, a client simply makes a request to the router
  • Some cloud environments provide this functionality, e.g. AWS Elastic Load Balancer

It also has the following drawbacks:

  • Unless it’s part of the cloud environment, the router must is another system component that must be installed and configured. It will also need to be replicated for availability and capacity.
  • The router must support the necessary communication protocols (e.g HTTP, gRPC, Thrift, etc) unless it is TCP-based router
  • More network hops are required than when using Client Side Discovery
          ------------------------------ Important Question ----------------------------------------------
               1. What are client side Service Discovery Technology?
Answer-->  Edureka.
                2. What are Server side Service Discovery Technology?
Answer-->  NGIX, AWS.

          

Saturday, August 29, 2020