class A
{
m1()
{
constant loading logic;
}
m2()
{
constant loading logic;
}
}
class B
{
@Autowired A a;
m3()
{
a.m1();
a.m2();
}
}
For clarity constant loading logic is :
@Autowired
private Environment env; //spring environment
String accessKey = env.getProperty("aws_access_key");
String secretKey = env.getProperty("aws_secret_access_key");
I have a class A which has a @Component spring annotation.class A is an @autowired property for another class B. class A has 2 methods m1 and m2. class B calls m1 and m2.
I want to load certain common properties(constants) and use these constants in both m1 and m2.Is there an efficient way to do this instead of repeating the same constant loading logic to be written in both methods m1 and m2 ?