Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Platform Engineering with Spring Boot

Platform Engineering with Spring Boot

In a company with tens or even hundreds of developers, there is a need to align engineering practices to reduce the sprawl of complexity. Platform engineering aims to provide tools and practices so that each team doesn't have to reinvent the wheel.

In the Java world, Spring Boot offers a widely adopted programming model and brings many features and integrations out-of-the-box. It also provides an extensible platform to build upon.

In this talk, we will dive into many of Spring Boot's extensibility mechanisms to build shared libraries that integrate with whatever platform you're running your applications on so that the product teams can focus on generating value for the customers instead of building their own integrations. Along the way, we will steal a glance at features of the Java platform at Atlassian.

Tom Hombergs

June 01, 2024
Tweet

More Decks by Tom Hombergs

Other Decks in Programming

Transcript

  1. WHY PLATFORM ENGINEERING? Principal Engineer on the Java platform team

    @ Atlassian Approximately 800 production services currently run on our Spring Boot / Java stack Spring Boot is the central pillar of our Java stack
  2. Platform engineering is the discipline of designing and building toolchains

    and work fl ows that enable self-service capabilities for software engineering organisations. PLATFORM ENGINEERING from platformengineering.org
  3. Logging Tracing Auth Metrics Alerting Deployment Resources Environments Local Testing

    Project setup … (Micro-) Service platform Cloud Provider Integrations
  4. Logging Tracing Auth Metrics Alerting Deployment Resources Environments Local Testing

    Project setup … Integrations (Micro-) Service Cloud Provider
  5. Logging Tracing Auth Metrics Alerting Deployment Resources Environments Local Testing

    Project setup … Integrations (Micro-) Service Cloud Provider
  6. Logging Tracing Auth Metrics Alerting Deployment Resources Environments Local Testing

    Project setup … (Micro-) Service Cloud Provider Spring Boot + Integrations platform engineering 
 with 
 Spring Boot
  7. THE JAVA TECH STACK @ ATLASSIAN Standards Recommendations for libraries

    and tools to use. Project setup Did anyone say start.spring.io? Libraries Java libraries for (micro-) service developers. Guides How to do things with the Java platform?
  8. THE JAVA TECH STACK @ ATLASSIAN Standards Recommendations for libraries

    and tools to use. Project setup Did anyone say start.spring.io? Libraries Java libraries for (micro-) service developers. Guides How to do things with the Java platform? our focus today
  9. THE JAVA TECH STACK @ ATLASSIAN Standards Recommendations for libraries

    and tools to use. Project setup Did anyone say start.spring.io? Libraries Java libraries for (micro-) service developers. Guides How to do things with the Java platform?
  10. SPRING BOOT @ ATLASSIAN … … … … … …

    … … … … … (Micro-) Service AWS BOM Parent POM Spring Boot Starters
  11. SPRING BOOT @ ATLASSIAN Base Lifecycle … … Security …

    MVC WebFlux … … Flyway (Micro-) Service AWS BOM Parent POM Spring Boot Starters
  12. USE CASE 1: ENVIRONMENT PROFILES Platform Spring Boot Pro fi

    les Environment 
 Variable injects ENVIRONMENT=dev-east|dev-west|… Active profiles: dev, dev-west activates Environment
 PostProcessor
  13. USE CASE 2: ENVIRONMENT VARIABLE TRANSLATION Platform Spring Property Environment

    
 Variable injects OLD_ENV_VAR=foo
 NEW_ENV_VAR=foo TRANSLATED_PROPERTY=foo activates Environment
 PostProcessor
  14. USE CASE 3: DEFAULT PROPERTIES Spring Boot Spring Properties sets

    default management: tracing: sampling: probability: 0.01 (in local environment) management: tracing: sampling: probability: 1.0 @PropertySource
  15. USE CASE 4: TYPE-SAFE ENVIRONMENT VARIABLES Service Descriptor resources: -

    type: sqs name: my-queue - type: s3 name: my-bucket Platform SQS Queue S3 Bucket reads provisions Environment 
 Variables injects SQS_MY_QUEUE_NAME=…
 SQS_MY_QUEUE_URL=… SQS_MY_QUEUE_ARN=…
 SQS_MY_QUEUE_REGION=… … S3_MY_BUCKET_NAME=…
 S3_MY_BUCKET_PATH=…
 S3_MY_BUCKET_REGION=… … SQSQueueProperties activate S3BucketProperties
  16. USE CASE 5: ENFORCE BEST PRACTICE (FLYWAY) Spring Boot Platform

    integration Flyway migrations on startup enables disables Flyway migration endpoints provides
  17. SPRING (BOOT) EXTENSION POINTS Application Context Bean Bean Bean Bean

    Factory BeanDe fi nitionRegistry BeanFactory
 PostProcessor BeanDe fi nition
 RegistryPost
 Processor
 BeanPostProcessor Environment Environment
 PostProcessor Property Property Property Bean De fi nition Bean De fi nition Bean De fi nition
  18. Consuming platform integrations Annotation Con fi Always on Conditionally Manually

    - using an annotation @Configuration @Import(MyCoolAutoConfiguration.class) public class MyConfiguration { }
  19. Consuming platform integrations Annotation Con fi Always on Conditionally Manually

    - using an annotation @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE}) @Documented @Import(MyCoolAutoConfiguration.class) public @interface EnableMyCoolFeature { } @Configuration @EnableMyCoolFeature public class MyConfiguration { }
  20. Consuming platform integrations Annotation Con fi Always on Conditionally Manually

    - using an annotation @Configuration @EnableMyCoolFeature public class Application { public static void main(String[] args) { SpringApplication.run( Application.class, args); } }
  21. Consuming platform integrations Annotation Con fi Always on Conditionally Manually

    - using an annotation @Configuration @EnableMyCoolFeature public class Application { public static void main(String[] args) { SpringApplication.run( Application.class, args); } } don’t do this!
  22. Consuming platform integrations Manually - using a con fi g

    property Annotation Con fi g property Always on Conditionally # application.yml my-cool-feature: enabled: true @AutoConfiguration @ConditionalOnProperty( value = "my-cool-feature.enabled", havingValue = "true") public class MyCoolAutoConfiguration { }
  23. Consuming platform integrations Automatic - always on Annotation Con fi

    Always on Conditionally @AutoConfiguration // no @Conditional… annotation public class MyCoolAutoConfiguration { }
  24. Consuming platform integrations Automatic - conditionally Annotation Con fi Always

    on Conditionally @AutoConfiguration @ConditionalOnBean(String.class) public class MyCoolAutoConfiguration { }
  25. THE JAVA TECH STACK @ ATLASSIAN Standards Recommendations for libraries

    and tools to use. Project setup Has anyone said start.spring.io? Libraries Java libraries for (micro-) service developers. Guides How to do things with the Java platform?
  26. Encouraging adoption Standard Paved Path “Paved Path” for the project

    lifecycle OpenRewrite Support > atlas path paver install \ micros-spring-boot-mvc
  27. Encouraging adoption Standard Paved Path OpenRewrite OpenRewrite Recipes for new

    versions > ./mvnw \ io.atlassian:java-rewrite:run \ -Drewrite.fromVersion=6.9.0 \ -Drewrite.toVersion=6.12.0 Support