LINE Spring Framework
Tokuhiro Matsuno LINE Corp.
Service development 1
LINE Corp. 1
LINE Bot SDK
Java
LINE Notify
LINE Java
github enterprise
CSS 4%
HTML 4%Clojure
5%Perl 5%
Objective-C 6%
Shell 9%
Python 10%
JavaScript 18%
Java 41%
"org.springframework spring-webmvc" : 547
"spring-boot-starter-web" : 285
Why Spring?
(Java EE )
Java EE B2C Web
Java EE
Microservices
Microservices
application server
/
/
spring, guice, Vert.x, Dagger2, avans,etc.
groovy, scala,
golang, perl, python,
Theres more than one way
to do it
spring-boot Microservice
spring-boot
uber jar deploy
XML
Java
: LINE Notify
LINE Notify
curl -X POST \
-H 'Authorization: Bearer '
-F 'message=Hello'
https://notify-api.line.me/api/notify
https://notify-api.line.me/api/notify
LINE Notify
MySQL MySQL
API 1
API 2
Web 1
Web 2
Redis Redis
MySQL MySQL 5.6
InnoDB
MMM
Redis Redis sentinel
KVS Redis
Cache
Rate limit
nginx ACL
rewrite
Access log
nginx jetty
nginx jetty
nginx jetty
Jetty spring-boot-starter-jetty
app server
undertow
LINE Fluentd
http status
Fluency
spring-boot 1.4.0.RELEASE spring-boot-starter-
web
spring-boot-starter-freemarker
spring-boot-starter-data-redis
spring-boot-starter-security
spring-boot-starter-mobile
mybatis-spring-boot-starter
spring-boot-starter-web
@GetMapping, @PostMapping
spring-boot-starter-freemarker
freemarker
thymeleaf
IDEA freemarker
Apache Incubator
(spring.ftl issue)
spring-boot-starter-redis
spring-boot-starter-mobile
User-Agent
mybatis-spring-boot-starter O/R Mapper mybatis
JPA
B2C
MyBatis
MyBatis XML DBA
MyBatis + Kotlin
XML
Java
Kotlin
@Mapper
interface BlogDao {
@Select("""
SELECT * FROM blog
""")
fun findAll(): List
@Select("""
SELECT * FROM blog WHERE id=#{id}
""")
fun findById(@Param("id") id: Long): Blog
}
kotlin?
groovy
kotlin
line-notify-common
application.yml logback-spring.xml
line-notify-api
line-notify-admin
line-notify-webline-notify-test
line-notify-model
Deploy & CI at LINE
Deploy
PMC
Shell script rsync Web UI
()
github jenkins
nexus PMC App server
Build jar & testing
upload jar
supervisord
java
nginx
git flow?master
beta
Topic
LINE
Prometheus
TSDB
1
Pull
Prometheus
Prometheus
node_exporter
jmx_exporterjava app
node_exporter
jmx_exporterjava app
httpd
Pull
grafana
node_exporter
jmx_exporter
Dropwizard metrics
jmx_exporter prometheus
LINE Bot +
Spring Boot
LINE Messaging API
LINE
1000 LINE BOT AWARDS
Java + spring-boot
LINE Messaging SDK for Java
JSON
HTTP Client library based on Retrofit
Servlet support
spring-boot support
spring-boot
AutoConfiguration
spring-boot supports auto-configuration
META-INF/spring.factories
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.linecorp.bot.spring.boot.LineBotAutoConfiguration,com.linecorp.bot.spring.boot.LineBotWebMvcConfigurer
com.linecorp.bot
line-bot-spring-boot
1.3.0
@SpringBootApplication
public class EchoApplication {
public static void main(String[] args) {
SpringApplication.run(
EchoApplication.class, args);
}
}
@LineMessageHandler
public class EchoHandler {
@Autowired
private LineMessagingService lineMessagingService;
@EventMapping
public void handle(MessageEvent event) throws Exception {
lineMessagingService.replyMessage(new ReplyMessage(
event.getReplyToken(), singletonList(
new TextMessage(event.getMessage().getText()))))
.execute();
}
}
jjug ccc 2016 fall LINE Bot live coding
Bot
Were hiring.