我是*Hapi*框架的新手.在开发过程中,每当我对代码进行任何更改时,我都必须重新启动hapi服务器.
对于视图部分,我可以添加一个选项{isCached: false}
,使视图每次都读取最新的html文件.但是,是否有一个简单的设置,使其在更改时自动重新加载代码?
更新:
感谢dylants的建议,Nodemon非常棒.
但是,在我的应用程序中有一个selenium-standalone子进程,每当nodemon
重新启动时,它都会生成一个错误日志....Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again...
我试过https://github.com/remy/nodemon#controlling-shutdown-of-your-script,它没有帮助.
我有一个spring boot项目,需要使用spring test runner进行测试(以便我可以获得真正的应用程序上下文)并模拟静态方法.
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes= MyApplication.class)
@PrepareForTest(StaticClass.class)
public class StaticClassTest {
@Rule
public PowerMockRule rule = new PowerMockRule();
@Autowired
HelloCmd hello;
@Test
public void testGetOne() {
mockStatic(StaticClass.class);
when(StaticClass.getNumber()).thenReturn(2);
System.out.println(hello.getNumber());
}
}
Run Code Online (Sandbox Code Playgroud)
运行测试时出现以下错误消息:
com.thoughtworks.xstream.converters.ConversionException: hello.hystrix.commands.HelloCmd$$EnhancerBySpringCGLIB$$a27be1be : hello.hystrix.commands.HelloCmd$$EnhancerBySpringCGLIB$$a27be1be
---- Debugging information ----
message : hello.hystrix.commands.HelloCmd$$EnhancerBySpringCGLIB$$a27be1be
cause-exception : com.thoughtworks.xstream.mapper.CannotResolveClassException
cause-message : hello.hystrix.commands.HelloCmd$$EnhancerBySpringCGLIB$$a27be1be
class : hello.hystrix.commands.StaticClassTest
required-type : hello.hystrix.commands.StaticClassTest
converter-type : com.thoughtworks.xstream.converters.reflection.ReflectionConverter
path : /org.powermock.modules.junit4.rule.PowerMockStatement$1/outer-class/fNext/next/next/target/hello
line number : 15
class[1] : org.junit.internal.runners.statements.InvokeMethod
class[2] : org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks
class[3] : org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks
class[4] : org.powermock.modules.junit4.rule.PowerMockStatement
class[5] : …
Run Code Online (Sandbox Code Playgroud)