Page 1
1 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/Unless otherwise indicated, these sl ides are © 2014-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
A Comprehensive Spring Showcase:
Personal Cloud Storage Application
Erdem Günay, Expert Software Developer, Turkcell
@gunayus
Page 2
2 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
About me
Page 3
3 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
About professional me
B. Sc. Degree from Computer Engineering, Middle East Technical
University, Ankara, 1999
15 years experience with Java
10 years experience with Spring
Started and contirbuted project http://www.gwt-openlayers.org/
Enterprise application architecture
Working @Turkcell for 10 years
In organization Advanced Spring Framework trainer
In the project, software architect and developer
Page 4
4 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
Agenda
Spring Boot
Spring Data
Spring Amqp
Elastic Search
Openstack
App Demo
Page 5
5 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
Mobile Cloud Middleware
Page 6
6 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
Personal Cloud Solution Architecture
Clients
AP
I LA
YER
Frontend Storage
Elastic Search
file metadata indextoken cache
Oracle DB
accountsubscription
file system structurefile metadata
sharing metadata
Openstack
keystoneswift
file binary dataupload / downoad
Social / Cloud
Backend
BackendServices
Legacy
Enterprise Backend Systems
Rabbit MQ
Page 7
7 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
spring.io
Page 8
8 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/Unless otherwise indicated, these sl ides are © 2014-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
SPRING IO EXECUTION:
Spring Boot
Page 9
9 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
Before Spring Boot – hard work on dependency management
….
….
many others
Page 10
10 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
After Spring Boot – less work on dependency management
Page 11
11 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
After Spring Boot – still have all the jars
….
….
many others
Page 12
12 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
So easy to start & debug a web app
Page 13
13 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
& Expose a Rest service
Page 14
14 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
& Expose a SOAP Web service
Page 15
15 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
Deploy on a web app container
Page 16
16 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
Auto configuring properties
application.properties
# Spring Profiles
# ===============
spring.profiles.active=test, apiservice, backend
# Global properties
...
application-apiservice.properties
# apiservice related properties
# ===============
api.service.url=http://...
# other properties
...
application-backend.properties
# backend related properties
# ===============
backend.service.url=http://...
# other properties
...
Page 17
17 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
Configuring environmental differences – DEV
Page 18
18 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
Configuring environmental differences – TEST & PROD
Page 19
19 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
@Scheduled, @Async
Page 20
20 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
@Scheduled, @Async
Page 21
21 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/Unless otherwise indicated, these sl ides are © 2014-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
SPRING IO FOUNDATION:
Spring Data
Page 22
22 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
In the beginning – all work done by developers
Page 23
23 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
Spring killed the pain a bit – obtained & released resources
Page 24
24 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
Got better with JPA & Hibernate, but still coded by developers
Page 25
25 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
Finally, «no code no bug»
Page 26
26 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
All you need is javax.persistence @Entity
/**
* @author Oliver Gierke
*/
@Entity
public class Customer {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String firstname;
private String lastname;
@JsonIgnore
@OneToMany(mappedBy="customer")
private Set<Account> accounts = new HashSet<Account>();
Page 27
27 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
Still plain old Sql, but not coded, auto generated, time saving
select customer0_.id as id1_1_,
customer0_.firstname as firstnam2_1_,
customer0_.lastname as lastname3_1_
from customer customer0_
where (customer0_.firstname like ?)
and upper(customer0_.lastname)=upper(?)
public List<Customer> findByFirstnameLikeAndLastnameIgnoreCase(
String firstname, String lastname);
Page 28
28 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
Custom, native, modifying queries
Page 29
29 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/Unless otherwise indicated, these sl ides are © 2014-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
Spring AMQP
Page 30
30 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
Spring AMQP – RabbitMQ Configuration
Page 31
31 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
Spring AMQP – Consumer Configuration
Page 32
32 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
Spring AMQP – Message listener
Page 33
33 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
Spring AMQP – Message producer
Page 34
34 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
Spring summary
Spring Boot : the parent of everything, auto configuration
Spring Web : Restful APIs, @RestTemplate
Spring Data JPA : Repositories, custom, native, modifying queries
Spring Security
Spring Social : sharing on Twitter, Facebook
Spring Web Services : client & server
Spring AMQP
@Async, @Scheduled, @Transactional
@Bean Java config
No XML config or web.xml at all
Page 35
35 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/Unless otherwise indicated, these sl ides are © 2014-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
Elastic Search
Page 36
36 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
Elastic Search
Page 37
37 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
Elastic Search
Page 38
38 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
Elastic Search – index a document
index type id
source
Page 39
39 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
Elastic Search – get a document
Page 40
40 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
Elastic Search – Integrate with Spring App Context
Page 41
41 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
Elastic Search – Index a document
Page 42
42 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
Elastic Search – Search documents
Page 43
43 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
Elastic Search – Delete user documents
Page 44
44 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/Unless otherwise indicated, these sl ides are © 2014-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
openstack
Page 45
45 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
Openstack
Page 46
46 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
Openstack - Modules
Page 47
47 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
Openstack – Keystone authentication API
Page 48
48 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
Openstack – Authentication from Spring
Page 49
49 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
Openstack – Account creation from Spring
Page 50
50 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
Openstack – User creation from Spring
Page 51
51 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
Openstack – File upload from Spring
https://{swift_url}/v1/AUTH_049037f79ea24214b2778830c96fd243/CONTAINER_MAIN/
3b841cd9-547b-432a-98d9-3ce6211bab4f
project_id container_name
file_path
Page 52
52 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
Openstack – File download from Spring
Page 53
53 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
Demo
Unless otherwise indicated, these sl ides are
© 2014-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense:
http://creativecommons.org/l icenses/by -nc/3.0/
APPLICATION
Page 54
54 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
The Team
Volkan Esgel – Security master
Hüseyin Özcan – The UI man
Erdem Günay – it’s me
Kemal Yılmaz – the manager of the team
Page 55
55 Unless otherwise indicated, these sl ides are © 201 4-2015 Pivotal Software, Inc. and l icensed under a
Creative Commons Attribution-NonCommercial l icense: http://creativecommons.org/l icenses/by -nc/3.0/
Learn More. Stay Connected.
Twitter: twitter.com/gunayus
LinkedIn: linkedin.com/in/gunayus
Github: github.com/egunay
Twitter: twitter.com/springcentral
YouTube: spring.io/video
LinkedIn: spring.io/linkedin
Google Plus: spring.io/gplus