How do I get the Intellij code autoformatter to keep an annotated field on one line?

Viewed 4191

Whenever I run the IntelliJ autoformatter - it converts this:

@Autowired private CustomerDao customerDao;

into this:

@Autowired 
private CustomerDao customerDao;

How can I stop it from doing that?

1 Answers

Navigate to Preferences → Editor → Code Style → Java → Wrapping and Braces tab, then locate the section Field annotations and check the option Do not wrap after single annotation.

In IntelliJ v14:

eIntelliJ v14 Java style preferences

Related