В моем Spring
проекте у меня есть интерфейс:
public interface MyIntefrace {
void myMethod(String myParam);
}
, и у меня есть класс, который его реализует:
@Component
@Profile("prod")
public class MyImplementationClass implements MyInterface {
...
В моем другом классе я используюэтот объект выглядит следующим образом:
@Autowired
MyInterface myinterface;
...
myinterface.myMethod(someParam);
И он выдает мне ошибку:
Field myinterface in mypackage required a bean of type ... that could not be found.
The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)
Consider defining a bean of type '...' in your configuration
Я попытался добавить аннотацию @Service
выше MyInterface
, но это не помогло.Что еще я могу сделать?