I got into a really strange problem. I have classes
public class A extends ...{
}
public class B extends A{
@Override
@PreAuthorize(...)
public String doMagic(){
String v = super.doMagic();
doSomeOtherThings();
...
return v;
}
}
there were multiple classes extending A, so I refactored it into:
public class A extends ...{
@Override
public String doMagic(){
String v = super.doMagic();
doSomeOtherThings();
...
return v;
}
}
public class B extends A{
@Override
@PreAuthorize(...)
public String doMagic(){
return super.doMagic();
}
}
but now the interesting thing happened...
I have tests verifying access rights (based on PreAuthorize), which executes properly in IntelliJ, but fails when executed with maven. It looks like method from B is ignored and/or the annotation is not being processed. In the first version tests passes in both cases.
Any ideas what might have happened? This seems that the problem might be related to cglib..
and it works again in such case:
public class A extends ...{
protecte String doMagic2(){
String v = super.doMagic();
doSomeOtherThings();
...
return v;
}
}
public class B extends A{
@Override
@PreAuthorize(...)
public String doMagic(){
return doMagic2();
}
}