Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 434 Vote(s) - 3.44 Average
  • 1
  • 2
  • 3
  • 4
  • 5
intellij incorrectly saying no beans of type found for autowired repository

#11
As long as your tests are passing you are good, hit `alt + enter` by taking the cursor over the error and inside the submenu of the first item you will find `Disable Inspection` select that
Reply

#12
Sometimes you are required to indicate where @ComponentScan should scan for components. You can do so by passing the packages as parameter of this annotation, e.g:

@ComponentScan(basePackages={"path.to.my.components","path.to.my.othercomponents"})

However, as already mentioned, @SpringBootApplication annotation replaces @ComponentScan, hence in such cases you must do the same:

@SpringBootApplication(scanBasePackages={"path.to.my.components","path.to.my.othercomponents"})

At least in my case, Intellij stopped complaining.
Reply

#13
I am using this annotation to hide this error when it appears in IntelliJ v.14:

@SuppressWarnings("SpringJavaAutowiringInspection")
Reply

#14
I always solve this problem doing de following..
***Settings>Inspections>Spring Core>Code*** than you shift from error to warning the severity option

[![enter image description here][1]][1]


[1]:
Reply

#15
I had this same issue when creating a *Spring Boot* application using their `@SpringBootApplication` annotation. This annotation represents `@Configuration`, `@EnableAutoConfiguration` and `@ComponentScan` according to the [spring reference][1].

As expected, the new annotation worked properly and my application ran smoothly but, **Intellij** kept complaining about unfulfilled `@Autowire` dependencies. As soon as I changed back to using `@Configuration`, `@EnableAutoConfiguration` and `@ComponentScan` separately, the errors ceased. It seems **Intellij 14.0.3** (and most likely, earlier versions too) is not yet configured to recognise the `@SpringBootApplication` annotation.

For now, if the errors disturb you that much, then revert back to those three separate annotations. Otherwise, ignore **Intellij**...your dependency resolution is correctly configured, since your test passes.

Always remember...
> Man is always greater than machine.


[1]:

[To see links please register here]

Reply

#16
I am using spring-boot 2.0, and intellij 2018.1.1 ultimate edition and I faced the same issue.

I solved by placing @EnableAutoConfiguration in the main application class

@SpringBootApplication
@EnableAutoConfiguration
class App{
/**/
}
Reply

#17
Sometimes - in my case that is - the reason is a wrong import. I accidentally imported

import org.jvnet.hk2.annotations.Service

instead of

import org.springframework.stereotype.Service

by blindly accepting the first choice in Idea's suggested imports. Took me a few minutes the first time it happend :-)
Reply

#18
I had similar issue in Spring Boot application. The application utilizes Feign (HTTP client synthetizing requests from annotated interfaces). Having interface `SomeClient` annotated with `@FeignClient`, Feign generates runtime proxy class implementing this interface. When some Spring component tries to autowire bean of type `SomeClient`, Idea complains no bean of type `SomeClient` found since no real class actually exists in project and Idea is not taught to understand `@FeignClient` annotation in any way.

Solution: annotate interface `SomeClient` with `@Component`. (In our case, we don't use `@FeignClient` annotation on `SomeClient` directly, we rather use metaannotation `@OurProjectFeignClient` which is annotated `@FeignClient` and adding `@Component` annotation to it works as well.)
Reply

#19
All you need to do to make this work is the following code:

@ComponentScan
public class PriceWatchTest{

@Autowired
private PriceWatchJpaRepository priceWatchJpaRepository;
...
...
}
Reply

#20
I just had to use @EnableAutoConfiguration to address it, however this error had no functional impact.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through