SlideShare a Scribd company logo
Спикер:
Тема презентации:
Stanislav Sidorenko
DeviceHive Java Server and Spring Boot
What is DeviceHive?
DeviceHive is an Open Source Machine-to-Machine
(M2M) framework. It contains a set of services and
components that allow establishing a two-way
communication with remote devices using cloud as a
middleware. The devices can be anything connected: sensor
networks, smart meters, security systems, telemetry, or
smart home devices.
What is inside?
• JavaEE or .NET-based server
• REST и Websocket APIs for devices and Clients
• Data storage: Postgresql and NoSQL (MongoDB).
• Device: Linux C/C++, .NET, .NET Micro Framework, Java,
Python, MicroChip and AVR native C.
• Client: Windows 8, iOS, Android, Windows Phone 7 and
8,.NET, HTML5/JavaScript.
What is inside?
REST, Websockets
REST, Websockets
REST, Websockets
binary
Client: something that manages DevicesDevice: almost everything. 
Gateway: fake Device that quite smart to connect to
DH and to manage other Devices.
Future: merge everything to one entity.
How does it work?
Client
Device
commandsnotifications
commands
notifications
Access control system: Networks
Client DeviceNetwork
1n n n
AccessKey: allows authenticated client to act on behalf of Device
• Network list
• Device list
• IP/Domain
• Actions
Basic access control. User has access to Device if and only if he has access to network
Access control system: AccessKeys
AccessKey: more smart security system similar to MAC
Privilege contains
• Network list
• Device list
• IP/Domain
• Actions
Client PrivilegeAccessKey
11 n n
Java server implementation
• Java EE 7 platform:
• JAX-RS 2.0
• Websocket API 1.0
• JPA 2.1
• EJB 3.2
• CDI 1.1
• PostgreSQL 9.x
• Glassfish 4, 4.1 as reference JEE7 implementation
• Wildfly 8, 8.1 was preliminary tested. There were some issues with
websockets, but now the application works generally fine.
Feedback
• “We’d like to be able to deploy it to Tomcat”
Existing code is built to .war application.
• “Do I need JEE application server? Oh.”
• “Deployment procedure is quite hard.”
OK, let’s try to simplify it. Spring?
• Again not so new technology stack, but quite rich.
• Application can be deployed almost everywhere. Only servlet container is needed (Tomcat, Jetty,..)
• Migration would not be so hard.
• JAX-RS -> Spring MVC or using Jersey (no code migration in fact)
• EJB -> Spring @Service + spring-tx
• Bean Validation API -> the same, just configuration changes.
• JPA -> no changes again
• CDI -> Spring DI (CDI events may be an issue).
• Spring Boot.
Spring Boot.
• Easy deployment
There are many “default” configurations that could be applied
automatically.
• Standalone Spring-based applications
• “fat” executable jar
• archive with two directories: /lib with jars and /bin with unix
shell and windows batch scripts.
• .war packaging is still possible
Maven integration
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
Goals:
• boot:repackage
• boot:run
Gradle integration
buildscript {
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-
plugin:1.2.2")
}
}
apply plugin: 'spring-boot‘
Tasks:
bootRepackage
bootRun
Sample application
@RestController
@EnableAutoConfiguration
public class Sample {
@RequestMapping("/")
String home() {
return "Hello World!";
}
public static void main(String[] args) throws Exception {
SpringApplication.run(Sample.class, args);
}
}
Starter POMs
• dependency descriptors, cover all required dependencies.
• named spring-boot-starter-*
Web applications: Use spring-boot-starter-web – attaches default servlet container and spring web dependencies.
spring-boot-starter-tomcat (default one)
spring-boot-starter-jetty
spring-boot-starter-undertow
• Versions
• sprint-boot-starters parent pom
• your own one.
Customizing the application
• Main configuration file: application.properties
• Read from classpath or location can be overridden:
java -jar myproject.jar --spring.config.location=...
• Spring Profiles
--spring.profiles.active=dev,qa,etc…
application-{profile}.properties is used
DataSources deployment
• Embedded datasources:
• embedded H2, HSQL and Derby databases
• just specify spring-jdbc and add runtime DB dependency
• useful for testing
• Production datasource
• add ‘spring-boot-starter-jdbc’ started pom
• specify spring.datasource.* properties (url, user, pw, driver)
• JNDI is also supported
Databases initialization
• JPA - spring.jpa.generate-ddl (good for testing only)
• Spring JDBC
Two files: schema.sql, data.sql or schema-${db}.sql and data-{db}.sql
Again looks file for testing purposes only.
• Embedded Database migration tools
• Flyway
SQL files in classpath:db/migration
• Luqibase
Looks fine for production deployments.
Creating deployable .war file
@SpringBootApplication
public class Application extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder
application) {
return application.sources(Application.class);
}
public static void main(String[] args) throws Exception {
SpringApplication.run(Application.class, args);
}
}
@SpringBootApplication == @Configuration @EnableAutoConfiguration
@ComponentScan
Servlet container customization and other features
• Since container is embedded, it can be customized by the application
• Basic options, e.g.
server.port
server.address
server.sessionTimeout
• Container-specific customizations:
TomcatEmbeddedServletContainerFactory
JettyEmbeddedServletContainerFactory
UndertowEmbeddedServletContainerFactory
Migration
Still in progress…
But we hope it will be done in nearby future.
TODO: comparison, tests, final decision…
Questions
?

More Related Content

PPTX
ASP.Net 5 and C# 6
PPTX
Introduction to spring boot
PPTX
Next stop: Spring 4
PDF
Introduction to Spring Boot
PPTX
Why Play Framework is fast
PPTX
Faster java ee builds with gradle [con4921]
PPTX
Spring boot
PDF
Play Framework and Activator
ASP.Net 5 and C# 6
Introduction to spring boot
Next stop: Spring 4
Introduction to Spring Boot
Why Play Framework is fast
Faster java ee builds with gradle [con4921]
Spring boot
Play Framework and Activator

What's hot (20)

PPTX
Node.js Development with Apache NetBeans
PPTX
Building a REST Service in minutes with Spring Boot
PDF
Getting Reactive with Spring Framework 5.0’s GA release
PPTX
Why jakarta ee matters (ConFoo 2021)
PPTX
Preparing for java 9 modules upload
PPTX
Full stack development with node and NoSQL - All Things Open - October 2017
PDF
PUC SE Day 2019 - SpringBoot
PDF
Spring boot introduction
PDF
JavaCro'14 - Securing web applications with Spring Security 3 – Fernando Redo...
PDF
Play framework productivity formula
PDF
Asp.Net Core MVC , Razor page , Entity Framework Core
PPTX
Introducing ASP.NET Core 2.0
PDF
Rediscovering Spring with Spring Boot(1)
PDF
Spring Boot
PDF
Blazor, lo sapevi che...
PPTX
SenchaCon 2016: Develop, Test & Deploy with Docker - Jonas Schwabe
PPTX
Owin from spec to application
PDF
Spring Framework 4.0 - The Next Generation - Soft-Shake 2013
PPTX
Spring boot
PPTX
Workshop Framework(J2EE/OSGi/RCP)
Node.js Development with Apache NetBeans
Building a REST Service in minutes with Spring Boot
Getting Reactive with Spring Framework 5.0’s GA release
Why jakarta ee matters (ConFoo 2021)
Preparing for java 9 modules upload
Full stack development with node and NoSQL - All Things Open - October 2017
PUC SE Day 2019 - SpringBoot
Spring boot introduction
JavaCro'14 - Securing web applications with Spring Security 3 – Fernando Redo...
Play framework productivity formula
Asp.Net Core MVC , Razor page , Entity Framework Core
Introducing ASP.NET Core 2.0
Rediscovering Spring with Spring Boot(1)
Spring Boot
Blazor, lo sapevi che...
SenchaCon 2016: Develop, Test & Deploy with Docker - Jonas Schwabe
Owin from spec to application
Spring Framework 4.0 - The Next Generation - Soft-Shake 2013
Spring boot
Workshop Framework(J2EE/OSGi/RCP)
Ad

Viewers also liked (20)

PPTX
PPTX
Transistores
PPTX
Zed innovation intro
PDF
«DeviceHive: IoT в Android». Николай Хабаров
PPTX
Testing in projects
PPTX
Pen pc tecn
PPTX
5penpctechnology 130402085735-phpapp01
PDF
Артур Чеканов «Microframeworks» (Python Meetup)
PPSX
Visiting unpleasent places
PDF
Estrategika nuevos productos proteccion
PDF
The Rental Policies You Need to Know About
PPTX
Uses and gratification theory
PPTX
Андраш Густи «Интерфейсы, которые вызывают привыкание, или Как перепрошить по...
PPTX
Media: Ancillary photos
PPTX
Thriller powerpoint finished
PPT
Biblioterapia
PPTX
นิทาน
PPTX
sistema de gestión de contenidos
PPTX
Music video regulations
Transistores
Zed innovation intro
«DeviceHive: IoT в Android». Николай Хабаров
Testing in projects
Pen pc tecn
5penpctechnology 130402085735-phpapp01
Артур Чеканов «Microframeworks» (Python Meetup)
Visiting unpleasent places
Estrategika nuevos productos proteccion
The Rental Policies You Need to Know About
Uses and gratification theory
Андраш Густи «Интерфейсы, которые вызывают привыкание, или Как перепрошить по...
Media: Ancillary photos
Thriller powerpoint finished
Biblioterapia
นิทาน
sistema de gestión de contenidos
Music video regulations
Ad

Similar to Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot» (20)

PPTX
Advance Java Topics (J2EE)
PPT
01 java intro
PDF
Modern Cloud-Native Jakarta EE Frameworks: tips, challenges, and trends.
PPTX
AJppt.pptx
PPTX
Spring boot Introduction
PPTX
ASP.NET Core 1.0
PPT
Java Training at Gateway Software Solutions,Coimbatore
PPTX
introduction to node.js
PPT
Cloud compiler - Minor Project by students of CBPGEC
PDF
DevOps &lt;3 node.js
PPT
Spring - a framework written by developers
ODP
Groovy & Grails eXchange 2012 vert.x presentation
PDF
Intro to Sails.js
PPTX
Advance java prasentation
DOC
Ankit Chohan - Java
PDF
A Hitchhiker's Guide to Cloud Native Java EE
PDF
A Hitchhiker's Guide to Cloud Native Java EE
PDF
AAI-1304 Technical Deep-Dive into IBM WebSphere Liberty
PPTX
Automating Software Development Life Cycle - A DevOps Approach
PPT
Lecture 19 - Dynamic Web - JAVA - Part 1.ppt
Advance Java Topics (J2EE)
01 java intro
Modern Cloud-Native Jakarta EE Frameworks: tips, challenges, and trends.
AJppt.pptx
Spring boot Introduction
ASP.NET Core 1.0
Java Training at Gateway Software Solutions,Coimbatore
introduction to node.js
Cloud compiler - Minor Project by students of CBPGEC
DevOps &lt;3 node.js
Spring - a framework written by developers
Groovy & Grails eXchange 2012 vert.x presentation
Intro to Sails.js
Advance java prasentation
Ankit Chohan - Java
A Hitchhiker's Guide to Cloud Native Java EE
A Hitchhiker's Guide to Cloud Native Java EE
AAI-1304 Technical Deep-Dive into IBM WebSphere Liberty
Automating Software Development Life Cycle - A DevOps Approach
Lecture 19 - Dynamic Web - JAVA - Part 1.ppt

More from DataArt (20)

