SlideShare a Scribd company logo
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+
決済サービスのSpring Bootのバージョンを2系に上げた話
•
•
• 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
決済サービスのSpring Bootのバージョンを2系に上げた話
•
• 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系に上げた話
Ad

More Related Content

What's hot (20)

入社1年目のプログラミング初心者がSpringを学ぶための手引き
入社1年目のプログラミング初心者がSpringを学ぶための手引き入社1年目のプログラミング初心者がSpringを学ぶための手引き
入社1年目のプログラミング初心者がSpringを学ぶための手引き
土岐 孝平
 
DDDのモデリングとは何なのか、 そしてどうコードに落とすのか
DDDのモデリングとは何なのか、 そしてどうコードに落とすのかDDDのモデリングとは何なのか、 そしてどうコードに落とすのか
DDDのモデリングとは何なのか、 そしてどうコードに落とすのか
Koichiro Matsuoka
 
今こそ知りたいSpring Batch(Spring Fest 2020講演資料)
今こそ知りたいSpring Batch(Spring Fest 2020講演資料)今こそ知りたいSpring Batch(Spring Fest 2020講演資料)
今こそ知りたいSpring Batch(Spring Fest 2020講演資料)
NTT DATA Technology & Innovation
 
怖くないSpring Bootのオートコンフィグレーション
怖くないSpring Bootのオートコンフィグレーション怖くないSpring Bootのオートコンフィグレーション
怖くないSpring Bootのオートコンフィグレーション
土岐 孝平
 
Spring bootでweb セキュリティ(ログイン認証)編
Spring bootでweb セキュリティ(ログイン認証)編Spring bootでweb セキュリティ(ログイン認証)編
Spring bootでweb セキュリティ(ログイン認証)編
なべ
 
Tackling Complexity
Tackling ComplexityTackling Complexity
Tackling Complexity
Yoshitaka Kawashima
 
オブジェクト指向の設計と実装の学び方のコツ
オブジェクト指向の設計と実装の学び方のコツオブジェクト指向の設計と実装の学び方のコツ
オブジェクト指向の設計と実装の学び方のコツ
増田 亨
 
今こそ知りたいSpring Web(Spring Fest 2020講演資料)
今こそ知りたいSpring Web(Spring Fest 2020講演資料)今こそ知りたいSpring Web(Spring Fest 2020講演資料)
今こそ知りたいSpring Web(Spring Fest 2020講演資料)
NTT DATA Technology & Innovation
 
Form認証で学ぶSpring Security入門
Form認証で学ぶSpring Security入門Form認証で学ぶSpring Security入門
Form認証で学ぶSpring Security入門
Ryosuke Uchitate
 
AWS LambdaとDynamoDBがこんなにツライはずがない #ssmjp
AWS LambdaとDynamoDBがこんなにツライはずがない #ssmjpAWS LambdaとDynamoDBがこんなにツライはずがない #ssmjp
AWS LambdaとDynamoDBがこんなにツライはずがない #ssmjp
Masahiro NAKAYAMA
 
Spring Bootをはじめる時にやるべき10のこと
Spring Bootをはじめる時にやるべき10のことSpring Bootをはじめる時にやるべき10のこと
Spring Bootをはじめる時にやるべき10のこと
心 谷本
 
コンテナネットワーキング(CNI)最前線
コンテナネットワーキング(CNI)最前線コンテナネットワーキング(CNI)最前線
コンテナネットワーキング(CNI)最前線
Motonori Shindo
 
マイクロにしすぎた結果がこれだよ!
マイクロにしすぎた結果がこれだよ!マイクロにしすぎた結果がこれだよ!
マイクロにしすぎた結果がこれだよ!
mosa siru
 
さくっと理解するSpring bootの仕組み
さくっと理解するSpring bootの仕組みさくっと理解するSpring bootの仕組み
さくっと理解するSpring bootの仕組み
Takeshi Ogawa
 
Springを何となく使ってる人が抑えるべきポイント
Springを何となく使ってる人が抑えるべきポイントSpringを何となく使ってる人が抑えるべきポイント
Springを何となく使ってる人が抑えるべきポイント
土岐 孝平
 
Guide To AGPL
Guide To AGPLGuide To AGPL
Guide To AGPL
Mikiya Okuno
 
OpenAPI 3.0でmicroserviceのAPI定義を試みてハマった話
OpenAPI 3.0でmicroserviceのAPI定義を試みてハマった話OpenAPI 3.0でmicroserviceのAPI定義を試みてハマった話
OpenAPI 3.0でmicroserviceのAPI定義を試みてハマった話
Daichi Koike
 
PHP と SAPI と ZendEngine3 と
PHP と SAPI と ZendEngine3 とPHP と SAPI と ZendEngine3 と
PHP と SAPI と ZendEngine3 と
do_aki
 
Laravelとテストについて
LaravelとテストについてLaravelとテストについて
Laravelとテストについて
Takeo Noda
 
モノリスからマイクロサービスへの移行 ~ストラングラーパターンの検証~(Spring Fest 2020講演資料)
モノリスからマイクロサービスへの移行 ~ストラングラーパターンの検証~(Spring Fest 2020講演資料)モノリスからマイクロサービスへの移行 ~ストラングラーパターンの検証~(Spring Fest 2020講演資料)
モノリスからマイクロサービスへの移行 ~ストラングラーパターンの検証~(Spring Fest 2020講演資料)
NTT DATA Technology & Innovation
 
入社1年目のプログラミング初心者がSpringを学ぶための手引き
入社1年目のプログラミング初心者がSpringを学ぶための手引き入社1年目のプログラミング初心者がSpringを学ぶための手引き
入社1年目のプログラミング初心者がSpringを学ぶための手引き
土岐 孝平
 
DDDのモデリングとは何なのか、 そしてどうコードに落とすのか
DDDのモデリングとは何なのか、 そしてどうコードに落とすのかDDDのモデリングとは何なのか、 そしてどうコードに落とすのか
DDDのモデリングとは何なのか、 そしてどうコードに落とすのか
Koichiro Matsuoka
 
今こそ知りたいSpring Batch(Spring Fest 2020講演資料)
今こそ知りたいSpring Batch(Spring Fest 2020講演資料)今こそ知りたいSpring Batch(Spring Fest 2020講演資料)
今こそ知りたいSpring Batch(Spring Fest 2020講演資料)
NTT DATA Technology & Innovation
 
怖くないSpring Bootのオートコンフィグレーション
怖くないSpring Bootのオートコンフィグレーション怖くないSpring Bootのオートコンフィグレーション
怖くないSpring Bootのオートコンフィグレーション
土岐 孝平
 
Spring bootでweb セキュリティ(ログイン認証)編
Spring bootでweb セキュリティ(ログイン認証)編Spring bootでweb セキュリティ(ログイン認証)編
Spring bootでweb セキュリティ(ログイン認証)編
なべ
 
オブジェクト指向の設計と実装の学び方のコツ
オブジェクト指向の設計と実装の学び方のコツオブジェクト指向の設計と実装の学び方のコツ
オブジェクト指向の設計と実装の学び方のコツ
増田 亨
 
今こそ知りたいSpring Web(Spring Fest 2020講演資料)
今こそ知りたいSpring Web(Spring Fest 2020講演資料)今こそ知りたいSpring Web(Spring Fest 2020講演資料)
今こそ知りたいSpring Web(Spring Fest 2020講演資料)
NTT DATA Technology & Innovation
 
Form認証で学ぶSpring Security入門
Form認証で学ぶSpring Security入門Form認証で学ぶSpring Security入門
Form認証で学ぶSpring Security入門
Ryosuke Uchitate
 
AWS LambdaとDynamoDBがこんなにツライはずがない #ssmjp
AWS LambdaとDynamoDBがこんなにツライはずがない #ssmjpAWS LambdaとDynamoDBがこんなにツライはずがない #ssmjp
AWS LambdaとDynamoDBがこんなにツライはずがない #ssmjp
Masahiro NAKAYAMA
 
Spring Bootをはじめる時にやるべき10のこと
Spring Bootをはじめる時にやるべき10のことSpring Bootをはじめる時にやるべき10のこと
Spring Bootをはじめる時にやるべき10のこと
心 谷本
 
コンテナネットワーキング(CNI)最前線
コンテナネットワーキング(CNI)最前線コンテナネットワーキング(CNI)最前線
コンテナネットワーキング(CNI)最前線
Motonori Shindo
 
マイクロにしすぎた結果がこれだよ!
マイクロにしすぎた結果がこれだよ!マイクロにしすぎた結果がこれだよ!
マイクロにしすぎた結果がこれだよ!
mosa siru
 
さくっと理解するSpring bootの仕組み
さくっと理解するSpring bootの仕組みさくっと理解するSpring bootの仕組み
さくっと理解するSpring bootの仕組み
Takeshi Ogawa
 
Springを何となく使ってる人が抑えるべきポイント
Springを何となく使ってる人が抑えるべきポイントSpringを何となく使ってる人が抑えるべきポイント
Springを何となく使ってる人が抑えるべきポイント
土岐 孝平
 
OpenAPI 3.0でmicroserviceのAPI定義を試みてハマった話
OpenAPI 3.0でmicroserviceのAPI定義を試みてハマった話OpenAPI 3.0でmicroserviceのAPI定義を試みてハマった話
OpenAPI 3.0でmicroserviceのAPI定義を試みてハマった話
Daichi Koike
 
PHP と SAPI と ZendEngine3 と
PHP と SAPI と ZendEngine3 とPHP と SAPI と ZendEngine3 と
PHP と SAPI と ZendEngine3 と
do_aki
 
Laravelとテストについて
LaravelとテストについてLaravelとテストについて
Laravelとテストについて
Takeo Noda
 
モノリスからマイクロサービスへの移行 ~ストラングラーパターンの検証~(Spring Fest 2020講演資料)
モノリスからマイクロサービスへの移行 ~ストラングラーパターンの検証~(Spring Fest 2020講演資料)モノリスからマイクロサービスへの移行 ~ストラングラーパターンの検証~(Spring Fest 2020講演資料)
モノリスからマイクロサービスへの移行 ~ストラングラーパターンの検証~(Spring Fest 2020講演資料)
NTT DATA Technology & Innovation
 

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

Story ofcorespring infodeck
Story ofcorespring infodeckStory ofcorespring infodeck
Story ofcorespring infodeck
Makarand Bhatambarekar
 
03 integrate webapisignalr
03 integrate webapisignalr03 integrate webapisignalr
03 integrate webapisignalr
Erhwen 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 2022
Matt 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 2022
Matt Raible
 
Spring5 New Features
Spring5 New FeaturesSpring5 New Features
Spring5 New Features
Jay 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 Gains
VMware 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.js
Mek Srunyu Stittri
 
Spring boot Introduction
Spring boot IntroductionSpring boot Introduction
Spring boot Introduction
Jeevesh Pandey
 
Spring Boot
Spring BootSpring Boot
Spring Boot
HongSeong Jeon
 
สปริงเฟรมเวิร์ค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
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 App
Yu-Wei Chuang
 
Building microservices sample application
Building microservices sample applicationBuilding microservices sample application
Building microservices sample application
Anil Allewar
 
Play Framework on Google App Engine
Play Framework on Google App EnginePlay Framework on Google App Engine
Play Framework on Google App Engine
Fred Lin
 
Walking Through Spring Cloud Data Flow
Walking Through Spring Cloud Data FlowWalking Through Spring Cloud Data Flow
Walking Through Spring Cloud Data Flow
VMware Tanzu
 
20151010 my sq-landjavav2a
20151010 my sq-landjavav2a20151010 my sq-landjavav2a
20151010 my sq-landjavav2a
Ivan Ma
 
Integrating Wicket with Java EE 6
Integrating Wicket with Java EE 6Integrating Wicket with Java EE 6
Integrating Wicket with Java EE 6
Michael Plöd
 
Grails Plugin Best Practices
Grails Plugin Best PracticesGrails Plugin Best Practices
Grails Plugin Best Practices
Burt Beckwith
 
03 integrate webapisignalr
03 integrate webapisignalr03 integrate webapisignalr
03 integrate webapisignalr
Erhwen 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 2022
Matt 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 2022
Matt Raible
 
Spring5 New Features
Spring5 New FeaturesSpring5 New Features
Spring5 New Features
Jay 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 Gains
VMware 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.js
Mek Srunyu Stittri
 
Spring boot Introduction
Spring boot IntroductionSpring boot Introduction
Spring boot Introduction
Jeevesh 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 App
Yu-Wei Chuang
 
Building microservices sample application
Building microservices sample applicationBuilding microservices sample application
Building microservices sample application
Anil Allewar
 
Play Framework on Google App Engine
Play Framework on Google App EnginePlay Framework on Google App Engine
Play Framework on Google App Engine
Fred Lin
 
Walking Through Spring Cloud Data Flow
Walking Through Spring Cloud Data FlowWalking Through Spring Cloud Data Flow
Walking Through Spring Cloud Data Flow
VMware Tanzu
 
20151010 my sq-landjavav2a
20151010 my sq-landjavav2a20151010 my sq-landjavav2a
20151010 my sq-landjavav2a
Ivan Ma
 
Integrating Wicket with Java EE 6
Integrating Wicket with Java EE 6Integrating Wicket with Java EE 6
Integrating Wicket with Java EE 6
Michael Plöd
 
Grails Plugin Best Practices
Grails Plugin Best PracticesGrails Plugin Best Practices
Grails Plugin Best Practices
Burt Beckwith
 
Ad

More from Ryosuke Uchitate (8)

パラレルキャリアがもたらす相乗効果
パラレルキャリアがもたらす相乗効果パラレルキャリアがもたらす相乗効果
パラレルキャリアがもたらす相乗効果
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 Starter
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 Starter
Ryosuke Uchitate
 
Ad

Recently uploaded (20)

Smart Storage Solutions.pptx for production engineering
Smart Storage Solutions.pptx for production engineeringSmart Storage Solutions.pptx for production engineering
Smart Storage Solutions.pptx for production engineering
rushikeshnavghare94
 
"Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E...
"Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E..."Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E...
"Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E...
Infopitaara
 
some basics electrical and electronics knowledge
some basics electrical and electronics knowledgesome basics electrical and electronics knowledge
some basics electrical and electronics knowledge
nguyentrungdo88
 
Raish Khanji GTU 8th sem Internship Report.pdf
Raish Khanji GTU 8th sem Internship Report.pdfRaish Khanji GTU 8th sem Internship Report.pdf
Raish Khanji GTU 8th sem Internship Report.pdf
RaishKhanji
 
The Gaussian Process Modeling Module in UQLab
The Gaussian Process Modeling Module in UQLabThe Gaussian Process Modeling Module in UQLab
The Gaussian Process Modeling Module in UQLab
Journal of Soft Computing in Civil Engineering
 
Structural Response of Reinforced Self-Compacting Concrete Deep Beam Using Fi...
Structural Response of Reinforced Self-Compacting Concrete Deep Beam Using Fi...Structural Response of Reinforced Self-Compacting Concrete Deep Beam Using Fi...
Structural Response of Reinforced Self-Compacting Concrete Deep Beam Using Fi...
Journal of Soft Computing in Civil Engineering
 
introduction to machine learining for beginers
introduction to machine learining for beginersintroduction to machine learining for beginers
introduction to machine learining for beginers
JoydebSheet
 
IntroSlides-April-BuildWithAI-VertexAI.pdf
IntroSlides-April-BuildWithAI-VertexAI.pdfIntroSlides-April-BuildWithAI-VertexAI.pdf
IntroSlides-April-BuildWithAI-VertexAI.pdf
Luiz Carneiro
 
Avnet Silica's PCIM 2025 Highlights Flyer
Avnet Silica's PCIM 2025 Highlights FlyerAvnet Silica's PCIM 2025 Highlights Flyer
Avnet Silica's PCIM 2025 Highlights Flyer
WillDavies22
 
Oil-gas_Unconventional oil and gass_reseviours.pdf
Oil-gas_Unconventional oil and gass_reseviours.pdfOil-gas_Unconventional oil and gass_reseviours.pdf
Oil-gas_Unconventional oil and gass_reseviours.pdf
M7md3li2
 
fluke dealers in bangalore..............
fluke dealers in bangalore..............fluke dealers in bangalore..............
fluke dealers in bangalore..............
Haresh Vaswani
 
Value Stream Mapping Worskshops for Intelligent Continuous Security
Value Stream Mapping Worskshops for Intelligent Continuous SecurityValue Stream Mapping Worskshops for Intelligent Continuous Security
Value Stream Mapping Worskshops for Intelligent Continuous Security
Marc Hornbeek
 
Artificial Intelligence (AI) basics.pptx
Artificial Intelligence (AI) basics.pptxArtificial Intelligence (AI) basics.pptx
Artificial Intelligence (AI) basics.pptx
aditichinar
 
Degree_of_Automation.pdf for Instrumentation and industrial specialist
Degree_of_Automation.pdf for  Instrumentation  and industrial specialistDegree_of_Automation.pdf for  Instrumentation  and industrial specialist
Degree_of_Automation.pdf for Instrumentation and industrial specialist
shreyabhosale19
 
five-year-soluhhhhhhhhhhhhhhhhhtions.pdf
five-year-soluhhhhhhhhhhhhhhhhhtions.pdffive-year-soluhhhhhhhhhhhhhhhhhtions.pdf
five-year-soluhhhhhhhhhhhhhhhhhtions.pdf
AdityaSharma944496
 
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G..."Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
Infopitaara
 
ELectronics Boards & Product Testing_Shiju.pdf
ELectronics Boards & Product Testing_Shiju.pdfELectronics Boards & Product Testing_Shiju.pdf
ELectronics Boards & Product Testing_Shiju.pdf
Shiju Jacob
 
Introduction to FLUID MECHANICS & KINEMATICS
Introduction to FLUID MECHANICS &  KINEMATICSIntroduction to FLUID MECHANICS &  KINEMATICS
Introduction to FLUID MECHANICS & KINEMATICS
narayanaswamygdas
 
