Ten ways to become a better developer

  1. Read other people’s code. ☑
  2. Get someone to read your code. ☑
  3. Fix bugs before writing new code. ☑
  4. Learn a new technology. ☑
  5. Keep it stupid simple (KISS). ☑
  6. Write a blog post about your code. ☑
  7. Contribute to open source. ☑
  8. Fix it, don’t hack it. ☑
  9. Increase code coverage by 1%. ☑
  10. Leave your desk every hour.

Source: https://stephenhaunts.files.wordpress.com/2014/04/10-ways-to-be-a-better-developer.png

Note on migrating Spring Boot 1.5 to 2.0

Spring Framework Logo

1. Useful links
First of all, you should read recommended links:

2. Tips and solution for problems

  • Table ‘hibernate_sequence’ doesn’t exist

Solution: Add config spring.jpa.properties.hibernate.id.new_generator_mappings=false

  • Spring Boot 2.0 use HikariCP by default, so you should add config for HikariCP

Solution:

Add config

spring.datasource.hikari.max-lifetime={max-lifetime-value}
spring.datasource.hikari.idle-timeout={idle-timeout-value}

Note:
– Value for config must be in millisecond.
– spring.datasource.hikari.idle-timeout < spring.datasource.hikari.max-lifetime < database wait_timeout
– For MySQL/MariaDB, use query SHOW GLOBAL VARIABLES LIKE 'wait_timeout'; to get wait_timeout, this value is in second
– For example, database wait_timeout = 600 second, so I can assign value as below:
spring.datasource.hikari.max-lifetime=500000
spring.datasource.hikari.idle-timeout=400000

  • Use MariaDB driver for MariaDB instead of MySQL Driver

Solution:
Step 1: Remove MySQL Driver:
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
Step 2: Add MariaDB Driver:
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<scope>runtime</scope>
</dependency>
Step 3: Change database connection URL: change from jdbc:mysql://... to jdbc:mariadb://...

%d bloggers like this: