Being Smoooth with Spring Boot

it's just too bootful

Who am I?

What we are going to see

  • WTF is spring boot?
  • a little demo
  • Spring Boot vs Dropwizard
  • Conclusion

What does it eat?
Where it lives?

wtf is spring boot?

TOO MUCH TO HANDLE

Here comes the boot!

  • quick project start-up

  • opinionated view

  • minimum fuss

Springs User Best Friend

<3

how do I show this?

quick project start-up

Spring Initializr

Spring DevTools

opinionated view

Convention over Configuration

Auto Configuration

@Conditional(DataSourceAutoConfiguration.NonEmbeddedDataSourceCondition.class)
@ConditionalOnMissingBean({ DataSource.class, XADataSource.class })
protected static class NonEmbeddedConfiguration {

  @Autowired
  private DataSourceProperties properties;

  @Bean
  @ConfigurationProperties(prefix = DataSourceProperties.PREFIX)
  public DataSource dataSource() {
    DataSourceBuilder factory = DataSourceBuilder
        .create(this.properties.getClassLoader())
        .driverClassName(this.properties.getDriverClassName())
        .url(this.properties.getUrl()).username(this.properties.getUsername())
        .password(this.properties.getPassword());
    if (this.properties.getType() != null) {
      factory.type(this.properties.getType());
    }
    return factory.build();
  }

}

Externalized Config

same app; different envs

@project

@instance

spring:
  datasource:
    url: jdbc:postgresql://dockerhost:5432/stop_request
    username: postgres_user
    password: postgres_user
    driver-class: org.postgresql.Driver
    schema: stop_request
    validation-query: SELECT 1
    remove-abandoned: true
    test-on-borrow: true
  jpa:
    properties:
      hibernate.default_schema: stop_request
  hibernate:
    ddl-auto: validate

---
spring:
  profiles:
    active: staging
  datasource:
    url: jdbc:postgresql://staging:5432/stop_request

---
spring:
  profiles:
    active: production
  datasource:
    url: jdbc:postgresql://production-db-url:5432/stop_request

minimum fuss

Over 40 integrations

Great support from Intellij

Community Backing

Sh*t-ton of guides

Support

Widely used

Netflix micro-services uses spring-boot

Dropwizard vs
Spring Boot

Dropwizard Spring Boot
Server Jetty Tomcat, Jetty, Undertow
REST support Jersey Spring MVC, Jersey
Other service types support? Not officially AMQP, SOAP, WS, JMS, etc.
Dependency Injection Not officially. Spring DI
Persistence Dropwizard-Hibernate JPA, JDBC, Non-Relational DBs (spring data)
Jar Shaded Jar Nested Jars
Transaction Only Rest layer level Anywhere
Healthcheck & Metrics Dropwizards Builtin  Springs Builtin

Spring Boot/Dropwizard

Dropwizard is simplifying...

...Spring Boot is 

Smoooth

Conclusion

Spring is awesome!

Contact

c.franz-hoppen@klarna.com

#freja-public

WARN: caesar-ralf.franz-hoppen is my evil twin in slack! Message c.franz-hoppen

spring-boot

By Caesar Ralf Franz Hoppen