Month: December 2015

How to enable log4j when doing spring-based integration test?

Just put a log4j.xml on test’s class path and log4j will be activated. However, you may hate to have 2 "log4j.xml" in your eclipse. You want the log4j config for testing to be called log4j-test.xml. In that case, do the following: //create your own runner, withen which load log4j public class MySpringJunit4ClassRunner extends SpringJUnit4ClassRunner { …

How to enable log4j when doing spring-based integration test? Read More »

Jersey Client: What if the server side doesn’t return JSON ContentType when it is supposed to?

Your server says it will return JSON string as response, but the ContentType header it sends is not "application/json" but "text/html". What will happen?   Your client will see an exception saying "A message body reader for … was not found" .  What you need to do is to have your own "provider" and let …

Jersey Client: What if the server side doesn’t return JSON ContentType when it is supposed to? Read More »

JavaFX: how to let one FXML include another

How to let one fxml include another, e.g. let every scene has a "header" ? Note you have to set "fx:id=…" There must be a controller for the included fxml file. Let’s call it HeaderController public class HeaderController { @FXML private Text errorText; … Include the HeaderController in your controller public class LoginController { //the …

JavaFX: how to let one FXML include another Read More »