SlideShare una empresa de Scribd logo
1 de 57
Descargar para leer sin conexión
Spring Boot
2
JSUG 2020 2
@b1a9idps
Fashion Charity Project
Triangle Sauce
React
Spring Boot 2.0.0
1. 2018 3 1
2. 2018 8 1
3. 2019 2 1
1.2018 3 1
•
•
• Gradle
• Spring Cloud Config Server
• Spring Web
• Spring Data
• Spring Data JPA
• Flyway
• Testing
• Configuration Property Binding
•
※ Spring Boot 2.0.x 

1Q EOL
•
•
• Gradle
• Spring Cloud Config Server
• Spring Web
• Spring Data
• Spring Data JPA
• Flyway
• Testing
• Configuration Property Binding
•
Coiney
• admin-api
• API
• web-api
• Web
API
• mobile-api
•
API
• partner-api
•
API
• antisocial-force-
checker
• API
• emoney-api
• API
Cloud Config
Spring Boot Gradle
coiney-api 1.5.18 3.5.1
API
admin-api, web-api, mobile-
api
coiney-api-
config-server
1.5.9 2.9 Spring Cloud Config Server
coiney-emoney 1.5.16 3.5.1 API
antisocial-
force-checker
1.4.1 3.3 API
Spring Boot 2.0.x Gradle 4+
•
•
• Gradle
• Spring Cloud Config Server
• Spring Web
• Spring Data
• Spring Data JPA
• Flyway
• Testing
• Configuration Property Binding
•
Gradle 4.x
// build.gradle
wrapper {
gradleVersion = "4.10.2"
distributionType = Wrapper.DistributionType.ALL
}
$ ./gradlew wrapper
// Gradle 5.0
// —-warning-mode all
$ ./gradlew build —-warning-mode all
build.gradle
dependencies {
- compile "com.fasterxml.jackson.dataformat:jackson-dataformat-csv"
+ implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-csv"
}
Gradle4.7 compile
4.6 4.7
compile implementation
runtime runtimeOnly
testCompile testImplementation
testRuntime testRuntimeOnly
implementation
// foo
dependencies {
implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-csv"
}
// bar
dependencies {
implementation project (":foo")
}
bar jackson-dataformat-csv
•
• a-service b-service
c-service
...
• implementation api
• build.gradle
build.gradle
• Spring Boot Spring Boot
Lombok
- jar.baseName=hoge
+ archivesBaseName=hoge
Gradle5.1
Jar
// Spring Boot Gradle jar war
- bootRepackage {}
+ bootJar {}
•
•
• Gradle
• Spring Cloud Config Server
• Spring Web
• Spring Data
• Spring Data JPA
• Flyway
• Testing
• Configuration Property Binding
•
// 60
// 0
spring.cloud.config.server.git.refresh-rate=60
Git Refresh Rate
You can control how often the config server will fetch updated configuration
data from your Git backend by using spring.cloud.config.server.git.refreshRate.
The value of this property is specified in seconds. By default the value is 0,
meaning the config server will fetch updated configuration from the Git repo
every time it is requested.
[ ]
Spring Cloud Config Server 2.0.2
•
•
• Gradle
• Spring Cloud Config Server
• Spring Web
• Spring Data
• Spring Data JPA
• Flyway
• Testing
• Configuration Property Binding
•
@NotBlank, @NotEmpty, @Email
• 6.0.0.Final
• javax-validation
- import org.hibernate.validator.constraints.NotBlank;
+ import javax.validation.constraints.NotBlank;
Spring Boot Starter Json
• Jackson Auto-configuration
•
• jackson-databind
• jackson-datatype-jdk8
• jackson-datatype-jsr310
• jackson-module-parameter-names
WebMvcConfigurerAdapter.class
• Spring 5 Java8+ default
• WebMvcConfigurer.java
public class WebMvcConfig extends WebMvcConfigurerAdapter {}
public class WebMvcConfig implements WebMvcConfigurer {}
- import org.springframework.boot.autoconfigure.web.ErrorAttributes;
+ import org.springframework.boot.web.servlet.error.ErrorAttributes;
- import org.springframework.boot.autoconfigure.web.ErrorController;
+ import org.springframework.boot.web.servlet.error.ErrorController;
Spring Boot 2 Spring 5 Servlet Reactive
HtmlUtils.htmlEscape()
// 4.3.x
public static String htmlEscape(String input, String encoding) {
Assert.notNull(encoding, "Encoding is required");
if (input == null) {
return null;
}
// 5.0.x
public static String htmlEscape(String input, String encoding) {
Assert.notNull(input, "Input is required");
Assert.notNull(encoding, "Encoding is required");
input null Exception
•
•
• Gradle
• Spring Cloud Config Server
• Spring Web
• Spring Data
• Spring Data JPA
• Flyway
• Testing
• Configuration Property Binding
•
• Tomcat HikariCP
DataSource
• HikariCP DataSource
url jdbc-url
// application.properties
app.datasource.jdbc-url=jdbc:mysql://localhost/test
app.datasource.username=dbuser
app.datasource.password=dbpass
app.datasource.maximum-pool-size=30
@Bean
@ConfigurationProperties(prefix = "app.datasource")
public HikariDataSource dataSource() {
return DataSourceBuilder.create().type(HikariDataSource.class).build();
}
- new PageRequest(1, 10);
+ PageRequest.of(1, 10);
- new Sort(orders);
+ Sort.by(orders);
2.2.0 public
AWS X-Ray SQL HikariCP
tomcat-jdbc JdbcInterceptor
dependencies {
implementation("org.springframework.boot:spring-boot-starter-data-jpa") {
exclude group: 'com.zaxxer'
}
implementation "org.apache.tomcat:tomcat-jdbc"
}
•
•
• Gradle
• Spring Cloud Config Server
• Spring Web
• Spring Data
• Spring Data JPA
• Flyway
• Testing
• Configuration Property Binding
•
JpaRepository.java
// Optional
- User fidyByName(String name);
+ Optional<User> findByName(String name);
//
- <S extends T> List<S> save(Iterable<S> entities);
+ <S extends T> List<S> saveAll(Iterable<S> entities);
•
•
• Gradle
• Spring Cloud Config Server
• Spring Web
• Spring Data
• Spring Data JPA
• Flyway
• Testing
• Configuration Property Binding
•
Flyway
•
• Spring Boot
Flyway 3 -> 5
2019-09-11 03:43:15.152 ERROR --- Application startup failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path
resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Invocation of init
method failed; nested exception is org.flywaydb.core.api.FlywayException: Validate failed: Migration checksum mismatch for
migration 1
-> Applied to database : 1750005324
-> Resolved locally : -558371367
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.jav
a:1583)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:
545)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:
482)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:
230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:296)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1076)
at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:
851)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:371)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1186)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1175)
at com.b1a9idps.sample.view.Application.main(Application.java:19)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Flyway 3 -> 5
Important note for users upgrading from Flyway 3.x: 
This release no longer supports a schema history table upgrade from Flyway
3.x. You must upgrade to Flyway 4.2.0 first before upgrading to Flyway 5.0.0.
3 -> 4
4 -> 5
Flyway
schema_version flyway_schema_history
1. Flyway 4
2.
3. Flyway 5 Boot 2.0.9.RELEASE
4.
Flyway4
dependencies {
compile "org.flywaydb:flyway-core:4.2.0"
}
$ gradle bootRun
=====
2019-09-11 03:43:14.467 INFO --- Upgrading metadata table
`sample`.`schema_version` to the Flyway 4.0 format ...
2019-09-11 03:43:15.329 INFO --- Repairing metadata for version 1
(Description: CREATE TABLE SAMPLE DATA, Checksum: -558371367) ...
2019-09-11 03:43:15.349 INFO --- Repairing metadata for version 2
(Description: MODIFY SAMPLE DATA LENGTH, Checksum: -1031537806) ...
2019-09-11 03:43:15.370 INFO --- Repairing metadata for version 3
(Description: SAMPLE DATA ADD INDEX, Checksum: 194652164) ...
2019-09-11 03:43:15.412 INFO --- Metadata table schema_version successfully
upgraded to the Flyway 4.0 format.
schema_version
Flyway5
//
spring.flyway.table=schema_version
2019-09-25 23:05:33.882 WARN --- Could not find schema history table
`sample`.`flyway_schema_history`, but found `sample`.`schema_version` instead.
You are seeing this message because Flyway changed its default for flyway.table
in version 5.0.0 to flyway_schema_history and you are still relying on the old
default (schema_version). Set flyway.table=schema_version in your configuration
to fix this. This fallback mechanism will be removed in Flyway 6.0.0.
6
•
•
• Gradle
• Spring Cloud Config Server
• Spring Web
• Spring Data
• Spring Data JPA
• Flyway
• Testing
• Configuration Property Binding
•
JUnit
JUnit 5 Spring Boot Starter Test JUnit 4
Spring Boot 2.2.x JUnit 5
Mockito
1 2
AssertJ
2 3
- import org.mockito.runners.MockitoJUnitRunner;
+ import org.mockito.junit.MockitoJUnitRunner;
- import org.mockito.Matchers.*;
+ import org.mockito.ArgumentMatchers.*;
@ExtendWith(MockitoExtension.class)
class StubTest {
@Mock Hoge hoge;
@Test
void test() {
when(hoge.getName()).thenReturn("uchitate");
}
class Hoge {
String getName() { return "";}
}
}
Unnecessary stubbings detected.
Clean & maintainable test code requires zero unnecessary code.
Following stubbings are unnecessary (click to navigate to relevant line of code):
1. -> at com.coiney.StubTest.test(StubTest.java:18)
Please remove unnecessary stubbings or use 'lenient' strictness. More info: javadoc
for UnnecessaryStubbingException class.
org.mockito.exceptions.misusing.UnnecessaryStubbingException:
Unnecessary stubbings detected.
Clean & maintainable test code requires zero unnecessary code.
Following stubbings are unnecessary (click to navigate to relevant line of code):
1. -> at com.coiney.StubTest.test(StubTest.java:18)
Please remove unnecessary stubbings or use 'lenient' strictness. More info: javadoc
for UnnecessaryStubbingException class.
•
•
• Gradle
• Spring Cloud Config Server
• Spring Web
• Spring Data
• Spring Data JPA
• Flyway
• Testing
• Configuration Property Binding
•
Spring Boot 2.2.4
Environment
//
JsugPropsBinder binder = new JsugPropsBinder();
Binder.get(environment)
.bind("jsug.props-instance", Bindable.ofInstance(binder))
.get();
//
Binder.get(environment)
.bind("jsug.props-simple", Bindable.of(JsugPropsBinder.class))
.get();
// List<JsugPropsBinder>
Binder.get(environment)
.bind("jsug.props", Bindable.listOf(JsugPropsBinder.class))
.get();
public class JsugPropsBinder {
private List<String> speakerNames;
private String theme;
@DateTimeFormat(iso = DATE)
private LocalDate date;
}
key
Properties Yaml 1
@ConfigurationProperties prefix
Profile
jsug:
props:
list:
- name: uchitate
theme: SpringBoot2
---
spring:
profiles: dev
jsug:
props:
list:
- name: uchitate-dev
theme: SpringBoot2-dev
@ConfigurationProperties("jsug.props")
@ConstructorBinding
public class JsugProps {
private final List<Jsug> list;
public static class Jsug {
private String name;
private String theme;
}
}
Profile
// profile=default
{
"list": [
{
"name": "uchitate",
"theme": "SpringBoot2"
}
]
}
// profile=dev
{
"list": [
{
"name": "uchitate-dev",
"theme": "SpringBoot2-dev"
}
]
}
•
•
• Gradle
• Spring Cloud Config Server
• Spring Web
• Spring Data
• Spring Data JPA
• Flyway
• Testing
• Configuration Property Binding
•
•
•
•
•
• Gradle Lombok
note
https://note.com/b1a9idps/n/n0b9ca2ee57a2
決済サービスのSpring Bootのバージョンを2系に上げた話

Más contenido relacionado

La actualidad más candente

ReactiveだけじゃないSpring 5 & Spring Boot 2新機能解説
ReactiveだけじゃないSpring 5 & Spring Boot 2新機能解説ReactiveだけじゃないSpring 5 & Spring Boot 2新機能解説
ReactiveだけじゃないSpring 5 & Spring Boot 2新機能解説Masatoshi Tada
 
【Spring fest 2019】徹底解剖Spring MVCアーキテクチャー
【Spring fest 2019】徹底解剖Spring MVCアーキテクチャー【Spring fest 2019】徹底解剖Spring MVCアーキテクチャー
【Spring fest 2019】徹底解剖Spring MVCアーキテクチャーssuser070fa9
 
さくっと理解するSpring bootの仕組み
さくっと理解するSpring bootの仕組みさくっと理解するSpring bootの仕組み
さくっと理解するSpring bootの仕組みTakeshi Ogawa
 
Getting Started GraalVM / GraalVM超入門 #jjug_ccc #ccc_c2
Getting Started GraalVM / GraalVM超入門 #jjug_ccc #ccc_c2Getting Started GraalVM / GraalVM超入門 #jjug_ccc #ccc_c2
Getting Started GraalVM / GraalVM超入門 #jjug_ccc #ccc_c2tamtam180
 
これで怖くない!?コードリーディングで学ぶSpring Security #中央線Meetup
これで怖くない!?コードリーディングで学ぶSpring Security #中央線Meetupこれで怖くない!?コードリーディングで学ぶSpring Security #中央線Meetup
これで怖くない!?コードリーディングで学ぶSpring Security #中央線MeetupMasatoshi Tada
 
[Aurora事例祭り]Amazon Aurora を使いこなすためのベストプラクティス
[Aurora事例祭り]Amazon Aurora を使いこなすためのベストプラクティス[Aurora事例祭り]Amazon Aurora を使いこなすためのベストプラクティス
[Aurora事例祭り]Amazon Aurora を使いこなすためのベストプラクティスAmazon Web Services Japan
 
これから始めるSpringのwebアプリケーション
これから始めるSpringのwebアプリケーションこれから始めるSpringのwebアプリケーション
これから始めるSpringのwebアプリケーション土岐 孝平
 
Springを何となく使ってる人が抑えるべきポイント
Springを何となく使ってる人が抑えるべきポイントSpringを何となく使ってる人が抑えるべきポイント
Springを何となく使ってる人が抑えるべきポイント土岐 孝平
 
オブジェクト指向の設計と実装の学び方のコツ
オブジェクト指向の設計と実装の学び方のコツオブジェクト指向の設計と実装の学び方のコツ
オブジェクト指向の設計と実装の学び方のコツ増田 亨
 
ツール比較しながら語る O/RマッパーとDBマイグレーションの実際のところ
ツール比較しながら語る O/RマッパーとDBマイグレーションの実際のところツール比較しながら語る O/RマッパーとDBマイグレーションの実際のところ
ツール比較しながら語る O/RマッパーとDBマイグレーションの実際のところY Watanabe
 
マイクロサービス 4つの分割アプローチ
マイクロサービス 4つの分割アプローチマイクロサービス 4つの分割アプローチ
マイクロサービス 4つの分割アプローチ増田 亨
 
PostgreSQLクエリ実行の基礎知識 ~Explainを読み解こう~
PostgreSQLクエリ実行の基礎知識 ~Explainを読み解こう~PostgreSQLクエリ実行の基礎知識 ~Explainを読み解こう~
PostgreSQLクエリ実行の基礎知識 ~Explainを読み解こう~Miki Shimogai
 
Junitを使ったjavaのテスト入門
Junitを使ったjavaのテスト入門Junitを使ったjavaのテスト入門
Junitを使ったjavaのテスト入門Satoshi Kubo
 
やはりお前らのMVCは間違っている
やはりお前らのMVCは間違っているやはりお前らのMVCは間違っている
やはりお前らのMVCは間違っているKoichi Tanaka
 
オブジェクト指向エクササイズのススメ
オブジェクト指向エクササイズのススメオブジェクト指向エクササイズのススメ
オブジェクト指向エクササイズのススメYoji Kanno
 
SQLチューニング入門 入門編
SQLチューニング入門 入門編SQLチューニング入門 入門編
SQLチューニング入門 入門編Miki Shimogai
 
DBスキーマもバージョン管理したい!
DBスキーマもバージョン管理したい!DBスキーマもバージョン管理したい!
DBスキーマもバージョン管理したい!kwatch
 
例外設計における大罪
例外設計における大罪例外設計における大罪
例外設計における大罪Takuto Wada
 
Riverpodでテストを書こう
Riverpodでテストを書こうRiverpodでテストを書こう
Riverpodでテストを書こうShinnosuke Tokuda
 

La actualidad más candente (20)

ReactiveだけじゃないSpring 5 & Spring Boot 2新機能解説
ReactiveだけじゃないSpring 5 & Spring Boot 2新機能解説ReactiveだけじゃないSpring 5 & Spring Boot 2新機能解説
ReactiveだけじゃないSpring 5 & Spring Boot 2新機能解説
 
【Spring fest 2019】徹底解剖Spring MVCアーキテクチャー
【Spring fest 2019】徹底解剖Spring MVCアーキテクチャー【Spring fest 2019】徹底解剖Spring MVCアーキテクチャー
【Spring fest 2019】徹底解剖Spring MVCアーキテクチャー
 
さくっと理解するSpring bootの仕組み
さくっと理解するSpring bootの仕組みさくっと理解するSpring bootの仕組み
さくっと理解するSpring bootの仕組み
 
Getting Started GraalVM / GraalVM超入門 #jjug_ccc #ccc_c2
Getting Started GraalVM / GraalVM超入門 #jjug_ccc #ccc_c2Getting Started GraalVM / GraalVM超入門 #jjug_ccc #ccc_c2
Getting Started GraalVM / GraalVM超入門 #jjug_ccc #ccc_c2
 
これで怖くない!?コードリーディングで学ぶSpring Security #中央線Meetup
これで怖くない!?コードリーディングで学ぶSpring Security #中央線Meetupこれで怖くない!?コードリーディングで学ぶSpring Security #中央線Meetup
これで怖くない!?コードリーディングで学ぶSpring Security #中央線Meetup
 
SpringBootTest入門
SpringBootTest入門SpringBootTest入門
SpringBootTest入門
 
[Aurora事例祭り]Amazon Aurora を使いこなすためのベストプラクティス
[Aurora事例祭り]Amazon Aurora を使いこなすためのベストプラクティス[Aurora事例祭り]Amazon Aurora を使いこなすためのベストプラクティス
[Aurora事例祭り]Amazon Aurora を使いこなすためのベストプラクティス
 
これから始めるSpringのwebアプリケーション
これから始めるSpringのwebアプリケーションこれから始めるSpringのwebアプリケーション
これから始めるSpringのwebアプリケーション
 
Springを何となく使ってる人が抑えるべきポイント
Springを何となく使ってる人が抑えるべきポイントSpringを何となく使ってる人が抑えるべきポイント
Springを何となく使ってる人が抑えるべきポイント
 
オブジェクト指向の設計と実装の学び方のコツ
オブジェクト指向の設計と実装の学び方のコツオブジェクト指向の設計と実装の学び方のコツ
オブジェクト指向の設計と実装の学び方のコツ
 
ツール比較しながら語る O/RマッパーとDBマイグレーションの実際のところ
ツール比較しながら語る O/RマッパーとDBマイグレーションの実際のところツール比較しながら語る O/RマッパーとDBマイグレーションの実際のところ
ツール比較しながら語る O/RマッパーとDBマイグレーションの実際のところ
 
マイクロサービス 4つの分割アプローチ
マイクロサービス 4つの分割アプローチマイクロサービス 4つの分割アプローチ
マイクロサービス 4つの分割アプローチ
 
PostgreSQLクエリ実行の基礎知識 ~Explainを読み解こう~
PostgreSQLクエリ実行の基礎知識 ~Explainを読み解こう~PostgreSQLクエリ実行の基礎知識 ~Explainを読み解こう~
PostgreSQLクエリ実行の基礎知識 ~Explainを読み解こう~
 
Junitを使ったjavaのテスト入門
Junitを使ったjavaのテスト入門Junitを使ったjavaのテスト入門
Junitを使ったjavaのテスト入門
 
やはりお前らのMVCは間違っている
やはりお前らのMVCは間違っているやはりお前らのMVCは間違っている
やはりお前らのMVCは間違っている
 
オブジェクト指向エクササイズのススメ
オブジェクト指向エクササイズのススメオブジェクト指向エクササイズのススメ
オブジェクト指向エクササイズのススメ
 
SQLチューニング入門 入門編
SQLチューニング入門 入門編SQLチューニング入門 入門編
SQLチューニング入門 入門編
 
DBスキーマもバージョン管理したい!
DBスキーマもバージョン管理したい!DBスキーマもバージョン管理したい!
DBスキーマもバージョン管理したい!
 
例外設計における大罪
例外設計における大罪例外設計における大罪
例外設計における大罪
 
Riverpodでテストを書こう
Riverpodでテストを書こうRiverpodでテストを書こう
Riverpodでテストを書こう
 

Similar a 決済サービスのSpring Bootのバージョンを2系に上げた話

03 integrate webapisignalr
03 integrate webapisignalr03 integrate webapisignalr
03 integrate webapisignalrErhwen Kuo
 
Comparing Native Java REST API Frameworks - Devoxx France 2022
Comparing Native Java REST API Frameworks - Devoxx France 2022Comparing Native Java REST API Frameworks - Devoxx France 2022
Comparing Native Java REST API Frameworks - Devoxx France 2022Matt Raible
 
Comparing Native Java REST API Frameworks - Seattle JUG 2022
Comparing Native Java REST API Frameworks - Seattle JUG 2022Comparing Native Java REST API Frameworks - Seattle JUG 2022
Comparing Native Java REST API Frameworks - Seattle JUG 2022Matt Raible
 
Spring5 New Features
Spring5 New FeaturesSpring5 New Features
Spring5 New FeaturesJay Lee
 
Spring Boot in Action
Spring Boot in Action Spring Boot in Action
Spring Boot in Action Alex Movila
 
Spring Performance Gains
Spring Performance GainsSpring Performance Gains
Spring Performance GainsVMware Tanzu
 
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 -  Fullstack end-to-end Test Automation with node.jsForwardJS 2017 -  Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.jsMek Srunyu Stittri
 
Spring boot Introduction
Spring boot IntroductionSpring boot Introduction
Spring boot IntroductionJeevesh Pandey
 
Java 6 [Mustang] - Features and Enchantments
Java 6 [Mustang] - Features and Enchantments Java 6 [Mustang] - Features and Enchantments
Java 6 [Mustang] - Features and Enchantments Pavel Kaminsky
 
Spring Boot アプリケーションの起動をほんの少し気持ちだけ速くしてみた
Spring Boot アプリケーションの起動をほんの少し気持ちだけ速くしてみたSpring Boot アプリケーションの起動をほんの少し気持ちだけ速くしてみた
Spring Boot アプリケーションの起動をほんの少し気持ちだけ速くしてみたShinya Mochida
 
When Web meet Native App
When Web meet Native AppWhen Web meet Native App
When Web meet Native AppYu-Wei Chuang
 
Building microservices sample application
Building microservices sample applicationBuilding microservices sample application
Building microservices sample applicationAnil Allewar
 
Play Framework on Google App Engine
Play Framework on Google App EnginePlay Framework on Google App Engine
Play Framework on Google App EngineFred Lin
 
Walking Through Spring Cloud Data Flow
Walking Through Spring Cloud Data FlowWalking Through Spring Cloud Data Flow
Walking Through Spring Cloud Data FlowVMware Tanzu
 
20151010 my sq-landjavav2a
20151010 my sq-landjavav2a20151010 my sq-landjavav2a
20151010 my sq-landjavav2aIvan Ma
 
Integrating Wicket with Java EE 6
Integrating Wicket with Java EE 6Integrating Wicket with Java EE 6
Integrating Wicket with Java EE 6Michael Plöd
 
Grails Plugin Best Practices
Grails Plugin Best PracticesGrails Plugin Best Practices
Grails Plugin Best PracticesBurt Beckwith
 

Similar a 決済サービスのSpring Bootのバージョンを2系に上げた話 (20)

Story ofcorespring infodeck
Story ofcorespring infodeckStory ofcorespring infodeck
Story ofcorespring infodeck
 
03 integrate webapisignalr
03 integrate webapisignalr03 integrate webapisignalr
03 integrate webapisignalr
 
Comparing Native Java REST API Frameworks - Devoxx France 2022
Comparing Native Java REST API Frameworks - Devoxx France 2022Comparing Native Java REST API Frameworks - Devoxx France 2022
Comparing Native Java REST API Frameworks - Devoxx France 2022
 
Comparing Native Java REST API Frameworks - Seattle JUG 2022
Comparing Native Java REST API Frameworks - Seattle JUG 2022Comparing Native Java REST API Frameworks - Seattle JUG 2022
Comparing Native Java REST API Frameworks - Seattle JUG 2022
 
Spring5 New Features
Spring5 New FeaturesSpring5 New Features
Spring5 New Features
 
Spring Boot in Action
Spring Boot in Action Spring Boot in Action
Spring Boot in Action
 
Spring Performance Gains
Spring Performance GainsSpring Performance Gains
Spring Performance Gains
 
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 -  Fullstack end-to-end Test Automation with node.jsForwardJS 2017 -  Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.js
 
Spring boot Introduction
Spring boot IntroductionSpring boot Introduction
Spring boot Introduction
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
สปริงเฟรมเวิร์ค4.1
สปริงเฟรมเวิร์ค4.1สปริงเฟรมเวิร์ค4.1
สปริงเฟรมเวิร์ค4.1
 
Java 6 [Mustang] - Features and Enchantments
Java 6 [Mustang] - Features and Enchantments Java 6 [Mustang] - Features and Enchantments
Java 6 [Mustang] - Features and Enchantments
 
Spring Boot アプリケーションの起動をほんの少し気持ちだけ速くしてみた
Spring Boot アプリケーションの起動をほんの少し気持ちだけ速くしてみたSpring Boot アプリケーションの起動をほんの少し気持ちだけ速くしてみた
Spring Boot アプリケーションの起動をほんの少し気持ちだけ速くしてみた
 
When Web meet Native App
When Web meet Native AppWhen Web meet Native App
When Web meet Native App
 
Building microservices sample application
Building microservices sample applicationBuilding microservices sample application
Building microservices sample application
 
Play Framework on Google App Engine
Play Framework on Google App EnginePlay Framework on Google App Engine
Play Framework on Google App Engine
 
Walking Through Spring Cloud Data Flow
Walking Through Spring Cloud Data FlowWalking Through Spring Cloud Data Flow
Walking Through Spring Cloud Data Flow
 
20151010 my sq-landjavav2a
20151010 my sq-landjavav2a20151010 my sq-landjavav2a
20151010 my sq-landjavav2a
 
Integrating Wicket with Java EE 6
Integrating Wicket with Java EE 6Integrating Wicket with Java EE 6
Integrating Wicket with Java EE 6
 
Grails Plugin Best Practices
Grails Plugin Best PracticesGrails Plugin Best Practices
Grails Plugin Best Practices
 

Más de Ryosuke Uchitate

Form認証で学ぶSpring Security入門
Form認証で学ぶSpring Security入門Form認証で学ぶSpring Security入門
Form認証で学ぶSpring Security入門Ryosuke Uchitate
 
パラレルキャリアがもたらす相乗効果
パラレルキャリアがもたらす相乗効果パラレルキャリアがもたらす相乗効果
パラレルキャリアがもたらす相乗効果Ryosuke Uchitate
 
Micrometerでメトリクスを収集してAmazon CloudWatchで可視化
Micrometerでメトリクスを収集してAmazon CloudWatchで可視化Micrometerでメトリクスを収集してAmazon CloudWatchで可視化
Micrometerでメトリクスを収集してAmazon CloudWatchで可視化Ryosuke Uchitate
 
オレはIntelliJ IDEAをこう使っている
 オレはIntelliJ IDEAをこう使っている オレはIntelliJ IDEAをこう使っている
オレはIntelliJ IDEAをこう使っているRyosuke Uchitate
 
Amazon Cognito使って認証したい?それならSpring Security使いましょう!
Amazon Cognito使って認証したい?それならSpring Security使いましょう!Amazon Cognito使って認証したい?それならSpring Security使いましょう!
Amazon Cognito使って認証したい?それならSpring Security使いましょう!Ryosuke Uchitate
 
春だしBannerで遊バナいか?
春だしBannerで遊バナいか?春だしBannerで遊バナいか?
春だしBannerで遊バナいか?Ryosuke Uchitate
 
ユニットテストのアサーション 流れるようなインターフェースのAssertJを添えて 入門者仕立て
ユニットテストのアサーション 流れるようなインターフェースのAssertJを添えて 入門者仕立てユニットテストのアサーション 流れるようなインターフェースのAssertJを添えて 入門者仕立て
ユニットテストのアサーション 流れるようなインターフェースのAssertJを添えて 入門者仕立てRyosuke Uchitate
 
Spring超入門-Springと出会ってから1年半-
Spring超入門-Springと出会ってから1年半-Spring超入門-Springと出会ってから1年半-
Spring超入門-Springと出会ってから1年半-Ryosuke Uchitate
 
Spring starterによるSpring Boot Starter
Spring starterによるSpring Boot StarterSpring starterによるSpring Boot Starter
Spring starterによるSpring Boot StarterRyosuke Uchitate
 

Más de Ryosuke Uchitate (9)

Form認証で学ぶSpring Security入門
Form認証で学ぶSpring Security入門Form認証で学ぶSpring Security入門
Form認証で学ぶSpring Security入門
 
パラレルキャリアがもたらす相乗効果
パラレルキャリアがもたらす相乗効果パラレルキャリアがもたらす相乗効果
パラレルキャリアがもたらす相乗効果
 
Micrometerでメトリクスを収集してAmazon CloudWatchで可視化
Micrometerでメトリクスを収集してAmazon CloudWatchで可視化Micrometerでメトリクスを収集してAmazon CloudWatchで可視化
Micrometerでメトリクスを収集してAmazon CloudWatchで可視化
 
オレはIntelliJ IDEAをこう使っている
 オレはIntelliJ IDEAをこう使っている オレはIntelliJ IDEAをこう使っている
オレはIntelliJ IDEAをこう使っている
 
Amazon Cognito使って認証したい?それならSpring Security使いましょう!
Amazon Cognito使って認証したい?それならSpring Security使いましょう!Amazon Cognito使って認証したい?それならSpring Security使いましょう!
Amazon Cognito使って認証したい?それならSpring Security使いましょう!
 
春だしBannerで遊バナいか?
春だしBannerで遊バナいか?春だしBannerで遊バナいか?
春だしBannerで遊バナいか?
 
ユニットテストのアサーション 流れるようなインターフェースのAssertJを添えて 入門者仕立て
ユニットテストのアサーション 流れるようなインターフェースのAssertJを添えて 入門者仕立てユニットテストのアサーション 流れるようなインターフェースのAssertJを添えて 入門者仕立て
ユニットテストのアサーション 流れるようなインターフェースのAssertJを添えて 入門者仕立て
 
Spring超入門-Springと出会ってから1年半-
Spring超入門-Springと出会ってから1年半-Spring超入門-Springと出会ってから1年半-
Spring超入門-Springと出会ってから1年半-
 
Spring starterによるSpring Boot Starter
Spring starterによるSpring Boot StarterSpring starterによるSpring Boot Starter
Spring starterによるSpring Boot Starter
 

Último

Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayEpec Engineered Technologies
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Arindam Chakraborty, Ph.D., P.E. (CA, TX)
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptxJIT KUMAR GUPTA
 
Engineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planesEngineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planesRAJNEESHKUMAR341697
 
Verification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptxVerification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptxchumtiyababu
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueBhangaleSonal
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTbhaskargani46
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfJiananWang21
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"mphochane1998
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationBhangaleSonal
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARKOUSTAV SARKAR
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiessarkmank1
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Servicemeghakumariji156
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdfKamal Acharya
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaOmar Fathy
 
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxmaisarahman1
 

Último (20)

Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 
Engineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planesEngineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planes
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
Verification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptxVerification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptx
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and properties
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
 

決済サービスのSpring Bootのバージョンを2系に上げた話

  • 3. Spring Boot 2.0.0 1. 2018 3 1 2. 2018 8 1 3. 2019 2 1
  • 5. • • • Gradle • Spring Cloud Config Server • Spring Web • Spring Data • Spring Data JPA • Flyway • Testing • Configuration Property Binding •
  • 6. ※ Spring Boot 2.0.x 
 1Q EOL
  • 7. • • • Gradle • Spring Cloud Config Server • Spring Web • Spring Data • Spring Data JPA • Flyway • Testing • Configuration Property Binding •
  • 8. Coiney • admin-api • API • web-api • Web API • mobile-api • API • partner-api • API • antisocial-force- checker • API • emoney-api • API Cloud Config
  • 9. Spring Boot Gradle coiney-api 1.5.18 3.5.1 API admin-api, web-api, mobile- api coiney-api- config-server 1.5.9 2.9 Spring Cloud Config Server coiney-emoney 1.5.16 3.5.1 API antisocial- force-checker 1.4.1 3.3 API Spring Boot 2.0.x Gradle 4+
  • 10.
  • 11. • • • Gradle • Spring Cloud Config Server • Spring Web • Spring Data • Spring Data JPA • Flyway • Testing • Configuration Property Binding •
  • 12. Gradle 4.x // build.gradle wrapper { gradleVersion = "4.10.2" distributionType = Wrapper.DistributionType.ALL } $ ./gradlew wrapper // Gradle 5.0 // —-warning-mode all $ ./gradlew build —-warning-mode all
  • 13. build.gradle dependencies { - compile "com.fasterxml.jackson.dataformat:jackson-dataformat-csv" + implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-csv" } Gradle4.7 compile 4.6 4.7 compile implementation runtime runtimeOnly testCompile testImplementation testRuntime testRuntimeOnly
  • 14. implementation // foo dependencies { implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-csv" } // bar dependencies { implementation project (":foo") } bar jackson-dataformat-csv
  • 15.
  • 17. • implementation api • build.gradle build.gradle • Spring Boot Spring Boot Lombok
  • 19. Jar // Spring Boot Gradle jar war - bootRepackage {} + bootJar {}
  • 20. • • • Gradle • Spring Cloud Config Server • Spring Web • Spring Data • Spring Data JPA • Flyway • Testing • Configuration Property Binding •
  • 21. // 60 // 0 spring.cloud.config.server.git.refresh-rate=60 Git Refresh Rate You can control how often the config server will fetch updated configuration data from your Git backend by using spring.cloud.config.server.git.refreshRate. The value of this property is specified in seconds. By default the value is 0, meaning the config server will fetch updated configuration from the Git repo every time it is requested. [ ] Spring Cloud Config Server 2.0.2
  • 22. • • • Gradle • Spring Cloud Config Server • Spring Web • Spring Data • Spring Data JPA • Flyway • Testing • Configuration Property Binding •
  • 23. @NotBlank, @NotEmpty, @Email • 6.0.0.Final • javax-validation - import org.hibernate.validator.constraints.NotBlank; + import javax.validation.constraints.NotBlank;
  • 24. Spring Boot Starter Json • Jackson Auto-configuration • • jackson-databind • jackson-datatype-jdk8 • jackson-datatype-jsr310 • jackson-module-parameter-names
  • 25. WebMvcConfigurerAdapter.class • Spring 5 Java8+ default • WebMvcConfigurer.java public class WebMvcConfig extends WebMvcConfigurerAdapter {} public class WebMvcConfig implements WebMvcConfigurer {}
  • 26. - import org.springframework.boot.autoconfigure.web.ErrorAttributes; + import org.springframework.boot.web.servlet.error.ErrorAttributes; - import org.springframework.boot.autoconfigure.web.ErrorController; + import org.springframework.boot.web.servlet.error.ErrorController; Spring Boot 2 Spring 5 Servlet Reactive
  • 27. HtmlUtils.htmlEscape() // 4.3.x public static String htmlEscape(String input, String encoding) { Assert.notNull(encoding, "Encoding is required"); if (input == null) { return null; } // 5.0.x public static String htmlEscape(String input, String encoding) { Assert.notNull(input, "Input is required"); Assert.notNull(encoding, "Encoding is required"); input null Exception
  • 28. • • • Gradle • Spring Cloud Config Server • Spring Web • Spring Data • Spring Data JPA • Flyway • Testing • Configuration Property Binding •
  • 30. DataSource • HikariCP DataSource url jdbc-url // application.properties app.datasource.jdbc-url=jdbc:mysql://localhost/test app.datasource.username=dbuser app.datasource.password=dbpass app.datasource.maximum-pool-size=30 @Bean @ConfigurationProperties(prefix = "app.datasource") public HikariDataSource dataSource() { return DataSourceBuilder.create().type(HikariDataSource.class).build(); }
  • 31. - new PageRequest(1, 10); + PageRequest.of(1, 10); - new Sort(orders); + Sort.by(orders); 2.2.0 public
  • 32. AWS X-Ray SQL HikariCP
  • 33. tomcat-jdbc JdbcInterceptor dependencies { implementation("org.springframework.boot:spring-boot-starter-data-jpa") { exclude group: 'com.zaxxer' } implementation "org.apache.tomcat:tomcat-jdbc" }
  • 34. • • • Gradle • Spring Cloud Config Server • Spring Web • Spring Data • Spring Data JPA • Flyway • Testing • Configuration Property Binding •
  • 35. JpaRepository.java // Optional - User fidyByName(String name); + Optional<User> findByName(String name); // - <S extends T> List<S> save(Iterable<S> entities); + <S extends T> List<S> saveAll(Iterable<S> entities);
  • 36. • • • Gradle • Spring Cloud Config Server • Spring Web • Spring Data • Spring Data JPA • Flyway • Testing • Configuration Property Binding •
  • 38. Flyway 3 -> 5 2019-09-11 03:43:15.152 ERROR --- Application startup failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Invocation of init method failed; nested exception is org.flywaydb.core.api.FlywayException: Validate failed: Migration checksum mismatch for migration 1 -> Applied to database : 1750005324 -> Resolved locally : -558371367 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.jav a:1583) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java: 545) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java: 482) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java: 230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:296) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1076) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java: 851) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:371) at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1186) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1175) at com.b1a9idps.sample.view.Application.main(Application.java:19) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  • 39. Flyway 3 -> 5 Important note for users upgrading from Flyway 3.x:  This release no longer supports a schema history table upgrade from Flyway 3.x. You must upgrade to Flyway 4.2.0 first before upgrading to Flyway 5.0.0. 3 -> 4 4 -> 5 Flyway schema_version flyway_schema_history
  • 40. 1. Flyway 4 2. 3. Flyway 5 Boot 2.0.9.RELEASE 4.
  • 41. Flyway4 dependencies { compile "org.flywaydb:flyway-core:4.2.0" } $ gradle bootRun ===== 2019-09-11 03:43:14.467 INFO --- Upgrading metadata table `sample`.`schema_version` to the Flyway 4.0 format ... 2019-09-11 03:43:15.329 INFO --- Repairing metadata for version 1 (Description: CREATE TABLE SAMPLE DATA, Checksum: -558371367) ... 2019-09-11 03:43:15.349 INFO --- Repairing metadata for version 2 (Description: MODIFY SAMPLE DATA LENGTH, Checksum: -1031537806) ... 2019-09-11 03:43:15.370 INFO --- Repairing metadata for version 3 (Description: SAMPLE DATA ADD INDEX, Checksum: 194652164) ... 2019-09-11 03:43:15.412 INFO --- Metadata table schema_version successfully upgraded to the Flyway 4.0 format. schema_version
  • 43. 2019-09-25 23:05:33.882 WARN --- Could not find schema history table `sample`.`flyway_schema_history`, but found `sample`.`schema_version` instead. You are seeing this message because Flyway changed its default for flyway.table in version 5.0.0 to flyway_schema_history and you are still relying on the old default (schema_version). Set flyway.table=schema_version in your configuration to fix this. This fallback mechanism will be removed in Flyway 6.0.0. 6
  • 44. • • • Gradle • Spring Cloud Config Server • Spring Web • Spring Data • Spring Data JPA • Flyway • Testing • Configuration Property Binding •
  • 45. JUnit JUnit 5 Spring Boot Starter Test JUnit 4 Spring Boot 2.2.x JUnit 5 Mockito 1 2 AssertJ 2 3
  • 46. - import org.mockito.runners.MockitoJUnitRunner; + import org.mockito.junit.MockitoJUnitRunner; - import org.mockito.Matchers.*; + import org.mockito.ArgumentMatchers.*;
  • 47. @ExtendWith(MockitoExtension.class) class StubTest { @Mock Hoge hoge; @Test void test() { when(hoge.getName()).thenReturn("uchitate"); } class Hoge { String getName() { return "";} } } Unnecessary stubbings detected. Clean & maintainable test code requires zero unnecessary code. Following stubbings are unnecessary (click to navigate to relevant line of code): 1. -> at com.coiney.StubTest.test(StubTest.java:18) Please remove unnecessary stubbings or use 'lenient' strictness. More info: javadoc for UnnecessaryStubbingException class. org.mockito.exceptions.misusing.UnnecessaryStubbingException: Unnecessary stubbings detected. Clean & maintainable test code requires zero unnecessary code. Following stubbings are unnecessary (click to navigate to relevant line of code): 1. -> at com.coiney.StubTest.test(StubTest.java:18) Please remove unnecessary stubbings or use 'lenient' strictness. More info: javadoc for UnnecessaryStubbingException class.
  • 48. • • • Gradle • Spring Cloud Config Server • Spring Web • Spring Data • Spring Data JPA • Flyway • Testing • Configuration Property Binding •
  • 50. Environment // JsugPropsBinder binder = new JsugPropsBinder(); Binder.get(environment) .bind("jsug.props-instance", Bindable.ofInstance(binder)) .get(); // Binder.get(environment) .bind("jsug.props-simple", Bindable.of(JsugPropsBinder.class)) .get(); // List<JsugPropsBinder> Binder.get(environment) .bind("jsug.props", Bindable.listOf(JsugPropsBinder.class)) .get(); public class JsugPropsBinder { private List<String> speakerNames; private String theme; @DateTimeFormat(iso = DATE) private LocalDate date; }
  • 52. Profile jsug: props: list: - name: uchitate theme: SpringBoot2 --- spring: profiles: dev jsug: props: list: - name: uchitate-dev theme: SpringBoot2-dev @ConfigurationProperties("jsug.props") @ConstructorBinding public class JsugProps { private final List<Jsug> list; public static class Jsug { private String name; private String theme; } }
  • 53. Profile // profile=default { "list": [ { "name": "uchitate", "theme": "SpringBoot2" } ] } // profile=dev { "list": [ { "name": "uchitate-dev", "theme": "SpringBoot2-dev" } ] }
  • 54. • • • Gradle • Spring Cloud Config Server • Spring Web • Spring Data • Spring Data JPA • Flyway • Testing • Configuration Property Binding •