railway wheels, descaling after reheating and before forging
railway wheels, descaling after reheating and before forgingrailway wheels, descaling after reheating and before forging
railway wheels, descaling after reheating and before forging
Javad Kadkhodapour
 
new ppt artificial intelligence historyyy
new ppt artificial intelligence historyyynew ppt artificial intelligence historyyy
new ppt artificial intelligence historyyy
PianoPianist
 
Smart Storage Solutions.pptx for production engineering
Smart Storage Solutions.pptx for production engineeringSmart Storage Solutions.pptx for production engineering
Smart Storage Solutions.pptx for production engineering
rushikeshnavghare94
 
"Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E...
"Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E..."Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E...
"Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E...
Infopitaara
 
some basics electrical and electronics knowledge
some basics electrical and electronics knowledgesome basics electrical and electronics knowledge
some basics electrical and electronics knowledge
nguyentrungdo88
 
Raish Khanji GTU 8th sem Internship Report.pdf
Raish Khanji GTU 8th sem Internship Report.pdfRaish Khanji GTU 8th sem Internship Report.pdf
Raish Khanji GTU 8th sem Internship Report.pdf
RaishKhanji
 
introduction to machine learining for beginers
introduction to machine learining for beginersintroduction to machine learining for beginers
introduction to machine learining for beginers
JoydebSheet
 
IntroSlides-April-BuildWithAI-VertexAI.pdf
IntroSlides-April-BuildWithAI-VertexAI.pdfIntroSlides-April-BuildWithAI-VertexAI.pdf
IntroSlides-April-BuildWithAI-VertexAI.pdf
Luiz Carneiro
 
Avnet Silica's PCIM 2025 Highlights Flyer
Avnet Silica's PCIM 2025 Highlights FlyerAvnet Silica's PCIM 2025 Highlights Flyer
Avnet Silica's PCIM 2025 Highlights Flyer
WillDavies22
 
Oil-gas_Unconventional oil and gass_reseviours.pdf
Oil-gas_Unconventional oil and gass_reseviours.pdfOil-gas_Unconventional oil and gass_reseviours.pdf
Oil-gas_Unconventional oil and gass_reseviours.pdf
M7md3li2
 
fluke dealers in bangalore..............
fluke dealers in bangalore..............fluke dealers in bangalore..............
fluke dealers in bangalore..............
Haresh Vaswani
 
Value Stream Mapping Worskshops for Intelligent Continuous Security
Value Stream Mapping Worskshops for Intelligent Continuous SecurityValue Stream Mapping Worskshops for Intelligent Continuous Security
Value Stream Mapping Worskshops for Intelligent Continuous Security
Marc Hornbeek
 
Artificial Intelligence (AI) basics.pptx
Artificial Intelligence (AI) basics.pptxArtificial Intelligence (AI) basics.pptx
Artificial Intelligence (AI) basics.pptx
aditichinar
 
Degree_of_Automation.pdf for Instrumentation and industrial specialist
Degree_of_Automation.pdf for  Instrumentation  and industrial specialistDegree_of_Automation.pdf for  Instrumentation  and industrial specialist
Degree_of_Automation.pdf for Instrumentation and industrial specialist
shreyabhosale19
 
five-year-soluhhhhhhhhhhhhhhhhhtions.pdf
five-year-soluhhhhhhhhhhhhhhhhhtions.pdffive-year-soluhhhhhhhhhhhhhhhhhtions.pdf
five-year-soluhhhhhhhhhhhhhhhhhtions.pdf
AdityaSharma944496
 
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G..."Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
"Feed Water Heaters in Thermal Power Plants: Types, Working, and Efficiency G...
Infopitaara
 
ELectronics Boards & Product Testing_Shiju.pdf
ELectronics Boards & Product Testing_Shiju.pdfELectronics Boards & Product Testing_Shiju.pdf
ELectronics Boards & Product Testing_Shiju.pdf
Shiju Jacob
 
Introduction to FLUID MECHANICS & KINEMATICS
Introduction to FLUID MECHANICS &  KINEMATICSIntroduction to FLUID MECHANICS &  KINEMATICS
Introduction to FLUID MECHANICS & KINEMATICS
narayanaswamygdas
 
railway wheels, descaling after reheating and before forging
railway wheels, descaling after reheating and before forgingrailway wheels, descaling after reheating and before forging
railway wheels, descaling after reheating and before forging
Javad Kadkhodapour
 
new ppt artificial intelligence historyyy
new ppt artificial intelligence historyyynew ppt artificial intelligence historyyy
new ppt artificial intelligence historyyy
PianoPianist
 

決済サービスの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+
  • 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
  • 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 •