Spring Boot Learning
To create
stand alone
spring project with
minimal Spring configuration. It has
Embeded Tomcat, Jetty or Undertow
directly (no need to deploy WAR files)
spring-boot-projects
Topics
- Quickly develop Spring Boot App
- Rest API using Spring Boot
- Spring Mvc app with spring boot with thymeleaf
- CRUD development with spring boot
Spring Initializer
Spring Initializer
quickstart
Annotations:
@SpringBootApplication : For
@Configuration,@EnableAutoConfiguration,@ComponentScan
If you want to scan other packages :
@SpringBootApplication(ScanBasePackages = {"pkg.name",..}
@RestController
@Controller
SpringApplication class creates Application context and register
all bean.
To create jar/war
mvn clean compile test
mvn package
To run
mvn spring-boot:run mycoolapp(or)
java >jar mycoolapp
Spring Boot Dependencies
spring-boot-dev-tools
To restart server automatically if any code changes occur.
spring-boot-starter-actuator
To monitor and manage applications and to check health,info of app
metrics.
Endpoints:
/actuator/health exposed automatically
spring-boot-actuator
endpoints.
spring-boot-starter-security
To enable security for endpoints. configure security
Auto generated password for development
spring-boot-starter-web
For spring mvc web app support
spring-boot-starter-data-jpa
It enables crud operations automatically based on entity and id type
mentioning in JPARepository interface.
mysql-connector-java
mysql connector -> search for datasource in application.properties
spring-boot-starter-data-rest
It enables rest endpoints automatically based on entity name
spring-boot-starter-thymeleaf
Spring Boot Properties:
application-properties
json
visualizer for chrome