React-SpringBoot
React-SpringBoot copied to clipboard
React + Spring Boot (Movie Helper)
React-SpringBoot
简体中文
Star History
Demo: Movie Helper
Desktop display

Recently, I improved the performance from 50 to 90.

Mobile display

Git clone repo
Back-end project: React-SpringBoot Front-end project: movie-helper-front
# cd React-SpringBoot/
git clone https://github.com/zzh1991/movie-helper-front.git
🚀 Usage
Support Java 17 and Spring Boot 3
# add VM options
--add-opens java.base/java.lang.invoke=ALL-UNNAMED
Start application
configure database
configure your database name (an empty database), user, password in src/main/resources/application.yml
You could use PostgreSQL(default configuration) or MySQL. Also, you could use H2 database.
MySQL configuration
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/movie?allowPublicKeyRetrieval=true&useConfigs=maxPerformance&useSSL=false&serverTimezone=UTC&characterEncoding=utf8
password: mysql
username: root
initialization-mode: never
flyway:
enabled: true
baseline-on-migrate: true
validate-on-migrate: false
locations: classpath:db/migration/mysql
remove postgres dependency and add mysql dependency in pom.xml
<!-- remove -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
<!-- add -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
Configure Front
cd movie-helper-frontnpm install: install dependency- prepare front static files
- dev mode
npm run dev
- Deploy mode
npm run deploy
- dev mode
- start the web app in IDE
- open browser
dev mode: go to http://localhost:3000deploy mode: go to http://localhost:8080
Update front end
cd movie-helper-front
git fetch origin master
git rebase origin/master
Java doc
mvn javadoc:javadoc
open
target/site/apidocs/index.htmlby browser
Reference
Todo
Improvement
- [x] sync recent / top movies
- [x] latest sync time
- [x] search by movie name
- [x] database upgrade
- [x] schedule task
- [x] java doc
- [x] lazy load
- [x] use timestamp with time zone
Dependency
Front end
Backend
- Spring Boot 3
- PostgresQL
- Guava
- Swagger
- Flyway
- Prometheus
- GraphQL
- Mybatis
- Mybatis-plus
Endpoints
Swagger UI
- http://localhost:8080/swagger-ui/index.html
Monitoring Endpoint
- http://localhost:8080/actuator
- http://localhost:8080/actuator/prometheus
GraphiQL Endpoint
- http://localhost:8080/graphiql
Configuration
Hot deploy for Intellij IDEA
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
- setting -> compiler -> make project automatically
- ctrl + shift + a -> registry -> auto make enabled
Active dev profile
- edit run/debug configuration
- add environment variables: spring.profiles.active=dev
Dependency Version Management
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
</plugin>
Display update
mvn versions:display-dependency-updates
Update dependency
mvn versions:use-next-releases
mvn versions:use-latest-releases
Problems
Migrate flyway 3.x to 5.x issue
firstly should migrate to 4.2.0 and then 5.x
H2 database conflict with druid?
Mybatis timestamptz could not convert to timestamp?
Refer to https://github.com/mybatis/mybatis-3/issues/1644
- copy
LocalDateTimeTypeHandler.javainto project - configure
LocalDateTimeTypeHandlerbean
Author
👤 Zhihao Zhang
- Github: @zzh1991
Show your support
Please ⭐️ this repository if this project helped you!