Podpowiedzcie co pominąłem,że nie wstrzykuje mi do
private TaskInterface task;
odpowiedniej klasy. Poniżej wrzucam kod:
TaskInterface:
package pl.konrad.task;
public interface TaskInterface {
//nie ma tu zadnych metod
}
TaskImplement:
package pl.konrad.task;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
@Component
@Qualifier("default_task")
public class TaskImplement implements TaskInterface {
private String name;
private String description;
private int priority;
public TaskImplement() {
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public int getPriority() {
return priority;
}
public void setPriority(int priority) {
this.priority = priority;
}
}
ProjectImplement - klasa do ktorej chce wstrzyknac:
package pl.konrad.project;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import pl.konrad.employee.EmployeeInterface;
import pl.konrad.leader.LeaderInterface;
import pl.konrad.task.TaskInterface;
@Service
public class ProjectImplement implements ProjectInterface {
private int id;
@Autowired
@Qualifier("default_task")
private TaskInterface task;
@Override
public TaskInterface create_task() {
//JEZELI UZYWAM TUTAJ ZMIENNEJ task, NIE DOSTAJE JEJ GETEROW I SETEROW;
return this.task;
}