So I'm trying to autowire an interface.
MyApp:
@SpringBootApplication(scanBasePackages={"com.B","com.C"})
public class MyApp {
...
}
MyController (which is in package com.B):
@RestController
@RequestMapping("/users")
public class UserController
{
@Autowired
MyInterface myInterface;
}
MyInterface (which is in package com.C):
@Service
public interface MyInterface
{
...
}
But I'm getting this error:
Consider defining a bean of type 'C.MyInterface' in your configuration.
even though I have:
- The package included here:
@SpringBootApplication(scanBasePackages={"com.B","com.C"})
@Service
in the interface
Is it even possible to autowire an interface?