'Gradle Build Takes Error But Application Runs Properly

In my project, i use basically microservice architecture, spring boot, spring cloud and gradle etc.

When i tried to Gradle build, it takes error but when i tried to running to the my application, it runs properly.

I searched too many resource but i didn't find any solution. No solution suggestions worked for me and error explanation is not specific which it is too general

Shared Error Image



Solution 1:[1]

I found to error's resource and error's solution. Error's resource some class contains @Autowired annotation in test package so for this situation, I must use SpringBootTest and RunWith(SpringRunner.class). If I dont use, I take error. For me I used these annotations but SpringBootTest I use wrong location @SpringBootTest(classes = {ABC.class}) I changed to correct location and it works :).

Solution 2:[2]

This is a common error complaining that what ever you marked with @Autowire, cannot point to an implementation. So mainly could be for 2 reasons.

  1. You have an interface, but you have not implement it via a class
  2. You have implemented one with a class but it's not in the spring dependency injectable context, in this case mark it as @Component with the relevant interface implementation.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Juliyanage Silva