Spring boot

Ebean is now aware of Spring boot runnable jar structure (for scanning the classpath). There is an example application showing:

This example does not show integration with Spring transactions (and instead uses Ebean's own transactions). Please review the ebean-spring project for that.


The ebean-spring provides a FactoryBean as well as integration with Spring transactions.

<dependency org="${groupid}" name="${artifactid}" rev="${version_str}"/>
  @Grab(group='${groupid}', module='${artifactid}', version='${version_str}')
libraryDependencies += "${groupid}" % "${artifactid}" % "${version_str}"
[${groupid}/${artifactid} "${version_str}"]

EbeanServerFactoryBean is a spring FactoryBean that also holds a serverConfig. It is expected to be used in conjunction with default-ebean-server.xml which specifically registers SpringAwareJdbcTransactionManager as the external transaction manager on the ServerConfig.


SpringAwareJdbcTransactionManager implements Ebean's ExternalTransactionManager API and provides the integration into Spring transaction management.


SpringJdbcTransaction extends Ebean's ExternalJdbcTransaction and is used by SpringAwareJdbcTransactionManager.


Rather than use the implementation provided in ebean-spring you can write your own Spring FactoryBean like the code below (or the spring boot EbeanFactoryBean example Factory Bean (programmatic configuration of EbeanServer)).

 * Simple Spring bean factory for creating the EbeanServer.
public class MyEbeanServerFactory implements FactoryBean<EbeanServer> {

  public EbeanServer getObject() throws Exception {

    return createEbeanServer();

  public Class<?> getObjectType() {
    return EbeanServer.class;

  public boolean isSingleton() {
    return true;

  * Create a EbeanServer instance.
  private EbeanServer createEbeanServer() {

    ServerConfig config = new ServerConfig();

    // load configuration from ebean.properties
    // other programmatic configuration

    return EbeanServerFactory.create(config);