How can I control, that all classes, that derive from a certain class, have to be declared as @Component (that means as a Spring bean)? Is Spring offering a mechanism for controling this via the parent class?
Forcing derived classes to declare themselves as Spring bean
101 Views Asked by olivmir At
1
There are 1 best solutions below
Related Questions in SPRING
- Redirect inside java interceptor
- Spring RestTemplate passing the type of the response
- spring-integration-dsl-groovy-http return null when i use httpGet method
- Custom Spring annotation for request parameters
- Spring - configure Jboss Intros for xml with java config?
- HTTP Status 404 - Not Found in Spring 3.2.7
- AndroidAnnotations how to use setBearerAuth
- android I/O error: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found
- Show login dialog when not authenticated yet
- Spring Data Rest supporting json and xml
- @Value annotation not resolved in a class that belongs to dependency jar
- Remove nested _embedded fields while using projections
- How to send Rest GET request that contains "#" value in url parameters?
- How to inject spring bean into Validator(hibernate)
- How to keep a variable in the URL when using Spring LocaleChangeInterceptor
Related Questions in SPRING-ANNOTATIONS
- Timing Issue with Spring Boot Annotation Configuration
- Custom Spring annotation for request parameters
- Multithread using Executor and WebSocket
- Getting correct instance using @Autowired
- @Value is always null
- How to make a property injection via @Value annotation mandatory?
- Grails 2.4.4 spring security role doesn't apply to user
- Use ?. operator in principal id checks for security
- Override @Autowired property annotation with XML configuration
- Why would Spring 3 @Component names clash when they have different packages?
- Parent Application Context in Spring boot
- Forcing derived classes to declare themselves as Spring bean
- Overcome "Can not construct instance of InterfaceClass" without hinting the parent
- What is the smartest way to handle "boolean" parameter passed by a form submission into a Spring MVC controller method?
- Spring AOP only method with annotation
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Workarround: you could use [AspectJ to declare warnings][1] (or errors) if the subclass of your parent class does not have a
@Componentannotation.(I am not an AspectJ expert, so I can not write you the needed AJP declaration. But I have done something similar some years ago, so I am pretty sure that this approach works.)
rough sketch, contains maybe some syntax errors: