I was trying to access the non static method from class A to a static method in class B
@Component
public class B{
private static A aA1;
@Autowired
private A tA;
@PostConstruct
public void init(){
//<<<Make the enclosed method Static or remove this set>>>
B.aA1=tA;
}
public static void random method(){
aA1.doStuff();
}
}
Is it okay to make the init method static, as the sonar suggest Or is there another way i could solve this?