-
Notifications
You must be signed in to change notification settings - Fork 119
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
Add DI, remove static code and many code duplications, add DI usage e… #71
base: master
Are you sure you want to change the base?
Conversation
*/ | ||
public class Main { | ||
public static void main(String[] args) throws IOException, MandrillApiError { | ||
final ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("classpath:applicationContext-LutungMandrill-all.xml"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kind of disagree adding a Main class to the repo to show how to "wire" it all up together. I think if you want to have an example, you can better have this as a part of the README.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, makes sense. I'll move it.
We are not going to make this library depend on Guava, Spring core and Spring context. Not everyone uses DI and those who do not everyone uses Spring. What exactly are you trying to solve here? The only issue I see this resolving is the ability to pass in the mandrill root url which was requested once before. If you want the ability to proxy to some other server we can expose a constructor where you pass in a |
Maybe that's correct, it shouldn't actually depend on Spring core/Context it was depending for it for the Main class to run I guess, but the abundance of static methods make it hard for people to change the internals so at least that I see as a good thing. The guava is more or less meh for me. |
I fixed most of the stuff and removed the spring dep (it was a bad idea - I agree). |
I'd also remove the lutung-mandrill-all.xml in the resources folder. I think everybody knows how to wire their stuff, the important thing is removing the statics. |
@Override | ||
public void accept(final QueryExecutor queryExecutor) { | ||
addContent(templateContent, queryExecutor); | ||
addContent(mergeVars, queryExecutor); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addContent(mergeVars, queryExecutor) will overwrite "template_contents" set by executing addContent(templateContent, queryExecutor)
@@ -55,11 +52,9 @@ public MandrillExportJobInfo info(final String id) | |||
*/ | |||
public MandrillExportJobInfo list() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should return array
@@ -33,12 +32,9 @@ public MandrillInboundApi(final String key) { | |||
*/ | |||
MandrillInboundDomain[] domains() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all the calls are package-private, perhaps should be public?
…xample