0% found this document useful (0 votes)
12 views

Running_NoteS

The document outlines various Java technologies and frameworks, including Java versions, packaging methods, configuration management tools, and design patterns. It details the Spring framework's annotations, scopes, and MVC flow, as well as Spring Boot's advantages for cloud-based and microservice applications. Additionally, it covers method overriding rules, logging configurations, and the use of repositories in Spring applications.

Uploaded by

Suresh
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Running_NoteS

The document outlines various Java technologies and frameworks, including Java versions, packaging methods, configuration management tools, and design patterns. It details the Spring framework's annotations, scopes, and MVC flow, as well as Spring Boot's advantages for cloud-based and microservice applications. Additionally, it covers method overriding rules, logging configurations, and the use of repositories in Spring applications.

Uploaded by

Suresh
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 8

Day1:22-Jan-2024

======
https://github.com/kolaparthi34k/ZetaGloballHydTraining
https://github.com/kolaparthisrini
https://skolaparthi.com

Java Versions:
1.8
legacy--->1.6
Jenkins---->1.17,1.20,1.21,1.11
Kubernats---->=1.8
Spring STS===>1.11/1.17/1.20
Spring STS 4.0/VS code--sts
>>>>>>>>>>>>>>>>>>>>>

Eclipse----->Git----------->Build---->Testing------->view the output

ext folder in JVM architectre

Bytecode: combination of 0,1 and special symbols generated by VM.

Bytecode --- source code convert?----sol) Java decompiler tool


========================================================
Day2
-------
1.8
>>packaging files
manually jar/war/ear--->jar <path of the projectname> targetfile.jar
maven---can do packaging
lua---js
>>Java--->J2SE--web and desktop
J2EE---Webapp and enterprise app
J2ME---Mobile edition----for mob
----------->
Datatype,Expressions,Operators and Conditional statements

Config Management tools------>Puppet/Chef/Ansible


Architecture ---Data flow--db model---UML
JIRA/Service now---Sprint--SLA
SLA----Task

complixity of task---severity is v high


Scaffolding: Process of creating project structure is called as Scafffolding.

Eclipse---osgi bundle mechanism to create projects


>>LOgs will help you.----ELK stack
E---elastic
L--log stash
K--kibana

>>>GReenfield and brownfield projects

>>>>>JAVA
Fund transfer---NEFT,UPI,SWIFT
Orchestration

NEFT App
UPI app
Swift
Target audience

