-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Access Spring context from ClassBridge, Analyzer
PostPosted: Thu Jul 16, 2009 4:15 pm 
Newbie

Joined: Thu Jul 16, 2009 3:49 pm
Posts: 2
I am using Spring, Hibernate and Hibernate Search in my application.

I need to access Spring context from ClassBridge and from Analyzer. Is it possible?

Code:
@ClassBridge(name="myfield",
             index=Index.TOKENIZED,
             impl = MyObjClassBridge.class)
@Analyzer(impl = MyAnalyzer.class)
public class MyObj {
...
}

public class MyObjClassBridge implements FieldBridge {
    public void set(String name, Object value, Document document, LuceneOptions luceneOptions) {
        // HOW TO ACCESS SPRING CONTEXT?
   }
}

public class MyAnalyzer extends PerFieldAnalyzerWrapper {
        // HOW TO ACCESS SPRING CONTEXT?
}


Top
 Profile  
 
 Post subject: Re: Access Spring context from ClassBridge, Analyzer
PostPosted: Fri Jul 17, 2009 6:15 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

maybe this links can help:


--Hardy


Top
 Profile  
 
 Post subject: Re: Access Spring context from ClassBridge, Analyzer
PostPosted: Fri Jul 17, 2009 9:24 am 
Newbie

Joined: Thu Jul 16, 2009 3:49 pm
Posts: 2
Thank you for the answer. I have already implemented such solution. But there are some problems.
For example I can't access Spring context from Analyzer constructor because Analyzer is instantiated before Spring context is created.

hardy.ferentschik wrote:


Top
 Profile  
 
 Post subject: Re: Access Spring context from ClassBridge, Analyzer
PostPosted: Mon Jul 20, 2009 2:55 pm 
Pro
Pro

Joined: Wed Oct 03, 2007 2:31 pm
Posts: 205
Try making the class @Configurable which spring will configure when you need it.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.