New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Factory instead of hardcoded class.newInstance() #84
Comments
It is already implemented but not well documented yet. See WebCrawlerFactory in https://github.com/yasserg/crawler4j/blob/master/src/main/java/edu/uci/ics/crawler4j/crawler/CrawlController.java |
A i see - thanks for your answer - but it is not included in the current release of crawler4j? |
Yes |
+1 for factory or any way that allow dependency injection. Any scheduled for new stable that includes this feature ? |
@s17t Just get the source code and build the current SNAPSHOT by yourself. The snap implements a WebCrawlerFactory, which you can use for DI e.g. with Spring. |
I know you have added WebCrawlerFactory, but How to use spring DI? can you give an example? thanks |
@eimhee, something like this:
Then in spring:
|
As an alternative, you could implement
|
I would like to suggest, that adding a the possibility to use a factory to create new web-crawlers would be of great value.
Since a web-crawler could hold a few custom services (e.g. classifiers, database services) a factory would be a very nice thing to make crawler4j usable for example via Spring.
A few years ago an issue was created on googlecode (https://code.google.com/p/crawler4j/issues/detail?id=144), which is a duplicate of mine request - but nothing happend. Is there a reason for not including a factory approach in the code-base?
Thanks in advance.
The text was updated successfully, but these errors were encountered: