Skip to content

Instantly share code, notes, and snippets.

@d10xa
Created August 26, 2015 05:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save d10xa/8c530a9c166ecb378c9e to your computer and use it in GitHub Desktop.
Save d10xa/8c530a9c166ecb378c9e to your computer and use it in GitHub Desktop.
package ru.d10xa.sample.config;
import org.h2.tools.Server;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;
import java.sql.SQLException;
@Configuration
public class H2ServerConfig {
@Bean(destroyMethod = "stop", initMethod = "start")
@DependsOn("h2WebServer")
public org.h2.tools.Server h2Server() throws SQLException {
return new Server().createTcpServer("-tcp", "-tcpAllowOthers", "-tcpPort", "9092");
}
@Bean(destroyMethod = "stop", initMethod = "start")
public org.h2.tools.Server h2WebServer() throws SQLException {
return new Server().createWebServer("-web", "-webAllowOthers", "-webPort", "8082");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment