Skip to content

Instantly share code, notes, and snippets.

@danieltnaves
Created October 30, 2016 18:37
Show Gist options
  • Save danieltnaves/15baa7459465bb6e04b4693d8af74ed4 to your computer and use it in GitHub Desktop.
Save danieltnaves/15baa7459465bb6e04b4693d8af74ed4 to your computer and use it in GitHub Desktop.
Expose DatabaseManagerSwing start via JMX
package br.com.naves.configuration.db;
import org.hsqldb.util.DatabaseManagerSwing;
import org.springframework.context.annotation.Profile;
import org.springframework.jmx.export.annotation.ManagedOperation;
import org.springframework.jmx.export.annotation.ManagedResource;
import org.springframework.stereotype.Component;
@Component
@ManagedResource(objectName="br.com.naves.configuration.db:name=DevelopmentDatabaseManager",
description = "Essa classe expõe métodos para o gerenciamento"
+ "do banco de dados HSQL usado apenas durante o desenvolvimento")
@Profile("development")
public class DevelopmentDatabaseManagerSwing {
@ManagedOperation
public void startDBManager() {
//hsqldb
DatabaseManagerSwing.main(new String[] { "--url", "jdbc:hsqldb:mem:testdb;sql.syntax_mys=true", "--user", "sa", "--password", "" });
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment