Moving to Java and XML config instead of importing context