Interfaces
Abstract classes
Concrete classes
================>
datatypes:type of data
data----1,q,`,f
processing
Information------------>
>>>>>>>>>>>>>
3.14563---64bit,32bit
strictfp
DDOS--_C
JAVA-
Structured Programming int
Serialization: process of saving SBI of an object to storage like
file/database/webservices temporarl.

Deserialization: recovering from serialization.


OOPS---Integer

>>Collections
>>>SBI

Variable arguments
>>if we need to create multiple constants,dont use Classes.Use Enum classes.

interface A
{
}----marker interfaces

interface B
{
public void dd();
}---normal interface

JDK1.8------Functional Interfaces------Lambda expressions---Streams---Data


engineering>>>
====================
1)Zeta Sodexo Zeta Sodexo Zeta Sodexo Zeta Sodexo
2)
i/p: lenovo
o/p:LeNoVo-----without string api

3)Zeta Sodexo Zeta Sodexo Zeta Sodexo Zeta Sodexo


No of 'a':
No of 'S':
No of Characters: ---use string api

4)a = "Zeta" b="Infy"


O/p: ZaIn ---- without string api
--------------------------------------------------
https://logging.apache.org/log4j/2.x/
>>properties and xml file
file-----database
txt,excel----
cclient want to share some data. xml parser--xml parsers are slow.
txt----xml---json---bson

In java to write a configuration file,we can use any of the below


1)properties
2)xml
3)JSON
4)YAML

=====
Define console appender
log4j.appender.console=org.apache.log4j.ConsoleAppender
logrj.appender.console.Target=System.out
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%-5p %c{1} - %m%n

#Define rolling file appender


log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=logs/main.log
log4j.appender.file.Append=true
log4j.appender.file.ImmediateFlush=true
log4j.appender.file.MaxFileSize=10MB
log4j.appender.file.MaxBackupIndex=5
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d %d{Z} [%t] %-5p (%F:%L) - %m%n
========================

>>>>Static and Non static:


==========================
>>static will be loaded into memory first.:no need to create object for static.
>>non-static will be loaded last.We need to create object for non-static.
>>static doent know anything about non-static.

================
Rules for Method Overiding:
===========================
>he argument list should be exactly the same as that of the overridden method.
The return type should be the same or a subtype of the return type declared in the
original overridden method in the superclass.
The access level cannot be more restrictive than the overridden method's access
level. For example: If the superclass method is declared public then the overriding
method in the subclass cannot be either private or protected.
Instance methods can be overridden only if they are inherited by the subclass.
A method declared final cannot be overridden.
A method declared static cannot be overridden but can be re-declared.
If a method cannot be inherited, then it cannot be overridden.
A subclass within the same package as the instance's superclass can override any
superclass method that is not declared private or final.
A subclass in a different package can only override the non-final methods declared
public or protected.
An overriding method can throw any uncheck exceptions, regardless of whether the
overridden method throws exceptions or not. However, the overriding method should
not throw checked exceptions that are new or broader than the ones declared by the
overridden method. The overriding method can throw narrower or fewer exceptions
than the overridden method.
Constructors cannot be overridden.
>Any class which is declared as final cannot be inherited.
>A class can be private only in inner classes.

>parent/base/super class
>child or sub or derived class

>.IN java for evry class ,Object is the base class.


>javap java.lang.Object
javap is used for displaying the metadata about the provided class.

Interfaces and Abstract Classes:


=================================
Method without body is called as abstract method.

Ambani------>e-commerce---Mobiles----->Mobile app

December 2023

Business Analyst
==================
Annotation:
The annotation-config is configured in Spring XML configuration. The annotation-
config activates various annotations to be detected in bean classes. It is
configured in XML configuration as following.
<context:annotation-config/>
The annotation-config activates following annotations in bean classes.
1. Spring @Required and @Autowired annotations.
2. JSR 250 @PostConstruct, @PreDestroy and @Resource annotations.
3. JAX-WS @WebServiceRef annotation.
4. EJB 3 @EJB annotation.
5. JPA @PersistenceContext and @PersistenceUnit annotations.

Scope:
singleton � Scopes a single bean definition to a single object instance per Spring
IoC container.
prototype � Return a new bean instance each time when requested
request � Return a single bean instance per HTTP request.
session � Return a single bean instance per HTTP session.
globalSession � Return a single bean instance per global HTTP session.
=======
>>Autowiring:
No. Mode Description
1) no It is the default autowiring mode. It means no autowiring bydefault.
2) byName The byName mode injects the object dependency according to name
of the bean. In such case, property name and bean name must be same. It internally
calls setter method.
3) byType The byType mode injects the object dependency according to type.
So property name and bean name can be different. It internally calls setter method.
4) constructor The constructor mode injects the dependency by calling the
constructor of the class. It calls the constructor having large number of
parameters.
5) autodetect It is deprecated since Spring 3.

>>>>>Design patterns

Factory design pattern


>a constructor argument can be a number which is index and it starts with 0.

goals:
clean
install
deploy
==========================
MVC Flow:
===========
1)Client requests for a page by specifying the Web URL for the page. E.g.
https://skolaparthi.com
2)Client request is intercepted by the Dispatcher Servlet also known as Front
Controller. Dispatcher Servlet is a servlet specified in Web.XML file (for XML
Based configurations) or in the Web Configuration class (for java based
configurations).
3)Dispatcher Servlet uses URL Mapping Handler to find out the relevant controller
class to which request should be passed for subsequent processing. For example, If
you have a Controller defined for all requests by specifying �/� in the URL, all
requests will be entertained by that controller.
4)Once Dispatcher Servlet has identified the Controller to be considered, it passes
the client request to the controller.
5)The controller class is the main class controlling the business logic flow once
request has been dispatched it it by dispatcher servlet. This class will implement
the methods for different type of http requests (e.g. GET, POST) and all logic to
call Service layer methods will reside in this controller class.
6)The controller class will also be responsible for returning the ModelAndView
object back to the dispatcher servlet after getting all business logic executed and
any data returned from DAO layer. ModelAndView object returned by the controller
back to the controller specified both view and model objects.

Controller class is annotated by @Controller annotation.

7)After receiving ModelAndView object from the controller, Dispatcher Servlet now
sends model object to view resolver to get the name of the view which needs to be
rendered.
8)Once the view to be rendered has been identified, Dispatcher Servlet passes model
object to the view. Model object contains the data which needs to be displayed in
the view. View will be rendered with the model data. Views can be designed in any
front-end technology.
9)This view is returned to the client and client can see the view and associated
data on his browser.

3-Oct-2023
==========
>@Repository Annotation is used to indicate that the class provides the mechanism
for storage, retrieval, update, delete and search operation on objects.
>

1: add hikari dependencies to pom.xml


2)create a Hikariconfig object and provide necessary metadata.
3)pass config as parameter to datasource.
==============
SpringBoot
----------
dependencies version issues---Can be handled using Uber jar architectures
Tomcat not working or throwing errors most frequently---can be fixed if framework
is giveing
embedded server.So ,no need to download tomcat and configure in Eclipse.
Spring boot supports Uber jar architecture.
Uber jar means jar with jar.
In main jar all child jars will be appended and downloaded into ur m2
repository.This will avoid 90% of the maven dependency issues.g

Springboot is mainly used for Designing Cloud based applications and Microservice
app development.

Spring boot+Spring Cloud

>>You shld be able to deploy springboot application to AWS cloud/Dockers.

TO deisgn a webservice,we need to write atleast 50 lines.\


But if u use Springboot,within 5 line we can complete.

>>>>To design a Springboot app,below are the ways.


1)USing Eclipse---Gradle/Maven----recommended approach
2)Using Spring Initiliazer --https://start.spring.io/
3)Using SpringBoot Cli
4)Manual approach

https://spring.io/tools--Spring Tool suite version4

>Use static folder for placing static assets like images,fonts...etc

Freemarker

@Repository,@Service,@RestController,@ComponentScanning,@Controller
>>
It is very easy to develop Spring Based applications with Java or Groovy.
It reduces lots of development time and increases productivity.
It avoids writing lots of boilerplate Code, Annotations and XML Configuration.
It is very easy to integrate Spring Boot Application with its Spring Ecosystem like
Spring JDBC, Spring ORM, Spring Data, Spring Security etc.
It follows �Opinionated Defaults Configuration� Approach to reduce Developer effort
It provides Embedded HTTP servers like Tomcat, Jetty etc. to develop and test our
web applications very easily.
It provides CLI (Command Line Interface) tool to develop and test Spring Boot(Java
or Groovy) Applications from command prompt very easily and quickly.
It provides lots of plugins to develop and test Spring Boot Applications very
easily using Build Tools like Maven and Gradle
It provides lots of plugins to work with embedded and in-memory Databases very
easily.

>>
@Controller -> Classes annotated with this, are intended to receive a request from
the client side. The first request comes to the Dispatcher Servlet, from where it
passes the request to the particular controller using the value of @RequestMapping
annotation.

@Service -> Classes annotated with this, are intended to manipulate data, that we
receive from the client or fetch from the database. All the manipulation with data
should be done in this layer.

@Repository -> Classes annotated with this, are intended to connect with database.
It can also be considered as DAO(Data Access Object) layer. This layer should be
restricted to CRUD (create, retrieve, update, delete) operations only. If any
manipulation is required, data should be sent be send back to @Service layer.

>>In springboot ,Spring application class will boostrap(loader) the current class
as per the loading strategy(lazy,early).

You might also like