This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DbConnectionRule extends ExternalResource { | |
private DbConnectionManager connection; | |
public DbConnectionRule() { | |
} | |
@Override | |
protected void before() throws Throwable { | |
ClassPathXmlApplicationContext ctx = null; | |
try { | |
ctx = new ClassPathXmlApplicationContext("/META-INF/my-db-connection-TEST-ctx.xml"); | |
mongoDb = (DbConnectionManager) ctx.getBean("myDbConnection"); | |
} finally { | |
if (ctx != null) { | |
ctx.close(); | |
} | |
} | |
} | |
@Override | |
protected void after() { | |
} | |
public DbConnectionManager getDbConnecttion() { | |
return connection; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment