I have an interface like so:

```
public interface Animal {
  void setName(String animal);
  String getName();
}

```

and I have a Class that implements the interface:

```
@Component
public class Dog implements Animal {
    private String name;
    public void setName(String name) {
          this.name= name;
    }

    public String getName() {
          return this.name;
    }
}

```

In another class (ProcessAnimal), I AutoWire the interface:

```
public class ProcessAnimal {
     @Autowired
     public Animal animal;

     public void processAnimals() {
         animal.setName("Fido");
     }
}

```

I only have one class that implements `Animal` so this should work, however, I get a `NullPointerException` when it hits the `animal.setName("Fido");` line. IntelliJ is complaining that `Autowired members must be defined in valid Spring bean (@Component|@Service...)` which I have... I don't understand what I'm doing wrong. I've tried to add a `@Qualifier`, but still it didn't work and it shouldn't be necessary since I only have one implementation.

```
-java
    -com.example.com.AnimalProcessing
    -Animal
       -Animal.java
       -Dog.java
    -ProcessAnimal.java
    -AnimalProcessingApplication.java

```

AnimalProcessingApplication.java

```
@SpringBootApplication
public class AnimalProcessingApplication {
     public static void main(String[] args) {
           SpringApplication.run(AnimalProcessingApplication.class, args);
           run();
     }

     public static void run() {
           ProcessAnimal processAnimal = new ProcessAnimal();
           processAnimal.processAnimals();
     }
}

```