samedi 21 mai 2016

How can I override @Autowired property in sub class

I decide to override autowired field in sub class. How can I do this override? Something like this

class Superclass {
    @Autowired
    Test test;

    public Test getTest() {
        return test;
    }
}

class Subclass extends Superclass {
    @Autowired
    Test2 test2;

    public Subclass() {
        super().test=test2;
    }
}

Aucun commentaire:

Enregistrer un commentaire