Skip to content
master
Go to file
Code

Latest commit

…ramework.boot-spring-boot-starter-parent-2.3.1.RELEASE

Bump spring-boot-starter-parent from 2.3.0.RELEASE to 2.3.1.RELEASE
6f9adff

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

mybatis-spring-boot-jpetstore

Build Status Quality Gate Status Coverage Status

This sample is a web application built on MyBatis, Spring Boot(Spring MVC, Spring Security) and Thymeleaf. This is another implementation of MyBatis JPetStore sample application (https://github.com/mybatis/jpetstore-6).

Original application is available for downloading in the downloads section of MyBatis project site. In this section, we will walk through this sample to understand how is it built and learn how to run it.

Note:

This sample application is under development. If you found an issue, please report from here.

Demo

The Demo application is running on the Pivotal Web Services. Let's play on https://jpetstore.cfapps.io/.

Requirements

  • Java 8+ (JDK 1.8+)

Stacks

  • MyBatis Spring Boot Starter 2.1 (MyBatis 3.5, MyBatis Spring 2.0)
  • Spring Boot 2.3 (Spring Framework 5.2, Spring Security 5.3)
  • Thymeleaf 3.0
  • Hibernate Validator 6.1 (Bean Validation 2.0)
  • HSQLDB 2.5 (Embed Database)
  • Flyway 6.4 (DB Migration)
  • Tomcat 9.0 (Embed Application Server)
  • Groovy 2.5 (Use multiple line string on MyBatis Mapper method)
  • Lombok 1.18
  • Selenide 5.12
  • Selenium 3.141
  • etc ...

Run using Maven command

  • Clone this repository

    $ git clone https://github.com/kazuki43zoo/mybatis-spring-boot-jpetstore.git
    
  • Run a web application using the spring-boot-plugin

    $ cd mybatis-spring-boot-jpetstore.git
    $ ./mvnw clean spring-boot:run
    

Run using java command

  • Build a jar file

    $ ./mvnw clean package -DskipTests=true
    
  • Run java command

    $ java -jar target/mybatis-spring-boot-jpetstore-2.0.0-SNAPSHOT.jar
    

Perform integration test using Maven command

Perform integration tests for screen transition.

$ ./mvnw clean test

Run on IDEs (Note)

This sample use the Lombok to generate setter method, getter method and constructor. If this sample application run on your IDE, please install the Lombok. (see https://projectlombok.org/download.html)

And this application use the groovy language to use multiple line string on MyBatis Mapper method. If this sample application run on your IDE, please convert to groovy project and add src/main/groovy into source path. And if you use a STS(or Eclipse), please install the Groovy Eclipse plugin. About how install the Groovy Eclipse, please see as follow:

e.g.) multiple line string on MyBatis Mapper method

@Mapper
@CacheNamespace
interface CategoryMapper {

    @Select('''
        SELECT
            CATID AS categoryId,
            NAME,
            DESCN AS description
        FROM
            CATEGORY
        WHERE
            CATID = #{categoryId}
    ''')
    Category getCategory(String categoryId)

}

Access to the index page

http://localhost:8080/

Index Screen

Catalog Screen

Default active accounts (ID/PASSWORD)

  • j2ee/j2ee
  • ACID/ACID

Data Store

In this application, application data stored in filesystem files.

$HOME
  └── db
      + jpetstore.script
      + jpetstore.properties

Project Structure

Project structure of this sample application is as follow:

.
└── src
    └── main
        ├── groovy
        │   └── com
        │       └── kazuki43zoo
        │           └── jpetstore
        │               └── mapper         // Store mapper interfaces
        ├── java
        │   └── com
        │       └── kazuki43zoo
        │           └── jpetstore
        │               ├── component      // Store general component classes
        │               │   ├── event
        │               │   ├── exception
        │               │   ├── message
        │               │   └── validation
        │               ├── config         // Store configuration classes
        │               ├── domain         // Store domain objects
        │               ├── service        // Store service classes
        │               └── ui             // Store classes that depends user interface
        │                   └── controller // Store controller classes
        └── resources
            ├── db                         // Store sql files for Flyway
            │   └── migration
            ├── static                     // Store static web resource files
            │   ├── css
            │   └── images
            └── templates                  // Store view template files for Thymeleaf
                ├── account
                ├── auth
                ├── cart
                ├── catalog
                ├── error
                └── order
You can’t perform that action at this time.