full stack java
full stack java
Bachelor of Technology In
COMPUTER SCIENCE AND ENGINEERING
By
M.GANESH SIVAJI – 22KP1A0574
1
Department Of Computer Science and Engineering
NRI INSTITUTE OF TECHGNOLOGY GUNTUR
Approved by AICTE, Permanently Affiliated to JNTU, KAKINADA
Accredited by NAAC with 'A+' Grade VISADALA(V),
MEDIKONDURU(M), GUNTUR(Dt) -522438
2
NRI INSTITUTE OF TECGNOLOGY GUNTUR
Department Of Computer Science and Engineering
NRI INSTITUTE OF
TECGNOLOGY GUNTUR
3
ABSTRACT
Full Stack Java development has emerged as a versatile and robust solution for
building end-to-end applications, catering to a diverse range of industry needs. This development
paradigm involves proficiency in Java-based backend technologies and complementary frontend
frameworks to deliver cohesive, scalable, and maintainable solutions. Java, known for its platform
independence and extensive ecosystem, serves as the backbone for server-side logic, while frontend
technologies like HTML, CSS, and JavaScript ensure intuitive and responsive user interfaces.
The backend stack typically comprises Spring Framework, Hibernate, and RESTful APIs
for building secure and efficient server-side components. For the frontend, integration with
frameworks like Angular, React, or Vue.js enhances interactivity and user engagement. Full stack
Java developers leverage tools like Maven, Jenkins, and Docker for continuous integration, testing,
and deployment, ensuring streamlined workflows and high-quality deliverables.
This comprehensive skill set enables developers to bridge the gap between frontend and
backend, fostering a seamless application development process. Organizations benefit from reduced
communication overhead, faster development cycles, and a unified codebase. As businesses
increasingly seek agile and scalable digital solutions, Full Stack Java development remains pivotal in
delivering cutting-edge applications that meet evolving market demands.
This abstract underscores the significance of mastering Full Stack Java to harness its
potential for modern software development, highlighting its role in transforming ideas into fully
functional and efficient applications.
The goal of Full Stack Java development is to build end-to-end applications by integrating
backend and frontend technologies seamlessly. It focuses on creating efficient, scalable, and user-
centric solutions using tools like Spring, Hibernate, and JavaScript frameworks. This approach
enables rapid development and deployment of robust applications that meet diverse business needs.
4
LETTER OF UNDERTAKING
To
The Principal
Viasadala,
Guntur.
Dear Sir,
Therefore, I pray and hope that you would be kind enough to accept my Internship
Report and oblige thereby.
Yours Obediently,
M.Ganesh Sivaji
ID: 22KP1A0574
EMAIL: [email protected]
5
CERTIFICATE OF INTERNSHIP
6
ACKNOWLEDGEMENT
We take this opportunity to express our deepest gratitude and appreciation to all those
people who made this Internship work easier with words of encouragement, motivation, discipline,
and faith by offering different places to look to expand my ideas and help me towards the successful
completion of this Internship work.
First and foremost, we express our deep gratitude to Dr.Alapati Ravindra, Chairman,
NRI Institute of Technology for providing necessary facilities throughout the Internship program.
We express our sincere thanks to Dr. Kota Srinivasarao, Principal, NRI Institute of
Technology for his constant support and cooperation throughout the Internship program.
We would like to express our sincere gratitude to our NRIIT INTERNSHIP I/C
Ms.G.Sowmya, SPOC and our Internship Coordinator Ms.----------for his insightful advice,
motivating suggestions, invaluable guidance, help and support in successful completion of this
Internship.
We would like to take this opportunity to express our thanks to the teaching and non-
teaching staff in the Department of Computer Science & Engineering NRIIT for their invaluable
help and support.
7
Table of Contents:
FullStackJava Virtual Internship
Module Module Contents Dates Page
No:
Module 1:
Front End Introduction to Front End
1.HTML
1.1 Introduction to html
1.2 Structure , Basic Tags.
1.3 Forms , Media.
1.4 Semantic Tags , Attributes. 15-05-2024 10 to
2.CSS To 22
2.1 Introduction to Css
01-06-2024
2.2 Selectors & Specificity
2.3 Box Model & Layouts
2.4 Styling & Animations
2.5 Frameworks & Integration
3.JAVASCRIPT
3.1 Introduction to JS
3.2 Basics& Functions
3.3 Objects & Arrays
3.4 DOM Manipulation
3.5 ES6+ Features & Asynchronous JS
3.6 Error Handling & Advanced Topics
Module 2:
Back End Introduction to Back End
1.JAVA
1.1 Introduction to Java
1.2 Core Java Concepts
1.3 Object-Oriented Programming (OOP) 02-06-2024 23 to
1.4 Java Collections To 35
1.5 Exception Handling 22-06-2024
1.6 File Handling and I/O
2. Spring
2.1 Introduction to Spring
2.2 Spring Framework
3. Spring Boot
3.1 Introduction and Architecture
3.2 Application Development
3.3 Database Integration
3.4 Security and Testing
3.5 Microservices and Deployment
3.6 Real-World Applications
8
Module Module Contents Dates Page
No:
Module 3: 1. Java Database Connectivity (JDBC)
Database 1.1 Introduction to JDBC
2. Structure Query Language (SQL) 23-06-2024 36 to
2.1 Introduction and Database Basics To 41
2.2 Core SQL Operations 02-07-2024
2.3 Database Design and Relationships
2.4 Integration with Java
2.5 Transactions and Optimization
Module 4: 1.GitHub
VersionControl 1.1 Introduction to Git and GitHub 03-07-2024 42 to
1.2 Git Basics
To 45
1.3 Collaborating with GitHub
1.4 GitHub Repositories and Workflows 07-07-2024
1.5 Version Control Best Practices
1.6 GitHub for Full Stack Java Projects
9
1.HTML
1.1 Introduction to HTML
HTML (HyperText Markup Language) is the standard language for creating web pages.
structures web content and enables the inclusion of text, images, links, and other
elements.
• HyperText: Refers to the ability to link text.
• Markup Language: Utilizes tags to define elements within a document.
Features of HTML:
1. Easy to learn and use.
2. Supported by all modern browsers.
3. Platform-independent.
HTML File Structure: HTML documents are text files saved with a .html or .htm
extension. They can be created and edited using simple text editors.
HTML uses tags enclosed in < >. A tag often consists of an opening tag (e.g., <html>) and
a closing tag (e.g., </html>). Some tags are self-closing (e.g., <img />).
Basic Structure of an HTML Document:
Html
Code
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>Welcome to HTML</h1>
<p>This is a paragraph.</p>
</body>
</html>
Important Tags:
10
• <img>: Images (e.g., <img src="image.jpg" alt="Description">
Code
<label for="name">Name:</label>
<br>
<label for="email">Email:</label>
<br>
</form>
• Attributes:
o action: URL to send the data.
o method: HTTP method (GET/POST).
o type: Defines input type (text, email, password, etc.).
Media Elements:
1. Images:
Code
2. Audio
Code
<audio controls>
11
Your browser does not support the audio element. </audio>
3. Video
Code
</video>
Semantic tags clearly define the purpose of content, improving SEO and accessibility.
<header>
<h1>Website Title</h1>
<nav>
<a href="#home">Home</a> |
<a href="#about">About</a>
</nav>
</header>
<main>
<article>
<h2>Article Title</h2>
12
<p>This is a sample article.</p>
</article>
</main>
<footer>
<p>Copyright © 2024</p>
</footer>
HTML Attributes
Attributes provide additional information about elements. They are placed within the opening tag
and follow a name="value" syntax.
Common Attributes:
Example:
13
2.CSS
2.1 Introduction to CSS
CSS (Cascading Style Sheets) is a language used to style and format the appearance of HTML
documents. It separates content (HTML) from design, ensuring flexibility and consistency.
Features of CSS:
p { color: blue; }
</style>
Types of Selectors:
* { margin: 0; }
14
3.Class Selector (.): Targets elements with a specific class
Specificity Rules:
div {
width: 200px;
padding: 10px;
margin: 20px;
}
15
The total width = content width + padding + border + margin.
CSS Layouts:
display: flex;
justify-content: center; /* Center horizontally */
display: grid;
3. Positioning:
Styling Basics:
1.Colors:
color: #333; /* Text color */
background-color: #f0f0f0; /* Background */
2.Typography:
font-size: 16px;
font-family: Arial, sans-serif;
text-align: center;
div {
16
div:hover {
background-color: lightblue;
@keyframes slideIn {
to { transform: translateX(0); }
div {
Popular Frameworks:
document.querySelector("div").style.color = "red";
17
3.JavaScript
3.1 Introduction to JavaScript
• Features:
o Cross-platform.
Example:
<script>
console.log("Hello, JavaScript!");
</script>
Variables
Example
let name = "John"; // block-scoped
Data Types
Operators
Arithmetic, logical (&&, ||), comparison (===, !==).
Functions
Example
function greet(name) {
18
return `Hello, ${name}!`;
console.log(greet("Alice"));
. Arrow Functions:
Example
console.log(add(3, 5));
Objects
Example
const person = { name: "Alice", age: 30 };
console.log(person.name); // "Alice"
Methods:
Example
person.greet = function() {
};
console.log(person.greet());
Arrays
Example
fruits.push("cherry");
console.log(fruits[1]); // "banana"
19
console.log(squares); // [1, 4, 9]
The Document Object Model (DOM) represents the HTML structure of a page. JavaScript can
dynamically manipulate it.
Selecting Elements
Example
Changing Content
Event Listeners
document.querySelector("button").addEventListener("click", () => {
alert("Button clicked!");
});
Creating Elements
document.body.appendChild(para);
ES6+ Features
• Template Literals:
const name = "Bob";
console.log(`Hello, ${name}!`);
Destructuring:
console.log(name, age);
Spread Operator:
Example
const arr = [1, 2, ...numbers];
20
console.log(arr); // [1, 2, 1, 2, 3]
Asynchronous JS
• Promises:
Example
fetch("https://api.example.com")
Example
try {
} catch (err) {
}
Custom Errors:
Example
constructor(message) {
super(message);
this.name = "CustomError";
}
}
21
Advanced Topics
• Modules:
Example
// file.js
// main.js
console.log(greet("Alice"));
function outer() {
let count = 0;
count++;
return count;
};
}
console.log(increment()); // 1
22
1. JAVA
1.1 Introduction to Java
Java's core principles are foundational for application development. Key concepts include:
• Example:
System.out.println("Hello, World!");
}
• Data Types: Includes primitive types (int, double, char, etc.) and reference types.
23
1.2.3 Java APIs
• Classes and Objects: Classes define properties and behaviors. Objects are instances of
classes.
• Example
class Car {
String brand;
int speed;
void drive() {
System.out.println("Driving " + brand);
Inheritance: Enables a class (child) to inherit properties from another class (parent).
Example
class Vehicle {
void start() { System.out.println("Vehicle started"); }
24
• Encapsulation: Bundles data and methods, restricting access using access modifiers.
ArrayList Example:
list.add("Apple");
list.add("Banana");
System.out.println(list);
HashMap Example:
map.put(1, "One");
map.put(2, "Two");
System.out.println(map);
1.4.3 Benefits
• Try-Catch:
try {
25
int result = 10 / 0;
} catch (ArithmeticException e) {
} finally {
System.out.println("Cleanup");
Throwing Exceptions:
}
}
1.5.3 Best Practices
Java provides extensive support for file operations through its java.io and java.nio packages.
writer.write("Hello, Java!");
writer.close();
26
}
reader.close();
Example
String line;
br.close();
27
2. Spring
Spring is a powerful and flexible open-source framework designed to simplify Java application
development. It provides comprehensive infrastructure support for developing Java applications,
enabling developers to focus on the core functionality of their software.
• Lightweight: The core container is lightweight, making Spring suitable for a range of
projects, from simple standalone applications to complex enterprise systems.
Spring aims to address common challenges in Java development, offering solutions that reduce
boilerplate code, enhance modularity, and improve maintainability.
2. Spring AOP:
o Simplifies database interaction with support for JDBC, JPA, Hibernate, and
transaction management.
28
4. Spring Web:
o Supports web application development with MVC architecture, REST APIs, and
integration with web servers.
5. Spring Security:
6. Spring Boot:
29
3.Spring Boot
3.1 Introduction and Architecture
Key Features
• Embedded Servers: Provides servers like Tomcat, Jetty, or Undertow for standalone
deployment.
2. Choose dependencies like Spring Web, Spring Data JPA, and Thymeleaf.
3. Import the project into your IDE and add business logic.
Key Components
30
@RequestMapping("/api")
@GetMapping("/hello")
Code
spring.datasource.url=jdbc:mysql://localhost:3306/db_name
spring.datasource.username=root
spring.datasource.password=password
spring.jpa.hibernate.ddl-auto=update
Creating Entities
Define entities using JPA annotations:
code
@Entity
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
31
Repository Integration
Code
Service Layer
code
@Service
@Autowired
return userRepository.findAll();
Security
Spring Boot simplifies security with the spring-boot-starter-security module. Add the dependency
and configure basic authentication:
code
spring.security.user.name=admin
spring.security.user.password=admin123
WebSecurityConfigurerAdapter:
code
@Configuration
32
@EnableWebSecurity
@Override
.authorizeRequests()
.antMatchers("/public/**").permitAll()
.anyRequest().authenticated()
.and()
.formLogin();
}
}
Testing
Code
@SpringBootTest
@Autowired
private UserService userService;
@Test
void testGetAllUsers() {
assertNotNull(users);
}
}
33
.5 3Microservices and Deployment
Leverage Spring Boot to create loosely coupled services communicating over REST or messaging
(e.g., RabbitMQ).
Tools: Spring Cloud, Eureka for service discovery, and Hystrix for fault tolerance.
Sample Microservice
Code
@EnableEurekaClient
@SpringBootApplication
Deployment Options
· Embedded Server Deployment: Package as a JAR using mvn clean package and run via java -jar
app.jar.
Create a Dockerfile:dockerfile
Code
FROM openjdk:11
COPY target/app.jar app.jar
Cloud Deployment: Deploy on AWS, GCP, or Azure using their respective platforms.
34
3.6 Real-World Applications
1. E-Commerce Platform: Build REST APIs for product catalog, user authentication, and order
processing.
2. Banking System: Use secure endpoints for transactions, account management, and reporting.
3. IoT Data Processing: Integrate with MQTT brokers to process IoT sensor data in real-time.
Key Features for Real-World Apps
6. Scalability: Implement load balancing and caching using Spring Cloud and Redis
35
1.Java Database Connectivity (JDBC)
Java Database Connectivity (JDBC) is a Java API that enables Java applications to interact with
relational databases. It provides methods for querying and updating data, ensuring database
independence through a standard interface.
Features of JDBC
1. Database Independence: Supports a wide range of databases like MySQL, PostgreSQL, and
Oracle.
JDBC Components
6. DriverManager: Manages database drivers and establishes connections.
JDBC Workflow
1.Load Driver:
code
Class.forName("com.mysql.cj.jdbc.Driver");
Establish Connection:
Create Statement:
Execute Query:
36
}
Close Resources:
rs.close();
stmt.close();
conn.close();
Best Practices
code
pstmt.setInt(1, 1);
ResultSet rs = pstmt.executeQuery();
2.Close resources in a finally block or use try-with-resources.
3.Handle exceptions effectively using SQLException.
4.Use connection pooling for efficient resource management (e.g., with HikariCP).
Advantages
Platform independence.
37
2. Structure Query Language (SQL)
2.1 Introduction and Database Basics
SQL (Structured Query Language) is a standardized programming language used for managing and
manipulating relational databases. It enables users to retrieve, insert, update, and delete data within a
database. Key components include:
Aggregating Data
• GROUP BY Clause: Groups rows sharing a property.
EX: SELECT column1, COUNT(*) FROM table_name GROUP BY column1;
38
• HAVING Clause: Filters grouped data.
Joins
Joins combine rows from two or more tables based on a related column.
• Inner Join:
EX: SELECT * FROM table1 INNER JOIN table2 ON table1.column = table2.column;
• Left Join:
Effective database design is critical for scalability and performance. Key principles:
Normalization
Relationships
Name VARCHAR(100));
CustomerID INT,
FOREIGN KEY (CustomerID) REFERENCES Customers(CustomerID));
39
2.4 Integration with Java
Java provides libraries like JDBC (Java Database Connectivity) to interact with SQL databases.
Steps to Integrate
1. Import JDBC Libraries:
2. Establish a Connection:
while (rs.next()) {
System.out.println(rs.getString("column_name"));
}
conn.close();
Prepared Statements
Used for parameterized queries to enhance security and prevent SQL injection.
pstmt.setString(1, "value");
ResultSet rs = pstmt.executeQuery();
Transactions
• ACID Properties:
40
o Durability: Changes persist after completion.
• SQL Syntax:
To rollback:
ROLLBACK;
Optimization Techniques
2. Query Optimization:
o Use appropriate joins.
o Avoid SELECT *.
By mastering these SQL concepts, developers can efficiently design, manage, and optimize databases
for robust applications.
41
Git and GitHub Documentation
What is Git?
Git is a distributed version control system that tracks changes in source code during software
development. It enables multiple developers to collaborate efficiently and maintain version history.
What is GitHub?
GitHub is a cloud-based hosting service for Git repositories. It provides additional features such as
issue tracking, collaboration tools, and CI/CD integration.
Key Features
Setting Up Git
2. Configure Git:
1. Initialize a Repository:
2. Clone a Repository:
3. Check Status:
4. Stage Changes:
Code: git add <file>
42
git add . # Stage all changes
5. Commit Changes:
6. View Log:
Code: git log
Branching
• Create a branch:
• Switch branches:
• Merge branches:
Code: git merge <branch-name>
Pull Requests
Resolving Conflicts
43
1.4 GitHub Repositories and Workflows
Creating a Repository
o Merge feature branches into the main branch after code review.
2. Gitflow Workflow
GitHub Actions
• Automate CI/CD workflows with GitHub Actions using .yml files in the .github/workflows
directory.
44
1.6 GitHub for Full Stack Java Projects
Project Setup
Repository Structure
Code: project/
Code:
name: Java CI
on: [push, pull_request]
45
jobs:
On the back-end, Java’s frameworks like Spring Boot and Hibernate facilitate rapid development of
secure and high-performance APIs, handling complex business logic and database management. For
the front-end, technologies like React, Angular, or Vue.js integrate smoothly with Java backends,
enabling the creation of engaging and responsive user interfaces. The full-stack skill set empowers
developers to bridge gaps between user experience, server-side processing, and data management.
Java’s platform independence and its extensive libraries and frameworks make it a preferred choice
for enterprise-level applications. Its ability to support microservices architecture ensures that Full
Stack Java developers are well-equipped to build modular and scalable systems tailored for modern
demands.
Furthermore, Full Stack Java developers bring value to teams by understanding and contributing to
all aspects of the software development lifecycle, ensuring efficient communication and problem-
solving across the stack. As businesses increasingly seek versatile developers, Full Stack Java
expertise provides a competitive edge in the job market.
In conclusion, mastering Full Stack Java is a strategic investment for developers aspiring to stay
relevant in the fast-evolving software landscape. It combines the power of Java's back-end
capabilities with front-end technologies, ensuring that developers can create comprehensive, end-to-
end solutions.
46
47