PDF
DataArt Custom Software Engineering with a Human Approach
PDF
DataArt Healthcare & Life Sciences
PDF
DataArt Financial Services and Capital Markets
PDF
About DataArt HR Partners
PDF
Event management в IT
PDF
Digital Marketing from inside
PPTX
What's new in Android, Igor Malytsky ( Google Post I|O Tour)
PDF
DevOps Workshop:Что бывает, когда DevOps приходит на проект
PDF
IT Talk Kharkiv: «‎Soft skills в IT. Польза или вред? Максим Бастион, DataArt
PDF
«Ноль копеек. Спастись от выгорания» — Сергей Чеботарев (Head of Design, Han...
PDF
Communication in QA's life
PDF
Нельзя просто так взять и договориться, или как мы работали со сложными людьми
PDF
Знакомьтесь, DevOps
PDF
DevOps in real life
PDF
Codeless: автоматизация тестирования
PDF
Selenoid
PDF
Selenide
PDF
A. Sirota "Building an Automation Solution based on Appium"
PDF
Эмоциональный интеллект или как не сойти с ума в условиях сложного и динамичн...
PPTX
IT talk: Как я перестал бояться и полюбил TestNG
DataArt Custom Software Engineering with a Human Approach
DataArt Healthcare & Life Sciences
DataArt Financial Services and Capital Markets
About DataArt HR Partners
Event management в IT
Digital Marketing from inside
What's new in Android, Igor Malytsky ( Google Post I|O Tour)
DevOps Workshop:Что бывает, когда DevOps приходит на проект
IT Talk Kharkiv: «‎Soft skills в IT. Польза или вред? Максим Бастион, DataArt
«Ноль копеек. Спастись от выгорания» — Сергей Чеботарев (Head of Design, Han...
Communication in QA's life
Нельзя просто так взять и договориться, или как мы работали со сложными людьми
Знакомьтесь, DevOps
DevOps in real life
Codeless: автоматизация тестирования
Selenoid
Selenide
A. Sirota "Building an Automation Solution based on Appium"
Эмоциональный интеллект или как не сойти с ума в условиях сложного и динамичн...
IT talk: Как я перестал бояться и полюбил TestNG

Recently uploaded (20)

PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PPTX
Big Data Technologies - Introduction.pptx
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Electronic commerce courselecture one. Pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Encapsulation theory and applications.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
KodekX | Application Modernization Development
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Spectral efficient network and resource selection model in 5G networks
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Big Data Technologies - Introduction.pptx
“AI and Expert System Decision Support & Business Intelligence Systems”
Electronic commerce courselecture one. Pdf
NewMind AI Weekly Chronicles - August'25 Week I
Chapter 3 Spatial Domain Image Processing.pdf
Encapsulation theory and applications.pdf
Review of recent advances in non-invasive hemoglobin estimation
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Agricultural_Statistics_at_a_Glance_2022_0.pdf
KodekX | Application Modernization Development
Network Security Unit 5.pdf for BCA BBA.
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Understanding_Digital_Forensics_Presentation.pptx
Spectral efficient network and resource selection model in 5G networks

Станислав Сидоренко «DeviceHive Java Server – миграция на Spring Boot»

  • 2. What is DeviceHive? DeviceHive is an Open Source Machine-to-Machine (M2M) framework. It contains a set of services and components that allow establishing a two-way communication with remote devices using cloud as a middleware. The devices can be anything connected: sensor networks, smart meters, security systems, telemetry, or smart home devices.
  • 3. What is inside? • JavaEE or .NET-based server • REST и Websocket APIs for devices and Clients • Data storage: Postgresql and NoSQL (MongoDB). • Device: Linux C/C++, .NET, .NET Micro Framework, Java, Python, MicroChip and AVR native C. • Client: Windows 8, iOS, Android, Windows Phone 7 and 8,.NET, HTML5/JavaScript.
  • 4. What is inside? REST, Websockets REST, Websockets REST, Websockets binary Client: something that manages DevicesDevice: almost everything.  Gateway: fake Device that quite smart to connect to DH and to manage other Devices. Future: merge everything to one entity.
  • 5. How does it work? Client Device commandsnotifications commands notifications
  • 6. Access control system: Networks Client DeviceNetwork 1n n n AccessKey: allows authenticated client to act on behalf of Device • Network list • Device list • IP/Domain • Actions Basic access control. User has access to Device if and only if he has access to network
  • 7. Access control system: AccessKeys AccessKey: more smart security system similar to MAC Privilege contains • Network list • Device list • IP/Domain • Actions Client PrivilegeAccessKey 11 n n
  • 8. Java server implementation • Java EE 7 platform: • JAX-RS 2.0 • Websocket API 1.0 • JPA 2.1 • EJB 3.2 • CDI 1.1 • PostgreSQL 9.x • Glassfish 4, 4.1 as reference JEE7 implementation • Wildfly 8, 8.1 was preliminary tested. There were some issues with websockets, but now the application works generally fine.
  • 9. Feedback • “We’d like to be able to deploy it to Tomcat” Existing code is built to .war application. • “Do I need JEE application server? Oh.” • “Deployment procedure is quite hard.”
  • 10. OK, let’s try to simplify it. Spring? • Again not so new technology stack, but quite rich. • Application can be deployed almost everywhere. Only servlet container is needed (Tomcat, Jetty,..) • Migration would not be so hard. • JAX-RS -> Spring MVC or using Jersey (no code migration in fact) • EJB -> Spring @Service + spring-tx • Bean Validation API -> the same, just configuration changes. • JPA -> no changes again • CDI -> Spring DI (CDI events may be an issue). • Spring Boot.
  • 11. Spring Boot. • Easy deployment There are many “default” configurations that could be applied automatically. • Standalone Spring-based applications • “fat” executable jar • archive with two directories: /lib with jars and /bin with unix shell and windows batch scripts. • .war packaging is still possible
  • 13. Gradle integration buildscript { dependencies { classpath("org.springframework.boot:spring-boot-gradle- plugin:1.2.2") } } apply plugin: 'spring-boot‘ Tasks: bootRepackage bootRun
  • 14. Sample application @RestController @EnableAutoConfiguration public class Sample { @RequestMapping("/") String home() { return "Hello World!"; } public static void main(String[] args) throws Exception { SpringApplication.run(Sample.class, args); } }
  • 15. Starter POMs • dependency descriptors, cover all required dependencies. • named spring-boot-starter-* Web applications: Use spring-boot-starter-web – attaches default servlet container and spring web dependencies. spring-boot-starter-tomcat (default one) spring-boot-starter-jetty spring-boot-starter-undertow • Versions • sprint-boot-starters parent pom • your own one.
  • 16. Customizing the application • Main configuration file: application.properties • Read from classpath or location can be overridden: java -jar myproject.jar --spring.config.location=... • Spring Profiles --spring.profiles.active=dev,qa,etc… application-{profile}.properties is used
  • 17. DataSources deployment • Embedded datasources: • embedded H2, HSQL and Derby databases • just specify spring-jdbc and add runtime DB dependency • useful for testing • Production datasource • add ‘spring-boot-starter-jdbc’ started pom • specify spring.datasource.* properties (url, user, pw, driver) • JNDI is also supported
  • 18. Databases initialization • JPA - spring.jpa.generate-ddl (good for testing only) • Spring JDBC Two files: schema.sql, data.sql or schema-${db}.sql and data-{db}.sql Again looks file for testing purposes only. • Embedded Database migration tools • Flyway SQL files in classpath:db/migration • Luqibase Looks fine for production deployments.
  • 19. Creating deployable .war file @SpringBootApplication public class Application extends SpringBootServletInitializer { @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(Application.class); } public static void main(String[] args) throws Exception { SpringApplication.run(Application.class, args); } } @SpringBootApplication == @Configuration @EnableAutoConfiguration @ComponentScan
  • 20. Servlet container customization and other features • Since container is embedded, it can be customized by the application • Basic options, e.g. server.port server.address server.sessionTimeout • Container-specific customizations: TomcatEmbeddedServletContainerFactory JettyEmbeddedServletContainerFactory UndertowEmbeddedServletContainerFactory
  • 21. Migration Still in progress… But we hope it will be done in nearby future. TODO: comparison, tests, final decision…