SlideShare a Scribd company logo
ACCENTURE
TECHNOLOGY
MEETUP
SPRING BOOT
BASED
MICROSERVICES
• Application as a suit of small services
• Services are split around business capability
• Lightweight
• smaller the better
• Services are independent
• Better testability
• Better deployability
• Improved fault isolation and tolerance
• Great agility and scalability
MICROSERVICES
Copyright © 2018 Accenture. All rights reserved. 2
• CRUD operations
• get, post, put, delete
• Should get all data needed
• Header
• URL (path, request parameters)
• Body (content type?)
MICROSERVICE BASICS
Copyright © 2018 Accenture. All rights reserved. 3
• Naming is consequent with function
• GET /meetup/team
• POST /meetup/team
– -> Location: /meetup/team/{id}
• GET /meetup/team/{id}
• PUT /meetup/team/{id}
• DELETE /meetup/team/{id}
SERVICE URLS
Copyright © 2018 Accenture. All rights reserved. 4
• Headers
• Accept
• Content-Type
• Authentication
• Accept-Language
• Location
• Allow-Origin
HEADERS
Copyright © 2018 Accenture. All rights reserved. 5
• 200 - OK
• 201 - Created
• 204 - No content
• 401 - Unauthorized
• 403 - Forbidden
• 404 - Not found
• 406 - Not acceptable
• 409 - Conflict
• 415 - Unsupported media type
• 422 - Unprocessable entity
RESPONSE CODES
Copyright © 2018 Accenture. All rights reserved. 6
• REST vs SOAP
• Data is provided as input, no state stored
• JSON vs html
• Calling external services
• Dependencies should be avoided
• Shared data between services
• Keep as low as possible
TO DO, OR NOT TO DO?
Copyright © 2018 Accenture. All rights reserved. 7
• data
• mvc
• web
• aop
• annotations
• boot
• cloud
SPRING FUNCTIONS
Copyright © 2018 Accenture. All rights reserved. 8
• Swiss army knife toolkit
• Stand-alone Spring application
• Runnable JAR file
• Tested for stability
• No dependency issues
• Runnable jar
• Embedded application server
• Gradle or Maven support
• Low overhead
SPRING BOOT - BASICS
Copyright © 2018 Accenture. All rights reserved. 9
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.1.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
• @SpringBootApplication
• main()
APPLICATION
Copyright © 2018 Accenture. All rights reserved. 10
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
• @RestController
• @RequestMapping
CONTROLLER ANNOTATION
Copyright © 2018 Accenture. All rights reserved. 11
@RestController
public class MeetupController {
@Autowired
private MeetupService meetupService;
@RequestMapping(value = "/person/{id}", method = RequestMethod.GET)
public Optional<Person> getPerson(HttpServletRequest httpServletRequest, @PathVariable("id") String id) {
return meetupService.getPerson(id);
}
• To handle HTTP OPTIONS call
• Implemented as filter
• Headers returned
• Access-Control-Allow-Methods
• Access-Control-Allow-Headers
• Access-Control-Allow-Origin
• Access-Control-Max-Age
• Access-Control-Allow-Credentials
CORS FILTER
Copyright © 2018 Accenture. All rights reserved. 12
• LoggingFilter
• HTTP Request and response
– Headers, URL and params
– doFilter
• ControllerLoggerAspect
• @Component
• @Aspect
• @Before({pointcut})
LOGGING ASPECTS
Copyright © 2018 Accenture. All rights reserved. 13
@Aspect
@Component
public class ControllerLoggerAspect {
@Before("execution(* com.accenture.meetup.controller.MeetupController.*(..))")
public void logBefore(JoinPoint joinPoint) {
}
}
}
@Component
public class LoggingFilter implements Filter {
@Override
public void doFilter(ServletRequest servletRequest,
ServletResponse servletResponse, FilterChain filterChain) {
}
}
• @ControllerAdvice
• implements RequestBodyAdvice
– boolean supports(...)
– beforeBodyRead(...)
– afterBodyRead(...)
– handleEmptyBody(...)
• implements ResponseBodyAdvice
– boolean supports(...)
– beforeBodyWrite(...)
REQUEST AND RESPONSE BODY
Copyright © 2018 Accenture. All rights reserved. 14
@ControllerAdvice
public class RequestBodyLogger implements RequestBodyAdvice {
@Override
public boolean supports(MethodParameter methodParameter,
Type targetType,
Class<? extends HttpMessageConverter<?>> converterType) {
}
@Override
public Object handleEmptyBody(Object body,
HttpInputMessage inputMessage, MethodParameter parameter,
Type targetType,
Class<? extends HttpMessageConverter<?>> converterType) {
}
@Override
public HttpInputMessage beforeBodyRead(HttpInputMessage inputMessage,
MethodParameter parameter, Type targetType,
Class<? extends HttpMessageConverter<?>> converterType) {
}
@Override
public Object afterBodyRead(Object body,
HttpInputMessage inputMessage, MethodParameter parameter,
Type targetType,
Class<? extends HttpMessageConverter<?>> converterType) {
}
}
• Implemented as ControllerAdvice
• @ControllerAdvice
• Based on exception type
• @ExceptionHandler
• Sets HTTP error codes
• @ResponseStatus
ERROR HANDLER
Copyright © 2018 Accenture. All rights reserved. 15
@ControllerAdvice
public class GlobalExceptionHandler extends
ResponseEntityExceptionHandler {
@ExceptionHandler(NotFoundException.class)
@ResponseStatus(value = HttpStatus.NOT_FOUND)
public void handleNotFoundException(NotFoundException e) {
logger.error(e.getMessage());
}
}
• spring-data
• One for each entity
• @Repository
• extends CrudRepository(<T, ID>)
– save
– findById
– deleteById
DATABASE ACCESS
Copyright © 2018 Accenture. All rights reserved. 16
@Repository
public interface TeamRepository extends CrudRepository<Team, String> {
}
• Unit tests
• In memory database (h2)
• Mockito and mock mvc for controller - TDD
• Cucumber – BDD
• Sonar – quality gates
• PACT – contract
QUALITY CONTROL
Copyright © 2018 Accenture. All rights reserved. 17
• Uses real service
• Includes filters, aspects and error handlers
• @AutoConfigureMockMvc
• @SpringBootTest
• @RunWith(Springrunner.class)
• mvc.perform()
MOCK MVC
Copyright © 2018 Accenture. All rights reserved. 18
@RunWith(SpringRunner.class)
@SpringBootTest
@AutoConfigureMockMvc
public class MeetupControllerTest {
@Autowired
private MockMvc mvc;
@Test
public void getHealthcheck() throws Exception {
mvc.perform(MockMvcRequestBuilders.get("/healthcheck")
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk());
}
}
• Contract based interface verification
• Mock services and interactions
• DSM format
• pact-mock-server
• Can be generated
PACT
Copyright © 2018 Accenture. All rights reserved. 19
Contract
Partner A
e.g. CLIENT
Contract
Partner B
e.g. BACK
END
PACT
• Root interaction
• Options request
• Acceptance vs Compatibility
• Header and body matching
• Samples by value generators
• Json objects
PACT – BEST PRACTICES
Copyright © 2018 Accenture. All rights reserved. 20
Copyright © 2018 Accenture. All rights reserved. 21
• Describes Behaviour – BDD
• Human readable
• POs and BAs can also understand
– Given...
– When...
– Then...
• Scenarios and Scenariooutlines with examples
CUCUMBER
• Physical hardware
• chroot jail, selinux
• VMware, Hyper-V
• shared libs?
• docker (expendables)
• docker builder
• swarm (there's more)
DOCKER EVOLUTION
Copyright © 2018 Accenture. All rights reserved. 22
• perfect match
• easy to...
• integrate (jenkins, maven)
• deploy
• scale
• Can be automatically built
• maven, gradle etc.
• Can be automatically deployed
• CI, CD, jenkins, bamboo etc.
SPRINGBOOT AND DOCKER
Copyright © 2018 Accenture. All rights reserved. 23
• Health check
• spring-actuator
• Logging
• Monitoring
• Sizing (jvm, cpu)
CONSIDERATIONS
Copyright © 2018 Accenture. All rights reserved. 24
• microservice basics
• springboot
• cucumber
• pact
• docker
SUMMARY
Copyright © 2018 Accenture. All rights reserved. 25
THANK YOU
Copyright © 2018 Accenture. All rights reserved. 26
accenture.hu
Ad

More Related Content

What's hot (20)

PUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBootPUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBoot
Josué Neis
 
Building microservices sample application
Building microservices sample applicationBuilding microservices sample application
Building microservices sample application
Anil Allewar
 
Full-Stack Development with Spring Boot and VueJS
Full-Stack Development with Spring Boot and VueJSFull-Stack Development with Spring Boot and VueJS
Full-Stack Development with Spring Boot and VueJS
VMware Tanzu
 
Fundamental Spring Boot: Keep it Simple, Get it Right, Be Productive and Have...
Fundamental Spring Boot: Keep it Simple, Get it Right, Be Productive and Have...Fundamental Spring Boot: Keep it Simple, Get it Right, Be Productive and Have...
Fundamental Spring Boot: Keep it Simple, Get it Right, Be Productive and Have...
VMware Tanzu
 
Cloud Native Microservices with Spring Cloud
Cloud Native Microservices with Spring CloudCloud Native Microservices with Spring Cloud
Cloud Native Microservices with Spring Cloud
Conor Svensson
 
Microservices with Java, Spring Boot and Spring Cloud
Microservices with Java, Spring Boot and Spring CloudMicroservices with Java, Spring Boot and Spring Cloud
Microservices with Java, Spring Boot and Spring Cloud
Eberhard Wolff
 
Microservices - java ee vs spring boot and spring cloud
Microservices - java ee vs spring boot and spring cloudMicroservices - java ee vs spring boot and spring cloud
Microservices - java ee vs spring boot and spring cloud
Ben Wilcock
 
Rediscovering Spring with Spring Boot(1)
Rediscovering Spring with Spring Boot(1)Rediscovering Spring with Spring Boot(1)
Rediscovering Spring with Spring Boot(1)
Gunith Devasurendra
 
White paper mbre_en
White paper mbre_enWhite paper mbre_en
White paper mbre_en
VisioneerUG
 
Spring Boot and Microservices
Spring Boot and MicroservicesSpring Boot and Microservices
Spring Boot and Microservices
seges
 
Spring Cloud: Why? How? What?
Spring Cloud: Why? How? What?Spring Cloud: Why? How? What?
Spring Cloud: Why? How? What?
Orkhan Gasimov
 
Spring Boot
Spring BootSpring Boot
Spring Boot
HongSeong Jeon
 
Introduction to spring boot
Introduction to spring bootIntroduction to spring boot
Introduction to spring boot
Santosh Kumar Kar
 
Resilient Microservices with Spring Cloud
Resilient Microservices with Spring CloudResilient Microservices with Spring Cloud
Resilient Microservices with Spring Cloud
VMware Tanzu
 
Testing Microservices
Testing MicroservicesTesting Microservices
Testing Microservices
Anil Allewar
 
A Series of Fortunate Events: Building an Operator in Java
A Series of Fortunate Events: Building an Operator in JavaA Series of Fortunate Events: Building an Operator in Java
A Series of Fortunate Events: Building an Operator in Java
VMware Tanzu
 
What We Learned from Porting PiggyMetrics from Spring Boot to MicroProfile
What We Learned from Porting PiggyMetrics from Spring Boot to MicroProfileWhat We Learned from Porting PiggyMetrics from Spring Boot to MicroProfile
What We Learned from Porting PiggyMetrics from Spring Boot to MicroProfile
Ed Burns
 
Spring cloud for microservices architecture
Spring cloud for microservices architectureSpring cloud for microservices architecture
Spring cloud for microservices architecture
Igor Khotin
 
What’s New in Spring Data MongoDB
What’s New in Spring Data MongoDBWhat’s New in Spring Data MongoDB
What’s New in Spring Data MongoDB
VMware Tanzu
 
What’s New in Spring Batch?
What’s New in Spring Batch?What’s New in Spring Batch?
What’s New in Spring Batch?
VMware Tanzu
 
PUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBootPUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBoot
Josué Neis
 
Building microservices sample application
Building microservices sample applicationBuilding microservices sample application
Building microservices sample application
Anil Allewar
 
Full-Stack Development with Spring Boot and VueJS
Full-Stack Development with Spring Boot and VueJSFull-Stack Development with Spring Boot and VueJS
Full-Stack Development with Spring Boot and VueJS
VMware Tanzu
 
Fundamental Spring Boot: Keep it Simple, Get it Right, Be Productive and Have...
Fundamental Spring Boot: Keep it Simple, Get it Right, Be Productive and Have...Fundamental Spring Boot: Keep it Simple, Get it Right, Be Productive and Have...
Fundamental Spring Boot: Keep it Simple, Get it Right, Be Productive and Have...
VMware Tanzu
 
Cloud Native Microservices with Spring Cloud
Cloud Native Microservices with Spring CloudCloud Native Microservices with Spring Cloud
Cloud Native Microservices with Spring Cloud
Conor Svensson
 
Microservices with Java, Spring Boot and Spring Cloud
Microservices with Java, Spring Boot and Spring CloudMicroservices with Java, Spring Boot and Spring Cloud
Microservices with Java, Spring Boot and Spring Cloud
Eberhard Wolff
 
Microservices - java ee vs spring boot and spring cloud
Microservices - java ee vs spring boot and spring cloudMicroservices - java ee vs spring boot and spring cloud
Microservices - java ee vs spring boot and spring cloud
Ben Wilcock
 
Rediscovering Spring with Spring Boot(1)
Rediscovering Spring with Spring Boot(1)Rediscovering Spring with Spring Boot(1)
Rediscovering Spring with Spring Boot(1)
Gunith Devasurendra
 
White paper mbre_en
White paper mbre_enWhite paper mbre_en
White paper mbre_en
VisioneerUG
 
Spring Boot and Microservices
Spring Boot and MicroservicesSpring Boot and Microservices
Spring Boot and Microservices
seges
 
Spring Cloud: Why? How? What?
Spring Cloud: Why? How? What?Spring Cloud: Why? How? What?
Spring Cloud: Why? How? What?
Orkhan Gasimov
 
Resilient Microservices with Spring Cloud
Resilient Microservices with Spring CloudResilient Microservices with Spring Cloud
Resilient Microservices with Spring Cloud
VMware Tanzu
 
Testing Microservices
Testing MicroservicesTesting Microservices
Testing Microservices
Anil Allewar
 
A Series of Fortunate Events: Building an Operator in Java
A Series of Fortunate Events: Building an Operator in JavaA Series of Fortunate Events: Building an Operator in Java
A Series of Fortunate Events: Building an Operator in Java
VMware Tanzu
 
What We Learned from Porting PiggyMetrics from Spring Boot to MicroProfile
What We Learned from Porting PiggyMetrics from Spring Boot to MicroProfileWhat We Learned from Porting PiggyMetrics from Spring Boot to MicroProfile
What We Learned from Porting PiggyMetrics from Spring Boot to MicroProfile
Ed Burns
 
Spring cloud for microservices architecture
Spring cloud for microservices architectureSpring cloud for microservices architecture
Spring cloud for microservices architecture
Igor Khotin
 
What’s New in Spring Data MongoDB
What’s New in Spring Data MongoDBWhat’s New in Spring Data MongoDB
What’s New in Spring Data MongoDB
VMware Tanzu
 
What’s New in Spring Batch?
What’s New in Spring Batch?What’s New in Spring Batch?
What’s New in Spring Batch?
VMware Tanzu
 

Similar to Java springboot microservice - Accenture Technology Meetup (20)

Getting Started with API Management – Why It's Needed On-prem and in the Cloud
Getting Started with API Management – Why It's Needed On-prem and in the CloudGetting Started with API Management – Why It's Needed On-prem and in the Cloud
Getting Started with API Management – Why It's Needed On-prem and in the Cloud
Revelation Technologies
 
Webinar - Building Custom Extensions With AppDynamics
Webinar - Building Custom Extensions With AppDynamicsWebinar - Building Custom Extensions With AppDynamics
Webinar - Building Custom Extensions With AppDynamics
Todd Radel
 
Microservices with Node.js and Apache Cassandra
Microservices with Node.js and Apache CassandraMicroservices with Node.js and Apache Cassandra
Microservices with Node.js and Apache Cassandra
Jorge Bay Gondra
 
Simplify and Scale Enterprise Apps in the Cloud | Boston 2023
Simplify and Scale Enterprise Apps in the Cloud | Boston 2023Simplify and Scale Enterprise Apps in the Cloud | Boston 2023
Simplify and Scale Enterprise Apps in the Cloud | Boston 2023
VMware Tanzu
 
Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023
Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023
Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023
VMware Tanzu
 
Structured Functional Automated Web Service Testing
Structured Functional Automated Web Service TestingStructured Functional Automated Web Service Testing
Structured Functional Automated Web Service Testing
rdekleijn
 
Hands-On Lab: Improve large network visibility and operational efficiency wit...
Hands-On Lab: Improve large network visibility and operational efficiency wit...Hands-On Lab: Improve large network visibility and operational efficiency wit...
Hands-On Lab: Improve large network visibility and operational efficiency wit...
CA Technologies
 
NET Aspire - NET Conf IL 2024 - Tamir Dresher.pdf
NET Aspire - NET Conf IL 2024 - Tamir Dresher.pdfNET Aspire - NET Conf IL 2024 - Tamir Dresher.pdf
NET Aspire - NET Conf IL 2024 - Tamir Dresher.pdf
Tamir Dresher
 
MongoDB.local Seattle 2019: MongoDB Stitch Tutorial
MongoDB.local Seattle 2019: MongoDB Stitch TutorialMongoDB.local Seattle 2019: MongoDB Stitch Tutorial
MongoDB.local Seattle 2019: MongoDB Stitch Tutorial
MongoDB
 
Building 12-factor Cloud Native Microservices
Building 12-factor Cloud Native MicroservicesBuilding 12-factor Cloud Native Microservices
Building 12-factor Cloud Native Microservices
Jakarta_EE
 
Journey to containers by Chet Lintz - AWS Chicago Jan 17,2018 user group on C...
Journey to containers by Chet Lintz - AWS Chicago Jan 17,2018 user group on C...Journey to containers by Chet Lintz - AWS Chicago Jan 17,2018 user group on C...
Journey to containers by Chet Lintz - AWS Chicago Jan 17,2018 user group on C...
AWS Chicago
 
Clean Architecture @ Taxibeat
Clean Architecture @ TaxibeatClean Architecture @ Taxibeat
Clean Architecture @ Taxibeat
Michael Bakogiannis
 
SERVERLESS MIDDLEWARE IN AZURE FUNCTIONS
SERVERLESS MIDDLEWARE IN AZURE FUNCTIONSSERVERLESS MIDDLEWARE IN AZURE FUNCTIONS
SERVERLESS MIDDLEWARE IN AZURE FUNCTIONS
CodeOps Technologies LLP
 
Click2Cloud UAT Tool
Click2Cloud UAT ToolClick2Cloud UAT Tool
Click2Cloud UAT Tool
Click2Cloud Inc
 
Spring Boot - Microservice Metrics Monitoring
Spring Boot - Microservice Metrics MonitoringSpring Boot - Microservice Metrics Monitoring
Spring Boot - Microservice Metrics Monitoring
DonghuKIM2
 
Spring boot microservice metrics monitoring
Spring boot   microservice metrics monitoringSpring boot   microservice metrics monitoring
Spring boot microservice metrics monitoring
Oracle Korea
 
MongoDB.local Atlanta: MongoDB Stitch Tutorial
MongoDB.local Atlanta: MongoDB Stitch TutorialMongoDB.local Atlanta: MongoDB Stitch Tutorial
MongoDB.local Atlanta: MongoDB Stitch Tutorial
MongoDB
 
Microservices and APIs
Microservices and APIsMicroservices and APIs
Microservices and APIs
Puneet Sachdev
 
Microsoft365_Dev_Security_2024_05_16.pdf
Microsoft365_Dev_Security_2024_05_16.pdfMicrosoft365_Dev_Security_2024_05_16.pdf
Microsoft365_Dev_Security_2024_05_16.pdf
Markus Moeller
 
Performance testing - Accenture
Performance testing - AccenturePerformance testing - Accenture
Performance testing - Accenture
GeetikaVerma16
 
Getting Started with API Management – Why It's Needed On-prem and in the Cloud
Getting Started with API Management – Why It's Needed On-prem and in the CloudGetting Started with API Management – Why It's Needed On-prem and in the Cloud
Getting Started with API Management – Why It's Needed On-prem and in the Cloud
Revelation Technologies
 
Webinar - Building Custom Extensions With AppDynamics
Webinar - Building Custom Extensions With AppDynamicsWebinar - Building Custom Extensions With AppDynamics
Webinar - Building Custom Extensions With AppDynamics
Todd Radel
 
Microservices with Node.js and Apache Cassandra
Microservices with Node.js and Apache CassandraMicroservices with Node.js and Apache Cassandra
Microservices with Node.js and Apache Cassandra
Jorge Bay Gondra
 
Simplify and Scale Enterprise Apps in the Cloud | Boston 2023
Simplify and Scale Enterprise Apps in the Cloud | Boston 2023Simplify and Scale Enterprise Apps in the Cloud | Boston 2023
Simplify and Scale Enterprise Apps in the Cloud | Boston 2023
VMware Tanzu
 
Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023
Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023
Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023
VMware Tanzu
 
Structured Functional Automated Web Service Testing
Structured Functional Automated Web Service TestingStructured Functional Automated Web Service Testing
Structured Functional Automated Web Service Testing
rdekleijn
 
Hands-On Lab: Improve large network visibility and operational efficiency wit...
Hands-On Lab: Improve large network visibility and operational efficiency wit...Hands-On Lab: Improve large network visibility and operational efficiency wit...
Hands-On Lab: Improve large network visibility and operational efficiency wit...
CA Technologies
 
NET Aspire - NET Conf IL 2024 - Tamir Dresher.pdf
NET Aspire - NET Conf IL 2024 - Tamir Dresher.pdfNET Aspire - NET Conf IL 2024 - Tamir Dresher.pdf
NET Aspire - NET Conf IL 2024 - Tamir Dresher.pdf
Tamir Dresher
 
MongoDB.local Seattle 2019: MongoDB Stitch Tutorial
MongoDB.local Seattle 2019: MongoDB Stitch TutorialMongoDB.local Seattle 2019: MongoDB Stitch Tutorial
MongoDB.local Seattle 2019: MongoDB Stitch Tutorial
MongoDB
 
Building 12-factor Cloud Native Microservices
Building 12-factor Cloud Native MicroservicesBuilding 12-factor Cloud Native Microservices
Building 12-factor Cloud Native Microservices
Jakarta_EE
 
Journey to containers by Chet Lintz - AWS Chicago Jan 17,2018 user group on C...
Journey to containers by Chet Lintz - AWS Chicago Jan 17,2018 user group on C...Journey to containers by Chet Lintz - AWS Chicago Jan 17,2018 user group on C...
Journey to containers by Chet Lintz - AWS Chicago Jan 17,2018 user group on C...
AWS Chicago
 
Spring Boot - Microservice Metrics Monitoring
Spring Boot - Microservice Metrics MonitoringSpring Boot - Microservice Metrics Monitoring
Spring Boot - Microservice Metrics Monitoring
DonghuKIM2
 
Spring boot microservice metrics monitoring
Spring boot   microservice metrics monitoringSpring boot   microservice metrics monitoring
Spring boot microservice metrics monitoring
Oracle Korea
 
MongoDB.local Atlanta: MongoDB Stitch Tutorial
MongoDB.local Atlanta: MongoDB Stitch TutorialMongoDB.local Atlanta: MongoDB Stitch Tutorial
MongoDB.local Atlanta: MongoDB Stitch Tutorial
MongoDB
 
Microservices and APIs
Microservices and APIsMicroservices and APIs
Microservices and APIs
Puneet Sachdev
 
Microsoft365_Dev_Security_2024_05_16.pdf
Microsoft365_Dev_Security_2024_05_16.pdfMicrosoft365_Dev_Security_2024_05_16.pdf
Microsoft365_Dev_Security_2024_05_16.pdf
Markus Moeller
 
Performance testing - Accenture
Performance testing - AccenturePerformance testing - Accenture
Performance testing - Accenture
GeetikaVerma16
 
Ad

More from Accenture Hungary (13)

Virtual validation tool
Virtual validation toolVirtual validation tool
Virtual validation tool
Accenture Hungary
 
Salesforce meetup | Custom document generation
Salesforce meetup | Custom document generationSalesforce meetup | Custom document generation
Salesforce meetup | Custom document generation
Accenture Hungary
 
Salesforce meetup | Lightning Web Component
Salesforce meetup | Lightning Web ComponentSalesforce meetup | Lightning Web Component
Salesforce meetup | Lightning Web Component
Accenture Hungary
 
Industry X.0 | Smart Factory | Session no.3
Industry X.0 | Smart Factory | Session no.3Industry X.0 | Smart Factory | Session no.3
Industry X.0 | Smart Factory | Session no.3
Accenture Hungary
 
Accenture Salesforce Developer Meetup vol 1 2019
Accenture Salesforce Developer Meetup vol 1 2019Accenture Salesforce Developer Meetup vol 1 2019
Accenture Salesforce Developer Meetup vol 1 2019
Accenture Hungary
 
PLC Student Meetup
PLC Student MeetupPLC Student Meetup
PLC Student Meetup
Accenture Hungary
 
Industry X.0 | Smart Factory | Session no.2
Industry X.0 | Smart Factory | Session no.2Industry X.0 | Smart Factory | Session no.2
Industry X.0 | Smart Factory | Session no.2
Accenture Hungary
 
SAP S4/HANA meetup overview
SAP S4/HANA meetup overview SAP S4/HANA meetup overview
SAP S4/HANA meetup overview
Accenture Hungary
 
Industry X.0 | Smart Factory | Session no.1
Industry X.0 | Smart Factory | Session no.1Industry X.0 | Smart Factory | Session no.1
Industry X.0 | Smart Factory | Session no.1
Accenture Hungary
 
Accenture Java meetup
Accenture Java meetupAccenture Java meetup
Accenture Java meetup
Accenture Hungary
 
Introduction to NEW SAP - Accenture Technology Meetup
Introduction to NEW SAP - Accenture Technology MeetupIntroduction to NEW SAP - Accenture Technology Meetup
Introduction to NEW SAP - Accenture Technology Meetup
Accenture Hungary
 
SCADA a gyakorlatban - Accenture Industry X.0 Meetup
SCADA a gyakorlatban - Accenture Industry X.0 MeetupSCADA a gyakorlatban - Accenture Industry X.0 Meetup
SCADA a gyakorlatban - Accenture Industry X.0 Meetup
Accenture Hungary
 
Digital Thread & Digital Twin
Digital Thread & Digital TwinDigital Thread & Digital Twin
Digital Thread & Digital Twin
Accenture Hungary
 
Salesforce meetup | Custom document generation
Salesforce meetup | Custom document generationSalesforce meetup | Custom document generation
Salesforce meetup | Custom document generation
Accenture Hungary
 
Salesforce meetup | Lightning Web Component
Salesforce meetup | Lightning Web ComponentSalesforce meetup | Lightning Web Component
Salesforce meetup | Lightning Web Component
Accenture Hungary
 
Industry X.0 | Smart Factory | Session no.3
Industry X.0 | Smart Factory | Session no.3Industry X.0 | Smart Factory | Session no.3
Industry X.0 | Smart Factory | Session no.3
Accenture Hungary
 
Accenture Salesforce Developer Meetup vol 1 2019
Accenture Salesforce Developer Meetup vol 1 2019Accenture Salesforce Developer Meetup vol 1 2019
Accenture Salesforce Developer Meetup vol 1 2019
Accenture Hungary
 
Industry X.0 | Smart Factory | Session no.2
Industry X.0 | Smart Factory | Session no.2Industry X.0 | Smart Factory | Session no.2
Industry X.0 | Smart Factory | Session no.2
Accenture Hungary
 
SAP S4/HANA meetup overview
SAP S4/HANA meetup overview SAP S4/HANA meetup overview
SAP S4/HANA meetup overview
Accenture Hungary
 
Industry X.0 | Smart Factory | Session no.1
Industry X.0 | Smart Factory | Session no.1Industry X.0 | Smart Factory | Session no.1
Industry X.0 | Smart Factory | Session no.1
Accenture Hungary
 
Introduction to NEW SAP - Accenture Technology Meetup
Introduction to NEW SAP - Accenture Technology MeetupIntroduction to NEW SAP - Accenture Technology Meetup
Introduction to NEW SAP - Accenture Technology Meetup
Accenture Hungary
 
SCADA a gyakorlatban - Accenture Industry X.0 Meetup
SCADA a gyakorlatban - Accenture Industry X.0 MeetupSCADA a gyakorlatban - Accenture Industry X.0 Meetup
SCADA a gyakorlatban - Accenture Industry X.0 Meetup
Accenture Hungary
 
Digital Thread & Digital Twin
Digital Thread & Digital TwinDigital Thread & Digital Twin
Digital Thread & Digital Twin
Accenture Hungary
 
Ad

Recently uploaded (20)

[gbgcpp] Let's get comfortable with concepts
[gbgcpp] Let's get comfortable with concepts[gbgcpp] Let's get comfortable with concepts
[gbgcpp] Let's get comfortable with concepts
Dimitrios Platis
 
Download 4k Video Downloader Crack Pre-Activated
Download 4k Video Downloader Crack Pre-ActivatedDownload 4k Video Downloader Crack Pre-Activated
Download 4k Video Downloader Crack Pre-Activated
Web Designer
 
Adobe InDesign Crack FREE Download 2025 link
Adobe InDesign Crack FREE Download 2025 linkAdobe InDesign Crack FREE Download 2025 link
Adobe InDesign Crack FREE Download 2025 link
mahmadzubair09
 
Time Estimation: Expert Tips & Proven Project Techniques
Time Estimation: Expert Tips & Proven Project TechniquesTime Estimation: Expert Tips & Proven Project Techniques
Time Estimation: Expert Tips & Proven Project Techniques
Livetecs LLC
 
Troubleshooting JVM Outages – 3 Fortune 500 case studies
Troubleshooting JVM Outages – 3 Fortune 500 case studiesTroubleshooting JVM Outages – 3 Fortune 500 case studies
Troubleshooting JVM Outages – 3 Fortune 500 case studies
Tier1 app
 
Autodesk Inventor Crack (2025) Latest
Autodesk Inventor    Crack (2025) LatestAutodesk Inventor    Crack (2025) Latest
Autodesk Inventor Crack (2025) Latest
Google
 
!%& IDM Crack with Internet Download Manager 6.42 Build 32 >
!%& IDM Crack with Internet Download Manager 6.42 Build 32 >!%& IDM Crack with Internet Download Manager 6.42 Build 32 >
!%& IDM Crack with Internet Download Manager 6.42 Build 32 >
Ranking Google
 
Why Tapitag Ranks Among the Best Digital Business Card Providers
Why Tapitag Ranks Among the Best Digital Business Card ProvidersWhy Tapitag Ranks Among the Best Digital Business Card Providers
Why Tapitag Ranks Among the Best Digital Business Card Providers
Tapitag
 
The-Future-is-Hybrid-Exploring-Azure’s-Role-in-Multi-Cloud-Strategies.pptx
The-Future-is-Hybrid-Exploring-Azure’s-Role-in-Multi-Cloud-Strategies.pptxThe-Future-is-Hybrid-Exploring-Azure’s-Role-in-Multi-Cloud-Strategies.pptx
The-Future-is-Hybrid-Exploring-Azure’s-Role-in-Multi-Cloud-Strategies.pptx
james brownuae
 
Surviving a Downturn Making Smarter Portfolio Decisions with OnePlan - Webina...
Surviving a Downturn Making Smarter Portfolio Decisions with OnePlan - Webina...Surviving a Downturn Making Smarter Portfolio Decisions with OnePlan - Webina...
Surviving a Downturn Making Smarter Portfolio Decisions with OnePlan - Webina...
OnePlan Solutions
 
Download MathType Crack Version 2025???
Download MathType Crack  Version 2025???Download MathType Crack  Version 2025???
Download MathType Crack Version 2025???
Google
 
Exchange Migration Tool- Shoviv Software
Exchange Migration Tool- Shoviv SoftwareExchange Migration Tool- Shoviv Software
Exchange Migration Tool- Shoviv Software
Shoviv Software
 
Memory Management and Leaks in Postgres from pgext.day 2025
Memory Management and Leaks in Postgres from pgext.day 2025Memory Management and Leaks in Postgres from pgext.day 2025
Memory Management and Leaks in Postgres from pgext.day 2025
Phil Eaton
 
How to Troubleshoot 9 Types of OutOfMemoryError
How to Troubleshoot 9 Types of OutOfMemoryErrorHow to Troubleshoot 9 Types of OutOfMemoryError
How to Troubleshoot 9 Types of OutOfMemoryError
Tier1 app
 
Mastering Selenium WebDriver: A Comprehensive Tutorial with Real-World Examples
Mastering Selenium WebDriver: A Comprehensive Tutorial with Real-World ExamplesMastering Selenium WebDriver: A Comprehensive Tutorial with Real-World Examples
Mastering Selenium WebDriver: A Comprehensive Tutorial with Real-World Examples
jamescantor38
 
Artificial hand using embedded system.pptx
Artificial hand using embedded system.pptxArtificial hand using embedded system.pptx
Artificial hand using embedded system.pptx
bhoomigowda12345
 
Adobe Audition Crack FRESH Version 2025 FREE
Adobe Audition Crack FRESH Version 2025 FREEAdobe Audition Crack FRESH Version 2025 FREE
Adobe Audition Crack FRESH Version 2025 FREE
zafranwaqar90
 
Serato DJ Pro Crack Latest Version 2025??
Serato DJ Pro Crack Latest Version 2025??Serato DJ Pro Crack Latest Version 2025??
Serato DJ Pro Crack Latest Version 2025??
Web Designer
 
Beyond the code. Complexity - 2025.05 - SwiftCraft
Beyond the code. Complexity - 2025.05 - SwiftCraftBeyond the code. Complexity - 2025.05 - SwiftCraft
Beyond the code. Complexity - 2025.05 - SwiftCraft
Dmitrii Ivanov
 
Digital Twins Software Service in Belfast
Digital Twins Software Service in BelfastDigital Twins Software Service in Belfast
Digital Twins Software Service in Belfast
julia smits
 
[gbgcpp] Let's get comfortable with concepts
[gbgcpp] Let's get comfortable with concepts[gbgcpp] Let's get comfortable with concepts
[gbgcpp] Let's get comfortable with concepts
Dimitrios Platis
 
Download 4k Video Downloader Crack Pre-Activated
Download 4k Video Downloader Crack Pre-ActivatedDownload 4k Video Downloader Crack Pre-Activated
Download 4k Video Downloader Crack Pre-Activated
Web Designer
 
Adobe InDesign Crack FREE Download 2025 link
Adobe InDesign Crack FREE Download 2025 linkAdobe InDesign Crack FREE Download 2025 link
Adobe InDesign Crack FREE Download 2025 link
mahmadzubair09
 
Time Estimation: Expert Tips & Proven Project Techniques
Time Estimation: Expert Tips & Proven Project TechniquesTime Estimation: Expert Tips & Proven Project Techniques
Time Estimation: Expert Tips & Proven Project Techniques
Livetecs LLC
 
Troubleshooting JVM Outages – 3 Fortune 500 case studies
Troubleshooting JVM Outages – 3 Fortune 500 case studiesTroubleshooting JVM Outages – 3 Fortune 500 case studies
Troubleshooting JVM Outages – 3 Fortune 500 case studies
Tier1 app
 
Autodesk Inventor Crack (2025) Latest
Autodesk Inventor    Crack (2025) LatestAutodesk Inventor    Crack (2025) Latest
Autodesk Inventor Crack (2025) Latest
Google
 
!%& IDM Crack with Internet Download Manager 6.42 Build 32 >
!%& IDM Crack with Internet Download Manager 6.42 Build 32 >!%& IDM Crack with Internet Download Manager 6.42 Build 32 >
!%& IDM Crack with Internet Download Manager 6.42 Build 32 >
Ranking Google
 
Why Tapitag Ranks Among the Best Digital Business Card Providers
Why Tapitag Ranks Among the Best Digital Business Card ProvidersWhy Tapitag Ranks Among the Best Digital Business Card Providers
Why Tapitag Ranks Among the Best Digital Business Card Providers
Tapitag
 
The-Future-is-Hybrid-Exploring-Azure’s-Role-in-Multi-Cloud-Strategies.pptx
The-Future-is-Hybrid-Exploring-Azure’s-Role-in-Multi-Cloud-Strategies.pptxThe-Future-is-Hybrid-Exploring-Azure’s-Role-in-Multi-Cloud-Strategies.pptx
The-Future-is-Hybrid-Exploring-Azure’s-Role-in-Multi-Cloud-Strategies.pptx
james brownuae
 
Surviving a Downturn Making Smarter Portfolio Decisions with OnePlan - Webina...
Surviving a Downturn Making Smarter Portfolio Decisions with OnePlan - Webina...Surviving a Downturn Making Smarter Portfolio Decisions with OnePlan - Webina...
Surviving a Downturn Making Smarter Portfolio Decisions with OnePlan - Webina...
OnePlan Solutions
 
Download MathType Crack Version 2025???
Download MathType Crack  Version 2025???Download MathType Crack  Version 2025???
Download MathType Crack Version 2025???
Google
 
Exchange Migration Tool- Shoviv Software
Exchange Migration Tool- Shoviv SoftwareExchange Migration Tool- Shoviv Software
Exchange Migration Tool- Shoviv Software
Shoviv Software
 
Memory Management and Leaks in Postgres from pgext.day 2025
Memory Management and Leaks in Postgres from pgext.day 2025Memory Management and Leaks in Postgres from pgext.day 2025
Memory Management and Leaks in Postgres from pgext.day 2025
Phil Eaton
 
How to Troubleshoot 9 Types of OutOfMemoryError
How to Troubleshoot 9 Types of OutOfMemoryErrorHow to Troubleshoot 9 Types of OutOfMemoryError
How to Troubleshoot 9 Types of OutOfMemoryError
Tier1 app
 
Mastering Selenium WebDriver: A Comprehensive Tutorial with Real-World Examples
Mastering Selenium WebDriver: A Comprehensive Tutorial with Real-World ExamplesMastering Selenium WebDriver: A Comprehensive Tutorial with Real-World Examples
Mastering Selenium WebDriver: A Comprehensive Tutorial with Real-World Examples
jamescantor38
 
Artificial hand using embedded system.pptx
Artificial hand using embedded system.pptxArtificial hand using embedded system.pptx
Artificial hand using embedded system.pptx
bhoomigowda12345
 
Adobe Audition Crack FRESH Version 2025 FREE
Adobe Audition Crack FRESH Version 2025 FREEAdobe Audition Crack FRESH Version 2025 FREE
Adobe Audition Crack FRESH Version 2025 FREE
zafranwaqar90
 
Serato DJ Pro Crack Latest Version 2025??
Serato DJ Pro Crack Latest Version 2025??Serato DJ Pro Crack Latest Version 2025??
Serato DJ Pro Crack Latest Version 2025??
Web Designer
 
Beyond the code. Complexity - 2025.05 - SwiftCraft
Beyond the code. Complexity - 2025.05 - SwiftCraftBeyond the code. Complexity - 2025.05 - SwiftCraft
Beyond the code. Complexity - 2025.05 - SwiftCraft
Dmitrii Ivanov
 
Digital Twins Software Service in Belfast
Digital Twins Software Service in BelfastDigital Twins Software Service in Belfast
Digital Twins Software Service in Belfast
julia smits
 

Java springboot microservice - Accenture Technology Meetup

  • 2. • Application as a suit of small services • Services are split around business capability • Lightweight • smaller the better • Services are independent • Better testability • Better deployability • Improved fault isolation and tolerance • Great agility and scalability MICROSERVICES Copyright © 2018 Accenture. All rights reserved. 2
  • 3. • CRUD operations • get, post, put, delete • Should get all data needed • Header • URL (path, request parameters) • Body (content type?) MICROSERVICE BASICS Copyright © 2018 Accenture. All rights reserved. 3
  • 4. • Naming is consequent with function • GET /meetup/team • POST /meetup/team – -> Location: /meetup/team/{id} • GET /meetup/team/{id} • PUT /meetup/team/{id} • DELETE /meetup/team/{id} SERVICE URLS Copyright © 2018 Accenture. All rights reserved. 4
  • 5. • Headers • Accept • Content-Type • Authentication • Accept-Language • Location • Allow-Origin HEADERS Copyright © 2018 Accenture. All rights reserved. 5
  • 6. • 200 - OK • 201 - Created • 204 - No content • 401 - Unauthorized • 403 - Forbidden • 404 - Not found • 406 - Not acceptable • 409 - Conflict • 415 - Unsupported media type • 422 - Unprocessable entity RESPONSE CODES Copyright © 2018 Accenture. All rights reserved. 6
  • 7. • REST vs SOAP • Data is provided as input, no state stored • JSON vs html • Calling external services • Dependencies should be avoided • Shared data between services • Keep as low as possible TO DO, OR NOT TO DO? Copyright © 2018 Accenture. All rights reserved. 7
  • 8. • data • mvc • web • aop • annotations • boot • cloud SPRING FUNCTIONS Copyright © 2018 Accenture. All rights reserved. 8
  • 9. • Swiss army knife toolkit • Stand-alone Spring application • Runnable JAR file • Tested for stability • No dependency issues • Runnable jar • Embedded application server • Gradle or Maven support • Low overhead SPRING BOOT - BASICS Copyright © 2018 Accenture. All rights reserved. 9 <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.0.1.RELEASE</version> </parent> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> </dependencies>
  • 10. • @SpringBootApplication • main() APPLICATION Copyright © 2018 Accenture. All rights reserved. 10 @SpringBootApplication public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } }
  • 11. • @RestController • @RequestMapping CONTROLLER ANNOTATION Copyright © 2018 Accenture. All rights reserved. 11 @RestController public class MeetupController { @Autowired private MeetupService meetupService; @RequestMapping(value = "/person/{id}", method = RequestMethod.GET) public Optional<Person> getPerson(HttpServletRequest httpServletRequest, @PathVariable("id") String id) { return meetupService.getPerson(id); }
  • 12. • To handle HTTP OPTIONS call • Implemented as filter • Headers returned • Access-Control-Allow-Methods • Access-Control-Allow-Headers • Access-Control-Allow-Origin • Access-Control-Max-Age • Access-Control-Allow-Credentials CORS FILTER Copyright © 2018 Accenture. All rights reserved. 12
  • 13. • LoggingFilter • HTTP Request and response – Headers, URL and params – doFilter • ControllerLoggerAspect • @Component • @Aspect • @Before({pointcut}) LOGGING ASPECTS Copyright © 2018 Accenture. All rights reserved. 13 @Aspect @Component public class ControllerLoggerAspect { @Before("execution(* com.accenture.meetup.controller.MeetupController.*(..))") public void logBefore(JoinPoint joinPoint) { } } } @Component public class LoggingFilter implements Filter { @Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) { } }
  • 14. • @ControllerAdvice • implements RequestBodyAdvice – boolean supports(...) – beforeBodyRead(...) – afterBodyRead(...) – handleEmptyBody(...) • implements ResponseBodyAdvice – boolean supports(...) – beforeBodyWrite(...) REQUEST AND RESPONSE BODY Copyright © 2018 Accenture. All rights reserved. 14 @ControllerAdvice public class RequestBodyLogger implements RequestBodyAdvice { @Override public boolean supports(MethodParameter methodParameter, Type targetType, Class<? extends HttpMessageConverter<?>> converterType) { } @Override public Object handleEmptyBody(Object body, HttpInputMessage inputMessage, MethodParameter parameter, Type targetType, Class<? extends HttpMessageConverter<?>> converterType) { } @Override public HttpInputMessage beforeBodyRead(HttpInputMessage inputMessage, MethodParameter parameter, Type targetType, Class<? extends HttpMessageConverter<?>> converterType) { } @Override public Object afterBodyRead(Object body, HttpInputMessage inputMessage, MethodParameter parameter, Type targetType, Class<? extends HttpMessageConverter<?>> converterType) { } }
  • 15. • Implemented as ControllerAdvice • @ControllerAdvice • Based on exception type • @ExceptionHandler • Sets HTTP error codes • @ResponseStatus ERROR HANDLER Copyright © 2018 Accenture. All rights reserved. 15 @ControllerAdvice public class GlobalExceptionHandler extends ResponseEntityExceptionHandler { @ExceptionHandler(NotFoundException.class) @ResponseStatus(value = HttpStatus.NOT_FOUND) public void handleNotFoundException(NotFoundException e) { logger.error(e.getMessage()); } }
  • 16. • spring-data • One for each entity • @Repository • extends CrudRepository(<T, ID>) – save – findById – deleteById DATABASE ACCESS Copyright © 2018 Accenture. All rights reserved. 16 @Repository public interface TeamRepository extends CrudRepository<Team, String> { }
  • 17. • Unit tests • In memory database (h2) • Mockito and mock mvc for controller - TDD • Cucumber – BDD • Sonar – quality gates • PACT – contract QUALITY CONTROL Copyright © 2018 Accenture. All rights reserved. 17
  • 18. • Uses real service • Includes filters, aspects and error handlers • @AutoConfigureMockMvc • @SpringBootTest • @RunWith(Springrunner.class) • mvc.perform() MOCK MVC Copyright © 2018 Accenture. All rights reserved. 18 @RunWith(SpringRunner.class) @SpringBootTest @AutoConfigureMockMvc public class MeetupControllerTest { @Autowired private MockMvc mvc; @Test public void getHealthcheck() throws Exception { mvc.perform(MockMvcRequestBuilders.get("/healthcheck") .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()); } }
  • 19. • Contract based interface verification • Mock services and interactions • DSM format • pact-mock-server • Can be generated PACT Copyright © 2018 Accenture. All rights reserved. 19 Contract Partner A e.g. CLIENT Contract Partner B e.g. BACK END PACT
  • 20. • Root interaction • Options request • Acceptance vs Compatibility • Header and body matching • Samples by value generators • Json objects PACT – BEST PRACTICES Copyright © 2018 Accenture. All rights reserved. 20
  • 21. Copyright © 2018 Accenture. All rights reserved. 21 • Describes Behaviour – BDD • Human readable • POs and BAs can also understand – Given... – When... – Then... • Scenarios and Scenariooutlines with examples CUCUMBER
  • 22. • Physical hardware • chroot jail, selinux • VMware, Hyper-V • shared libs? • docker (expendables) • docker builder • swarm (there's more) DOCKER EVOLUTION Copyright © 2018 Accenture. All rights reserved. 22
  • 23. • perfect match • easy to... • integrate (jenkins, maven) • deploy • scale • Can be automatically built • maven, gradle etc. • Can be automatically deployed • CI, CD, jenkins, bamboo etc. SPRINGBOOT AND DOCKER Copyright © 2018 Accenture. All rights reserved. 23
  • 24. • Health check • spring-actuator • Logging • Monitoring • Sizing (jvm, cpu) CONSIDERATIONS Copyright © 2018 Accenture. All rights reserved. 24
  • 25. • microservice basics • springboot • cucumber • pact • docker SUMMARY Copyright © 2018 Accenture. All rights reserved. 25
  • 26. THANK YOU Copyright © 2018 Accenture. All rights reserved. 26 accenture.hu
  翻译: