2
I’m working on an automatic text messaging system, in my class hierarchy I have an abstract class at the top called TaskNFSBusiness
which sets the rules for messages that are not in real time, it is annotated with @Component as you can see below:
@Component
public abstract class TaskNFSBusiness {
Soon after I have a class that inherits from this class and defines the rules of messages that will be sent in real time its declaration is being made as follows:
public abstract class NFSInstantanea extends TaskNFSBusiness implements PageQueryConstants {
Just below the hierarchy I have 2 classes that inherit from NFSInstantanea
and define the rules of instant messaging, they are stated as follows:
@Component
@Qualifier("nfs13")
public class NFS13 extends NFSInstantanea {
@Component
@Qualifier("nfs12")
public class NFS12 extends NFSInstantanea {
My problem is that these last two classes are increasing Spring boot time too much because they both inherit from NFSInstantanea
and both are marked with @Component
, this is generating a timeout at the time of uploading the application to the local test server. The strange thing is that if I remove the @Component
of the classes or if I make them inherit from TaskNFSBusiness
boot time goes back to normal, only I didn’t want to do it because then I wouldn’t be able to instill NFS12
and the NFS13
with @Autowired
, and if I put the real-time methods in TaskNFSBusiness
I will end up having a series of useless code in messages that are not instant, plus all the conflicts that this would cause.
To make it simpler to understand the hierarchy I’ll leave the modeling right below
I managed to get the performance back by annotating the class
NFSInstantanea
with@Component
. for some reason at Spring (which I don’t know how to say) when announcing the parent class with@Component
children also need to be noted (even if this class does not involve anything within it, as in the case ofNFSInstantanea
) and then the boot performance is stable. only that honestly it was smelling me to gambiarra, I will test this your method and if it works keep it in my implementation and I will mark the question as answered, thank you.– Brendon Iwata
performed the tests and your method actually works @nullptr
– Brendon Iwata