@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();
}
}
@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
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 |