Spring boot
Spring boot
Spring tool suite -> need to have (spring boot projects) or use eclipse
Springboot:
@SpringbootApplication: it contains inbuild all annotations all spring boot configuration
required are added by spring boot application.
Makes it easy to create standalone production grade spring-based applications that you
can just run.
Spring boot?
Standalone-> when build spring we build jar or war file to servlet container.
Spring boot give standalone container ready to run(no need servlet container)
Convention over configuration: for 80% use case spring boot provide the default
configuration.
Spring-boot-starter-web
@SpringBootApplication
SpringApplication.run(CourseApiAPP.class, args);
}}
Tomcat started:
SpringApplication.run(App.class,args);
Spring boot starter create application context
This classes contains other meta based and behave based on that for that need to scan path
Controller: what URL mapping and what should happen request comes too.
Write method when called.
@RequestMapping: take parameter which is URL this method need to map to which is hello
It tells when its request /hello above method should be executed and return the value.
REST API:
@Service: it’s a business service
Spring Initializr is a web application that can generate a Spring Boot project
structure for you
Spring Initializr provides an extensible API to generate JVM-based projects,
and to inspect the metadata used to generate projects, for instance to list the
available dependencies and versions.
Run spring groovy script:
Nano app.groovy
When connect java application to relational database get results and convert to object
instance.
JPA help to configure entity classes and give to framework so that it does rest
Database added