Add Guice injector to Application
This commit is contained in:
parent
d63dc601c0
commit
8c49d33731
@ -11,6 +11,8 @@ import net.sf.openrocket.logging.LogLevel;
|
|||||||
import net.sf.openrocket.logging.LogLevelBufferLogger;
|
import net.sf.openrocket.logging.LogLevelBufferLogger;
|
||||||
import net.sf.openrocket.logging.PrintStreamLogger;
|
import net.sf.openrocket.logging.PrintStreamLogger;
|
||||||
|
|
||||||
|
import com.google.inject.Injector;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A class that provides singleton instances / beans for other classes to utilize.
|
* A class that provides singleton instances / beans for other classes to utilize.
|
||||||
*
|
*
|
||||||
@ -31,6 +33,8 @@ public final class Application {
|
|||||||
|
|
||||||
private static ExceptionHandler exceptionHandler;
|
private static ExceptionHandler exceptionHandler;
|
||||||
|
|
||||||
|
private static Injector injector;
|
||||||
|
|
||||||
// Initialize the logger to something sane for testing without executing Startup
|
// Initialize the logger to something sane for testing without executing Startup
|
||||||
static {
|
static {
|
||||||
setLogOutputLevel(LogLevel.DEBUG);
|
setLogOutputLevel(LogLevel.DEBUG);
|
||||||
@ -172,5 +176,15 @@ public final class Application {
|
|||||||
Application.componentPresetDao = componentPresetDao;
|
Application.componentPresetDao = componentPresetDao;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Injector getInjector() {
|
||||||
|
return injector;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setInjector(Injector injector) {
|
||||||
|
Application.injector = injector;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ import net.sf.openrocket.logging.LogHelper;
|
|||||||
import net.sf.openrocket.util.BuildProperties;
|
import net.sf.openrocket.util.BuildProperties;
|
||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
import com.google.inject.Injector;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The second class in the OpenRocket startup sequence. This class can assume the
|
* The second class in the OpenRocket startup sequence. This class can assume the
|
||||||
@ -37,6 +38,8 @@ public class ApplicationStartup {
|
|||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private LogHelper log;
|
private LogHelper log;
|
||||||
|
@Inject
|
||||||
|
private Injector injector;
|
||||||
|
|
||||||
|
|
||||||
private static final String THRUSTCURVE_DIRECTORY = "datafiles/thrustcurves/";
|
private static final String THRUSTCURVE_DIRECTORY = "datafiles/thrustcurves/";
|
||||||
@ -50,6 +53,10 @@ public class ApplicationStartup {
|
|||||||
|
|
||||||
log.info("Starting up OpenRocket version " + BuildProperties.getVersion());
|
log.info("Starting up OpenRocket version " + BuildProperties.getVersion());
|
||||||
|
|
||||||
|
Application.setInjector(injector);
|
||||||
|
|
||||||
|
Thread.sleep(1000);
|
||||||
|
|
||||||
// Check that we're not running headless
|
// Check that we're not running headless
|
||||||
log.info("Checking for graphics head");
|
log.info("Checking for graphics head");
|
||||||
checkHead();
|
checkHead();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user