12-Factor Methodology for Cloud Apps
12-Factor Methodology for Cloud Apps
The methodology includes twelve factors developers should think about when building native
cloud apps. The twelve factors are the following:
1. One code repository per application for multiple deployments
▪ A codebase is a versioned code repository (thanks to tools like Git, Mercurial, or SVN). From a codebase, you can
build immutable releases that can be deployed in different execution environments.
▪ A deployment is a running instance of the application.
▪ There are two simple anti-patterns. First, multiple applications must be split up and placed in separate codebases
if there are multiple applications from the same code base.
▪ Secondly, if several applications share a codebase, it would make sense to factor the code into a library (with its
own codebase) that will be used by the other applications.
2. Dependency isolation and declaration
▪ A cloud application does not assume the implicit existence of packages and dependencies at the system level
during its deployment.
▪ To work properly, the idea is to deploy the application with its dependencies. They form a “whole,” a kind of bundle. The
work to be done is to declare the dependencies explicitly and precisely upstream of the construction and isolate these
dependencies at runtime.
▪ This is possible thanks to tools such as Maven (Java), NuGet (.NET), Npm (Javascript), or Bundler (Ruby). They
allow you to define dependencies with precise versions in manifests and then ensure that the dependencies
are satisfied.
3. Store the configuration in the environment
▪ The idea is to separate the code from the configuration.
▪ The configuration concerns everything that can vary from one deployment to another: the URL of an SMTP
server, a database endpoint, the credentials to connect to an API like Twitter or Google Maps.
▪ They should not be confused with the application’s internal settings, which remain unchanged from one
deployment to another.
▪ To be able to deploy an application on several environments, you can’t define the configurations in the code.
We sometimes tend to put all this in an XML file, but this limits flexibility. This file will not be modified so that
the configurations will be the same for each deployment.
4. External services as attachable and detachable resources
▪ A Cloud application usually depends on external services (databases, file storage, SMTP server, …)
and connects to them via resources, usually a URL and credentials for authentication.
▪ We have seen below that these resources should not be hardcoded but rather set using external
configurations.
▪ Therefore, we have foreseen in the code that the environment’s configuration will allow connection
with any external service.
▪ The idea is to be able to detach and attach an external resource at any time. If one of the external
services fails, we simply modify the resource in the Cloud environment. You don’t need to touch
the code to change the external service for another one.
5. Build, Release and Run
Strictly separate built and run stages.
• The deployment of your application must be properly separated into
three non-overlapping non-dependent phases namely build, release and
run.
• The build phase constitutes the compilation of the code which in the end
generates the artifact like a JAr or WAR file.
• The second phase, release, take the artifact file generated at the end of
the previous phase and adds the configurations for a particular
environment to it.
• The last phase includes the running of the instance of the application.
6. Processes
Execute the application as one or more stateless processes.
• An application is said to follow this principle if its instances can be
created and destroyed any time without making any effect on the overall
functionality of our application.
• To achieve and fulfill this principle, our application must store any type of
data generated by it in any persistent (stateful) datastore. But it doesn’t
mean that we can’t use the in-memory of the processes of our
application. We can use it to store as temporary storage.
• In simple terms, the usage of sticky sessions must be avoided. Sticky
sessions, in simple terms, refers to catching the logged-in user’s session
data in the local memory of the process and then directing each
subsequent request from that particular user to the same process.
• The problem with sticky sessions is that it causes uneven load balancing
among the instances of the application.
7. Port Binding
Export services via port binding.
• Any application that follows this principle is completely self-contained
and standalone. It exports HTTP as a service and doesn’t require any
server like a tomcat to listen to requests.
• It binds itself to some particular port and listens to all the requests hitting
on that port.
• You must also have observed it while designing an application or a
microservice which runs on a particular port and you hit requests on that
particular port using postman to get a response.
• This information that to which port our service will be listening to is also
stored in the configuration file itself.
8. Concurrency
Scale out via the process model.
• An application that follows this principle must be divided into
smaller different processes instead of a single large
application.
• Each such process must be able to start, terminate and
replicate itself independently and at any time. This principle
allows scaling our application very easily.
• By scaling out we refer to horizontal scaling in which we run
multiple instances of our processes. It adds concurrency to our
application in a very simpler way due to the existence of
independent horizontally scalable processes.
9. Disposability
Maximize robustness with fast startup and graceful shutdown.
• Robustness of an application refers to the graceful starting and
termination of its processes without affecting the overall
application’s functionality.
• For example one of the processes of our application is storing
the details of a newly added employee to the company into a
database.
• But while doing so, in between an unexpected error occurs
which causes the process to terminate in between
unexpectedly.
• However, the state of our application or database must not be
affected by it and the process must fail-safe. Also, it must start
quickly whenever required.
10. Development/Production Parity
Keep development, staging, and production as similar as
possible.
• It simply means that the development and production
environment must be as similar as possible.
• The processes being used, technologies and the infrastructure
must be the same.
• This will help you in a way that whatever error that can happen
over time will happen at the development stage itself instead
of surprisingly occurring in the production.
• This helps in the continuous deployment of our application and
reduces the development time and efforts also.
11. Logs
Treat logs as event streams.
• Logs are very essential to understand the internal working of
the application and it can be of different levels and are
generally stored in a file named “logFile” in the storage. Ideally,
our twelve-factor application must not be worried about the
storage of the logs.
• Whenever a request enters into the system, corresponding
logs are made and they are treated as a sequence of events
that can be used to debug when some problem occurs.
12. Admin Processes
Run admin/management tasks as one-off processes.
• Most of the applications require a few one-off tasks to be
executed before the actual flow of the application starts.
• These tasks are not required very often and hence, we
generally create a script for it which we run from some other
environment.
• On the other hand, the twelve-factor methodology says that
such scripts must be made a part of our codebase itself
managed in the version control system.
• These tasks should also follow twelve-factor principles.
Application Integration Process
• Process of enabling the communication
• Low code/No code
• This process is divided into 4 parts
• Protocol(HTTP, Files, XML, AMQP
• Formats (EDI-B2B, HL7-Helathcare, Swift
• SaaS Connectors (RestAPIs – Create, Update, Read, Delete)
• Data operations (Routing and Transformation, Filtering, publications/subscriptions)
12- Factor Apps
Jargons in cloud applications
• Elasticity
• Scalability
• Volatility
• Microservices
12 factor Methodology
• Proposed by Heroku teams based on feedbacks
• A manifesto describing guidelines and best practices to
follow when designing a cloud-native application
• Goal was to synthesize best practices for deploying an
app on Heroku and provide developers who are new to the
cloud with a framework for discussing the challenges
of cloud-native applications.
• Use declarative formats for setup automation, which minimizes time and
cost for new developers joining the project
• Have a clean contract with the underlying operating system, offering
maximum portability between execution environments
• Are suitable for deployment on modern cloud platforms
The 12 factors
The methodology includes twelve factors developers should think about when building native
cloud apps. The twelve factors are the following:
1. One code repository per application for multiple deployments
A codebase is a versioned code repository (thanks to tools like Git, Mercurial, or SVN). From a codebase, you can
build immutable releases that can be deployed in different execution environments.
A deployment is a running instance of the application.
There are two simple anti-patterns. First, multiple applications must be split up and placed in separate codebases
if there are multiple applications from the same code base.
Secondly, if several applications share a codebase, it would make sense to factor the code into a library (with its
own codebase) that will be used by the other applications.
2. Dependency isolation and declaration
A cloud application does not assume the implicit existence of packages and dependencies at the system level
during its deployment.
To work properly, the idea is to deploy the application with its dependencies. They
form a “whole,” a kind of bundle. The work to be done is to declare the dependencies
explicitly and precisely upstream of the construction and isolate these dependencies
at runtime.
This is possible thanks to tools such as Maven (Java), NuGet (.NET), Npm
(Javascript), or Bundler (Ruby). They allow you to define dependencies with
precise versions in manifests and then ensure that the dependencies are
satisfied.
3. Store the configuration in the environment
The idea is to separate the code from the configuration.
The configuration concerns everything that can vary from one deployment to
another: the URL of an SMTP server, a database endpoint, the credentials to
connect to an API like Twitter or Google Maps.
They should not be confused with the application’s internal settings, which
remain unchanged from one deployment to another.
To be able to deploy an application on several environments, you can’t define
the configurations in the code. We sometimes tend to put all this in an XML
file, but this limits flexibility. This file will not be modified so that the
configurations will be the same for each deployment.
4. External services as attachable and detachable resources
A Cloud application usually depends on external services (databases,
file storage, SMTP server, …) and connects to them via resources,
usually a URL and credentials for authentication.
We have seen below that these resources should not be hardcoded but
rather set using external configurations.
Therefore, we have foreseen in the code that the environment’s
configuration will allow connection with any external service.
The idea is to be able to detach and attach an external resource at
any time. If one of the external services fails, we simply modify the
resource in the Cloud environment. You don’t need to touch the code to
change the external service for another one.
5. Build, Release and Run
Strictly separate built and run stages.
• The deployment of your application must be properly separated into three
non-overlapping non-dependent phases namely build, release and run.
• The build phase constitutes the compilation of the code which in the end
generates the artifact like a JAr or WAR file.
• The second phase, release, take the artifact file generated at the end of the
previous phase and adds the configurations for a particular environment to
it.
• The last phase includes the running of the instance of the application.
6. Processes
Execute the application as one or more stateless processes.
• An application is said to follow this principle if its instances can be created
and destroyed any time without making any effect on the overall
functionality of our application.
• To achieve and fulfill this principle, our application must store any type of
data generated by it in any persistent (stateful) datastore. But it doesn’t
mean that we can’t use the in-memory of the processes of our application.
We can use it to store as temporary storage.
• In simple terms, the usage of sticky sessions must be avoided. Sticky
sessions, in simple terms, refers to catching the logged-in user’s session
data in the local memory of the process and then directing each
subsequent request from that particular user to the same process.
• The problem with sticky sessions is that it causes uneven load balancing
among the instances of the application.
7. Port Binding
Export services via port binding.
• Any application that follows this principle is completely self-contained and
standalone. It exports HTTP as a service and doesn’t require any server like
a tomcat to listen to requests.
• It binds itself to some particular port and listens to all the requests hitting
on that port.
• You must also have observed it while designing an application or a
microservice which runs on a particular port and you hit requests on that
particular port using postman to get a response.
• This information that to which port our service will be listening to is also
stored in the configuration file itself.
8. Concurrency
Scale out via the process model.
• An application that follows this principle must be divided into
smaller different processes instead of a single large application.
• Each such process must be able to start, terminate and replicate
itself independently and at any time. This principle allows
scaling our application very easily.
• By scaling out we refer to horizontal scaling in which we run
multiple instances of our processes. It adds concurrency to our
application in a very simpler way due to the existence of
independent horizontally scalable processes.
9. Disposability
Maximize robustness with fast startup and graceful shutdown.
• Robustness of an application refers to the graceful starting and
termination of its processes without affecting the overall
application’s functionality.
• For example one of the processes of our application is storing
the details of a newly added employee to the company into a
database.
• But while doing so, in between an unexpected error occurs
which causes the process to terminate in between unexpectedly.
• However, the state of our application or database must not be
affected by it and the process must fail-safe. Also, it must start
quickly whenever required.
10. Development/Production Parity
Keep development, staging, and production as similar as possible.
• It simply means that the development and production
environment must be as similar as possible.
• The processes being used, technologies and the infrastructure
must be the same.
• This will help you in a way that whatever error that can happen
over time will happen at the development stage itself instead of
surprisingly occurring in the production.
• This helps in the continuous deployment of our application and
reduces the development time and efforts also.
11. Logs
Treat logs as event streams.
• Logs are very essential to understand the internal working of the
application and it can be of different levels and are generally
stored in a file named “logFile” in the storage. Ideally, our
twelve-factor application must not be worried about the storage
of the logs.
• Whenever a request enters into the system, corresponding logs
are made and they are treated as a sequence of events that can
be used to debug when some problem occurs.
12. Admin Processes
Run admin/management tasks as one-off processes.
• Most of the applications require a few one-off tasks to be
executed before the actual flow of the application starts.
• These tasks are not required very often and hence, we generally
create a script for it which we run from some other environment.
• On the other hand, the twelve-factor methodology says that
such scripts must be made a part of our codebase itself
managed in the version control system.
• These tasks should also follow twelve-factor principles.
Application Integration
Process
• Process of enabling the communication
• Low code/No code
• This process is divided into 4 parts
• Protocol(HTTP, Files, XML, AMQP
• Formats (EDI-B2B, HL7-Helathcare, Swift
• SaaS Connectors (RestAPIs – Create, Update, Read, Delete)
• Data operations (Routing and Transformation, Filtering,
publications/subscriptions)
API FUNDAMENTAL
What's an API?
• Composite APIs, where multiple data or service APIs are combined together,
allowing developers to access several APIs at a time.
Types of API protocols
• To be able to use APIs effectively, developers must adhere to a common
set of rules, or protocols, when making API calls.
• The term API call simply refers to the process of communicating with an
API; in other words, an API call is when data is sent to and retrieved
from an API endpoint.
• There are three main types of API protocols:
• REST. REST is short for Representational State Transfer and is a web
services API.
• It provides a uniform interface, where a client and server communicate with
one another via Hypertext Transfer Protocol ( HTTP) , by using Uniform
Resource Identifiers ( URIs) , the common Create, Read, Update, and
Delete ( CRUD) operations, and most often JavaScript Object Notation
( JSON) conventions for data exchange.
• SOAP. SOAP is short for Simple Object Access Protocol and is another
type of web services API.
• SOAP APIs have been used since the 1990s, but the protocol is stricter
and more heavyweight than REST, so it isn’t used as much in modern API
development.
• RPC. RPC is short for Remote Procedural Call and is the oldest and
simplest type of API protocol.
• RPC is a request- response protocol, where a client sends a request to
a remote server to execute a specific procedure, and then the client
receives a response back.
• However, RPC APIs are much more difficult to maintain and update than
REST APIs, so again RPC APIs aren’t used as much in modern API
development.
Styles of API development
• Here are the five main styles of API development:
I. Tunnel.
1. In this style, the API is a collection of functions that can be called remotely.
2. A common technology used in this style is Remote Procedure Call method.
3. The tunnel style is focused on making specific computer functions available.
4. This is a popular style; for example, gRPC is an open source remote procedure call framework you can
use to develop APIs.
II. Resource
1. In this style, the API is a collection of resources that can be interacted with.
2. This style is likely the most popular style for public APIs, enabling resources like products,
customers, and other data to be accessed.
3. A common technology that’s used for this API style is HTTP that calls an API that’s been written
following the OpenAPI specification.
III. Hypermedia.
I. This style is an enhancement of the Resource style. In this style, the API is a collection of interlinked
resources, which is very much how web apps are delivered.
II. Similarly, this style often uses HTTP calls to an OpenAPI-described service, with the difference being
that the data also includes controls to link the resources together.
IV. Query.
I. In this style, the API exposes a structured data model that can be queried and updated
by using a generic query language.
II. This style is usually used when you have a large amount of data, where the API needs
to query the dataset and return just the data needed for that query.
III. A very popular example of a technology that uses this style is GraphQL, as noted
previously.
IV. GraphQL is a very flexible query language that allows you to ask for specific sections
of a large data model, thereby enabling API developers to interrogate large amounts of
data much more efficiently.
V. Event.
I. In this style, the communication pattern is reversed, and the API listens for events
instead of asking for information.
II. In most cases with event style APIs, the API works in what is called a
publish/subscribe (pub/sub) model, where API consumers listen out for events that they’ve
subscribed to.
III. For example, your API might listen out for when a particular product is bought, and
then take an action based on that. One of the most popular event style technologies
is Kafka.
Benefits of API development
Speed. Having a library of reusable APIs speeds up application
development and ongoing app evolution.
Socialize. Publishing APIs expands your brand reach and enables you to
tap into broader developer and partner ecosystems to drive innovation.
Monetize. Enable new business channels by charging money for the use of,
or rate of use of, the APIs that can access your data and algorithms.
API Management
• How do I ?
• FIND
• SECURE
• PROTECT
• UNDERSTAND
• CONTROL
• GOVERNANCE
Control Plane
• Create API
• Define API Policies
All requests for control plane operations are sent to the Azure Resource Manager URL. That URL varies by the
Azure environment.
• Single Entry Point: The API gateway sits between clients and backend services, acting as a reverse
proxy. Clients interact with this single point, rather than directly with multiple microservices.
• Request Routing: It intelligently routes incoming requests to the appropriate backend services based on
defined rules and configurations.
• Authentication and Authorization: API gateways handle authentication (verifying the identity of the
client) and authorization (determining what resources the client has permission to access).
• Security Policies:They enforce security rules, such as rate limiting (controlling the number of requests
from a client), and ensure secure communication (e.g., SSL/TLS offloading).
• Request Transformation: API gateways can translate requests and responses between
different formats or protocols used by clients and backend services.
• API Composition: They can combine responses from multiple backend services into a single,
coherent response for the client.
• Caching: API gateways can cache frequently accessed data to improve performance and
reduce load on backend services.
Scaling of Managed Gateway’s
• Number of units allocated to each Region
• According to the subscription mode ( e.g. Premium 10 units)
API Region 1
URL1 GW
scale
API Region 2
URL2 GW
scale
• Naming – provided
Traffic manager <Service>-<Region>-01-<Region>-02-…-[Link]
1. Vertical Scaling (Scaling Up):
• Involves increasing the CPU, memory, or other resources of individual gateway instances.
• Suitable when a single gateway instance is nearing its capacity, but the overall number of
concurrent requests is manageable.
• May be a simpler option initially, but has limits on how much capacity can be added.
2. Horizontal Scaling (Scaling Out):
• Involves adding more gateway instances to the cluster, distributing the load across
multiple machines.
• Allows for greater scalability and capacity, as more instances can be added as needed.
• Requires proper load balancing and potentially more complex management of the cluster.
• As each API gateway is enabled to provide resource those can be used individually
by the other application directly through the URLs
• Each Customer need to rely on the traffic manager
• API Gateway communicates with the APIs with Private Ips or Public Ips
• It must have IP path for Public IP
• For Private IP it should have VNET.
• API Gateway going to INJECT itself to VNET subnet
• Firewall rules are applied to IP path avoid direct connection between Application
and APIs
Unit - 2 API
Testing Tools
SoapUI is a specialized tool designed for testing REST, SOAP, and GraphQL APIs.
It offers a comprehensive API testing solution with a strong emphasis on convenience
for developers and testers through its user-friendly graphical interface.
The tool enables the execution of automated functional, regression, and load tests,
making it suitable for various testing scenarios.
• Functional Testing: It allows you to Create and
manage test cases and suites for comprehensive API
validation.
• Mock Services: You can Simulate API responses with
mock services for development and testing.
• Security Testing: Identify and test for security
vulnerabilities in APIs.
• Load Testing: Evaluate API performance under
various load conditions.
• Cross-Platform Support: Available on Windows,
macOS, and Linux.
• Service Inspection: Discover and inspect WSDLs and
OpenAPI specifications.
• Mock Services: Simulate API behavior with mock
services to test without relying on the actual
API.
Advantages of SOAPUI
SoapUI offers several key benefits that make it a preferred choice for API testing:
Thorough API Testing: SoapUI provides a wide range of tools and features that enable
comprehensive API testing. It supports testing for REST, SOAP, and GraphQL APIs,
allowing testers to evaluate various types of APIs in one platform.
Open-Source Code Methodology: Being based on an open-source code methodology,
SoapUI allows users to access and modify its source code. This offers greater flexibility
and customization options to tailor the tool according to specific testing requirements.
One-Stop Solution: SoapUI’s versatility and various functionalities make it a complete
and all-inclusive solution for API testing. Whether it’s functional, regression, or load
testing, the tool covers all essential aspects of API evaluation, eliminating the need for
multiple testing tools.
Disadvantages
• Lower Stability: Some users have reported that
SoapUI may have occasional stability issues,
leading to crashes or unexpected behavior during
testing. While the tool is generally reliable,
these instances of instability can be frustrating
for users.
• Steep Learning Curve: SoapUI’s interface and
features can be overwhelming for first-time users,
especially those new to API testing. Navigating
through the tool and understanding its
capabilities may require some initial effort and
training.
• Dependency on WSDL for Web Service Testing: SoapUI
heavily relies on Web Services Description
Language (WSDL) files for testing web services.
While WSDL is a standard way to describe web
services, some APIs might not have well-defined or
• Test Studio by Progress Telerik provides a
user-friendly and easy-to-maintain testing
solution for users. It offers seamless
integration of RESTful APIs into various
environments, enabling efficient API testing.
• With Test Studio, users can automate API
testing without the need for coding, ensuring
thorough validation of the model’s integrity
and reliability.
• In summary, Test Studio streamlines the API
testing process by offering a simple and code-
free approach, making it accessible to a
broader range of users while ensuring the
accuracy and dependability of the tested APIs.
• API Functional Testing: Create and execute
tests to verify API functionality and
responses.
• Assertions: Validate API responses with built-
in assertions or custom conditions for precise
verification.
• Mock Services: Simulate API behavior with mock
services to test interactions without relying
on live endpoints.
• Automated Test Execution: Schedule and run API
tests automatically as part of a CI/CD
pipeline.
• Performance Testing: Assess API performance
with built-in tools for load and stress
testing.
Advantages of Test Studio
Web service
Service components
Microservice
Application
software
Run time libraries
Data Store
Assembling an application
Each microservice performs a small limited task
Not intended to be standalone applications
Surrounded by specialized infrastructure
Manage communications
Orchestrate services into complex chains of tasks
Load balancing
API Gateway
User Interface layer
Externally exposed APIs
Multiple instances of any microservice launched as needed
Microservices-based Application
Scripts/
User Third Party Systems
Interfaces API endpoints
API Gateway
Web service
Service
component
s
Web service Web service
Web service
Service Service Web service
component Service component
component Microservice
s s Service
s
component
Web service s
Web service Web service Application
Microservice Microservice Web service
Microservice Web service Service software
Service Service component
component Service
component
Service s Microservice
s s component
Application component Application s Run time libraries
software Application s
software
software Application
Microservice
Microservice Microservice software
Microservice
Run time libraries Microservice Run time libraries
Run time libraries
Application Data Store
Application Application Run time libraries
Application software
software software Application software
software
Data Store Data Store Run time libraries
Run time libraries Run time libraries Data Store
Run time libraries
Run time libraries Data Store
Data Store
Data Store Data Store
Data Store
Data Store
Persistence / System
Layer
Beyond Virtual Machines to Containers
Virtual machines are a common technology for optimizing use of
computing hardware
Most applications use a small portion of computing and storage
capacity
VM managers enable multiple instances of operating environments to
co-exist on each physical server
Virtual Machine Environment
Multiple Virtual Machines can
VM-1 VM-2 VM-3 VM-4
share a single physical server
VMs allocated via a Virtual
Apps Apps Apps Apps
Machine Monitor or Hypervisor
Code
libraries
Code
libraries
Code
libraries
Code
libraries
Each VM contains its own
operating system, code
Guest
OS
Guest
OS
Guest
OS
Guest
OS libraries, applications, web
services, and other components
Virtual Machine Monitor
Each VM independent: can host
Host operating system
any OS, libraries, apps
Server Hardware
Containers
Server hardware provides OS Kernel to any
container
Code libraries and binaries, memory, disk
m m m m m m m m
storage, and other resources residing on the
i i i i i i i i server can be provisioned to any container
c c c c c c c c
r r r r r r r r Containers can be rapidly deployed based on
o
s
o
s
o
s
o
s
o
s
o
s
o
s
o
s
pre-defined configuration sets
e
r
e
r
e
r
e
r
e
r
e
r
e
r
e
r
Containers require fewer resources: do not run
v v v v v v v v an entire copy of OS and support services
i i i i i i i i
c c c c c c c c Containers can differ or replicate
e e e e e e e e
High demand microservices may require many
Binaries / Libraries set A Bins / Libs B
instances
Container Engine (eg: Docker) Containers share resources but are designed
Host operating system
to be rigidly independent
Container engine ensures against resource
collisions
Server Hardware
API Gateway
Requests to microservices usually not made directly from external agents
Need a layer to manage access to Microservices to enable flexible
deployment
Multiple microservices may be required to perform a complex task, usually
many instances of each microservice
API Gateways provide a single entry point for all requests into the
application.
Developers do not need to know physical address of each service (nothing
should be hardwired)
Manage authentication, protocol conversions, communications, routing, load
balancing
DevOps
Merges development with operations
A single team takes responsibility for development, deployment,
operations, and maintenance of a microservice
Make independent technology decisions
Programming language
Databases
Apache Mesos
Benefits of Microservices
Rapid development
Quick path to MVP (minimal viable product)
Distributed teams
Modularity
Scalability
Spring Boot Fundamentals
• What is Spring Boot:
“It’s a framework for building applications in the Java programming
language”
In otherwards It is collection of different tools.
• src/main/java
Base Package: Your main application class typically resides here. It usually follows a naming convention
based on your project name (e.g., [Link]).
Controllers: Classes annotated with @RestController to handle HTTP requests (e.g., [Link]).
Services: Classes annotated with @Service that contain the business logic (e.g., [Link]).
Repositories: Interfaces annotated with @Repository for data access (e.g., [Link]).
• src/main/resources
[Link] or [Link]: Configuration files for your application
settings.
static/: Contains static files like CSS, JavaScript, and images that will be served directly.
templates/: Holds server-side templates (if using a templating engine like Thymeleaf).
public/: Similar to static/, but files in this directory can be accessed publicly.
• src/test/java
• Contains your test cases, typically following the same package structure as src/main/java.
It includes unit tests and integration tests for your application.
Build File
[Link] (for Gradle): Similar to [Link], it specifies dependencies and tasks for building your project.
1. Build Configuration
• The build file defines how your project is built and packaged.
Maven:
o Specifies build plugins and their configurations.
o Defines the packaging type (e.g., jar, war).
o Handles the build lifecycle phases (compile, test, package).
Gradle:
o Uses a Groovy or Kotlin DSL to define tasks for compiling, testing, and
packaging.
o You can create custom tasks to suit your project needs.
2. Version Management
• Both build tools help manage the versions of your dependencies and plugins, ensuring compatibility and
stability.
Maven Plugins: For example, the Spring Boot Maven Plugin can be used to create an executable JAR:
Gradle Plugins: Similarly, you can apply the Spring Boot Gradle Plugin: