![](/img/trans.png)
[英]IntelliJ IDEA Community Edition and Spring slow reload with Spring DevTools
[英]Spring in IntelliJ IDEA Community Edition does not bind @Autowired
我也看到了有关付费版本的问题,但找不到解决方案。 IDEA CE 抱怨缺少应该定义的 bean。
The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)
Action:
Consider defining a bean of type 'domain.service.KitchenService' in your configuration.
但在我的 controller 中,我确实有它:
@Autowired
private KitchenService service;
我发现的大多数解决方案都不清楚,唯一明确的一个是用@SpringBootApplication 的 3 个注释来注释起点@SpringBootApplication
,但没有区别。
如何解决?
首先,Intellij IDEA 不是免费的 IDE。 对于大规模开发和框架支持,您需要购买 Intellij IDEA Ultimate Edition 以获得所有支持。
在免费版中,他们不提供 Spring 支持。
免费推荐 IDE:最好的免费 IDE 是Spring 工具套件。 Pivotal team has specially designed the Eclipse IDE for Spring Framework support and it's far better than any other IDE.
而且Pivotal也推荐使用这个IDE。
KitchenService
bean 没有创建的原因如下:
KitchenService
上缺少@Service
注释。
或者您错过了在存在 KitchenService 的@ComponentScan
中添加KitchenService
。
因此, KitchenService
bean 丢失,并且 Spring 在自动装配时无法找到 bean。
请根据这些原因验证问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.