首页 > 解决方案 > Spring Boot 2.0 Gradle run and test in IntelliJ

问题描述

I have a simple Spring Boot 2 application with Gradle as build system. Everything runs fine as long as I use Gradle to run and test the project.

One controller class contain an @Autowired bean

@Autowired
OAuth2AuthorizedClientService clientService

which works quite ok.

The problem is, when I try to run the application in IntelliJ IDEA through a right-click on the application class or if I start my test suite, the system complains that the above mentioned bean is missing.

Just referencing the bean without declaring it seems to be a standard pattern...

Any hint on where I could look for a solution?

标签: javaspring-bootintellij-ideaspring-security

解决方案


我认为问题原因是运行配置。您可以gradle bootRun使用 IntelliJ 运行。如下

截屏

在此处输入图像描述


推荐阅读