Germany has criticised France for insufficient defence spending in a public rebuke to its most important EU ally.