mahout-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sebastian Schelter <>
Subject Re: Hadoop with MySQL-based data model and Spring integration
Date Thu, 15 Jul 2010 16:11:54 GMT
Hi Matthias,

If you're using Spring 3 and don't want to configure constructor
injection via XML (which looks really messy when you have lots of classes),
you can also use Spring's  Java Configuration capabilities.

I like it for it's compactness, here's a simple example:

public class ApplicationSetup {
  public @Bean recommender() throws Exception() {
    DataModel dataModel = ...
    ItemSimilarity similarity = ...;
    return new GenericItemBasedRecommender(dataModel, similarity);


Am 15.07.2010 16:49, schrieb Joe Spears:
> I use spring to manage mahout in the way you describe. The trick is to use
> Spring's constructor-args rather than property bean definitions. If you do
> this, you don't have to write a single line of code to get spring to run
> mahout.
> I can then inject my recommenders into my application classes.
> --
> As far as your data model is concerned, I had to write my own datamodel
> because I didn't want to code my table-name and column names (I use
> hibernate).... but the docs (and source comments) on how to write a
> datamodel are pretty good... so I created a datamodel that I injected my
> session into and that knew how to issue HQL statement.
> Hope this helps
> Joe
> 2010/7/15 Matthias Böhmer <>
>> Dear mailing list,
>> I am just wondering, if it will be possible to run Mahout based on
>> distributed computing with Hadoop, if I have a MySQL-based
>> implementation of the data model. Namely, I am working with the Spring
>> Framework and I want to realize the data model and the recommender
>> system as Spring Beans to make them available to the other components
>> within my application. Any hints on this issue? Has anyone yet
>> integrated Mahout into an application based on the Spring Framework?
>> Best regards,
>> Matthias

View raw message