Spring-Boot @Autowire constructor short cut 关注
已回答
Hi folks,
I'm using intellij with maven to build a spring boot application.
I do very often following:
```java
...
private AnyServiceClass anyServiceClass;
public MyConstructor(AnyServiceClass anyServiceClass) {
this.anyServiceClass = anyServiceClass;
}
```
Is there any short cut to generate the constructor of a private class attribute. Further I would like to add some further attributes, which should be inserted into the constructor automatically.
Thanks for your help.
T
请先登录再写评论。
Hi Tim, there should be a quick fix available on alt+enter to add a constructor parameter:


which results in:
It should work with any new field you add. As an option, you can use Cmd+Shift+A / Ctrl+Shift+A and search for an action 'Add constructor parameters'