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

Web Application With Spring Boot

Uploaded by

Malar M
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Web Application With Spring Boot

Uploaded by

Malar M
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 13

WEB APPLICATION WITH

SPRING BOOT
JAVA FULL STACK
SPRING BOOT AND CAPABLITIES
 Java Spring Framework (Spring Framework) is a popular, open source, enterprise-
level framework for creating standalone, production-grade applications that run on
the Java Virtual Machine (JVM).

 Java Spring Boot (Spring Boot) is a tool that makes developing web application
and microservices with Spring Framework faster and easier through three core
capabilities:

 Autoconfiguration
 An opinionated approach to configuration
 The ability to create standalone applications
SPRING BOOT WEB APPLICATIONS

 Spring makes building web applications fast and hassle-free.

 By removing much of the boilerplate code and configuration associated


with web development, you get a modern web programming model that
streamlines the development of server-side HTML applications, REST
APIs, and bidirectional, event-based systems.
GETTING STARTED

o One of the main challenges to starting up a new project is an initial setup for
the project.

o We need to take a call about the different directory structure and also need to
make sure we are following all the industry standards.

o For creating a web application with Spring Boot, we need following tools
 Our preferred IDE (I will be using IntelliJ)
 Maven
 JDK 1.8+
CREATING PROJECT STRUCTURE

 There are multiple ways to use Spring Boot Initializer to generate


project structure for you.

 Using Spring Initializr Web Interface.


 Use Spring Boot CLI tool.
 Use your IDE
PROJECT STRUCTURE

 Spring Boot does not require any specific code


layout or structure.

 We can always follow some of the best practices


suggested by Spring Boot team, however, final
structure will be driven by your project
requirement.
POM.XML
• The full form of POM is Project Object Model

• It is a fundamental unit of work in Maven

• pom is a XML file that contains information about the


project and configuration details used by Maven to build
the project.

• When executing a task or goal, Maven looks for the


POM in the current directory. It reads the POM, gets the
needed configuration information, then executes the
goal.

• Configurations specified in the POM are the


project dependencies, the plugins or goals that can be
executed, the build profiles.
@SPRINGBOOTAPPLICATION ANNOTATION

@SpringBootApplication annotation.

@SpringBootApplication is equivalent to using @Configuration,


@EnableAutoConfiguration and @ComponentScan with their default values.

If you are starting your project, it’s recommended to use annotation.


WELCOME CONTROLLER

• @Controller annotation indicates that an annotated class is a "Controller" (e.g. a web controller).
• @RequestMapping annotation ensures that HTTP requests to /welcome are mapped to
the welcome() method.
• We have not specified any method to the @RequestMapping annotation as default maps
all HTTP operations by default.
1 UI TEMPLATE

Here is our simple Thymeleaf HTML template.


While using Thymeleaf as our template engine, Spring Boot will look for resources by
surrounding the view name with a prefix and suffix (externalized to spring.thymeleaf.prefix and
spring.thymeleaf.suffix, defaults ‘classpath:/templates/’ and ‘.html’ respectively).
RUN APPLICATION

• With Maven, we can run the application using mvn spring-boot:run command.

• we can build the JAR file with mvn clean package command and run jar by using java -jar
target/demo-app-0.1.0.jar.

• Now the site is up and running, visit,http://localhost:8080/welcome and if everything is in place,


you should have following output on your web browser.
THANK YOU

You might also like