[JAVA] [For internal use] For those assigned to the Spring Boot project (under construction)

This agenda is used to explain to employees who have been assigned to Spring Boot for the first time.

Prerequisite knowledge

Development environment

Target

Aim to be able to:

Library description

Spring Boot

MyBatis

Thmeleaf

What is Maven

[For super beginners] Maven super introduction

Specific explanation

1. Explanation of folder structure

Spring and MVC

1. Add screen

procedure

  1. Place the HTML in the src / main / static / template folder
  2. Create a method in Controller class that returns the created HTML

SampleController.java


public ModelAndView index(ModelAndView mav) {
    mav.setViewName("sample");
    return mav;
}

point

2. Add Restful API

POST API

POST API (file upload)

Restful API https://qiita.com/TakahiRoyte/items/949f4e88caecb02119aa

3. Access DB with MyBatis

MyBatis Official Website

XML

DAO class

  1. Spring Security Spring Security Reference Thymeleaf + Spring Security integration basics

SecurityConfig.java

Set the following items, etc.

Thymeleaf

5. How to use Maven

Settings on existing system

Maven update in eclipse

After modifying pom.xml, update it with" Right-click project> Maven> Update project ".

Generate jar file (for deployment)

6. Spring Boot related

application.properties https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html

Profile https://area-b.com/blog/2015/01/30/2316/ http://endok.hatenablog.com/entry/2016/06/12/181900 https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-profiles.html

Settings on existing system

Deployment method

  1. Run mvn install -Dmaven.test.skip = true with the command to generate the jar file
  1. Start the server with the java command

Log settings for existing projects

JUnit

Spring @autowired


Exercise

Prerequisites

Database

create_table.sql


CREATE table user (
  SERIAL user_id NOT NULL,
  TEXT user_name NOT NULL,
  TEXT section NOT NULL,
  PRIMARY KEY (user_id)
);

Add Controller class

Creating an HTML file

Create sample.html and display the contents of sample.html with URL /sample.html

Create GET API (1 parameter)

Create GET API (pass one piece of information)

Create GET API (pass multiple information)

Create POST API

Create POST API (file upload)

Access to database

SELECT with ʻuser_id`

SELECT by user name or department

ʻUser` INSERT into table

Store information in a hierarchical class with a single SELECT statement

Maven

Modify pom.xml to use external library

Generate a jar file and start the server with the java command

Check the log

Sentence problem

HTTP

Database

HelloWorld

Addition of Restful API

@RequestBody, @RequestParam, etc.

file upload

Introduction of MyBatis

Spring Boot Thorough Introduction Chapter 14 Sample Web System

Servlet issues

[Supplement] Comparison with Terasoluna

Recommended Posts

[For internal use] For those assigned to the Spring Boot project (under construction)
Deploy the Spring Boot project to Tomcat on XAMPP
For those who want to use MySQL for the database in the environment construction of Rails6 ~.
Spring Boot for the first time
Use DBUnit for Spring Boot test
How to use ModelMapper (Spring boot)
How to make a hinadan for a Spring Boot project using SPRING INITIALIZR
How to use MyBatis2 (iBatis) with Spring Boot 1.4 (Spring 4)
How to use Spring Boot session attributes (@SessionAttributes)
[Spring Boot] How to refer to the property file
View the Gradle task in the Spring Boot project
Plans to support JDK 11 for Eclipse and Spring Boot
Settings for connecting to MySQL with Spring Boot + Spring JDBC
How to set Dependency Injection (DI) for Spring Boot
05. I tried to stub the source of Spring Boot
How to create a Spring Boot project in IntelliJ
I tried to reduce the capacity of Spring Boot
[For those who create portfolios] How to use font-awesome-rails
How to use CommandLineRunner in Spring Batch of Spring Boot
How to use the same Mapper class in multiple data sources with Spring Boot + MyBatis
I want to control the maximum file size in file upload for each URL in Spring Boot
The story of raising Spring Boot from 1.5 series to 2.1 series part2
Steps required to issue an asynchronous event for Spring Boot
About the function of Spring Boot due to different versions
Change the injection target for each environment with Spring Boot 2
Deploy Spring Boot applications to Heroku without using the Heroku CLI
[Java] Deploy the Spring Boot application to Azure App Service
Deploy the application created by Spring Boot to Heroku (public) ②
[For those who create portfolios] How to use chart kick
How to call and use API in Java (Spring Boot)
Deploy the application created by Spring Boot to Heroku (public) ①
Use Spring Test + Mockito + JUnit 4 for Spring Boot + Spring Retry unit tests
Use @ControllerAdvice, @ExceptionHandler, HandlerExceptionResolver in Spring Boot to catch exceptions
[Java] Sample project for developing web applications with Spring Boot
[Spring Boot] Environment construction (macOS)
Try Spring Boot from 0 to 100.
Introduction to Spring Boot ① ~ DI ~
Introduction to Spring Boot ② ~ AOP ~
Spring Boot + Springfox springfox-boot-starter 3.0.0 Use
Use Spring JDBC with Spring Boot
Docker × Spring Boot environment construction
Introduction to Spring Boot Part 1
Spring Boot for annotation learning
Be aware that the default for Spring boot redirect is http
What I did in the migration from Spring Boot 1.4 series to 2.0 series
What I did in the migration from Spring Boot 1.5 series to 2.0 series
I want to control the default error message of Spring Boot
[For those who create portfolios] How to use binding.pry with Docker