You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@wink.apache.org by Edd Grant <ed...@eddgrant.com> on 2012/05/22 14:20:33 UTC

How do I configure a custom HandlersFactory when configuring Wink through Spring?

Hi all,

I am using Wink (1.2.0-incubating) with Spring support (using Spring
3.1.1-RELEASE). I can't for the life of me figure out how to register a
custom HandlersFactory implementation. Currently I'm doing this in my
Spring/Wink application context file as per the instructions here:
http://incubator.apache.org/wink/1.0/html/5.5%20Spring%20Integration.html

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:context="http://www.springframework.org/schema/context"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
		http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd">

  
  <bean class="org.apache.wink.spring.Registrar">
    <property name="instances">
      <set>
        
        <ref bean="healthChecker" />
      </set>
    </property>
  </bean>

  
  <bean id="customPropertiesFactory"
class="org.springframework.beans.factory.config.PropertiesFactoryBean">
    <property name="locations">
      <list>
        <value>WEB-INF/wink.properties</value>
      </list>
    </property>
  </bean>

  <bean id="customConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="ignoreUnresolvablePlaceholders" value="true" />
    <property name="order" value="1" />
    <property name="propertiesArray">
      <list>
        <props>
         <prop key="wink.propertiesFactory">customPropertiesFactory</prop>
        </props>
      </list>
    </property>
  </bean>
</beans>

Spring is starting up and Wink is being initialised at start-up, I have
tested this through the fact that I can successfully call the
'healthChecker' Spring bean via an HTTP GET. However my HandlersFactory
class never gets registered or called. This used to work fine when using the
init-param servlet Style configuration but has stopped working when moving
over to Spring. I can't find anything in the docs to explain how to
configure this when using Spring. Please could someone advise?

Many thanks,

Edd


--
View this message in context: http://apache-wink-users.3471013.n2.nabble.com/How-do-I-configure-a-custom-HandlersFactory-when-configuring-Wink-through-Spring-tp7570933.html
Sent from the Apache Wink Users mailing list archive at Nabble.com.

Re: How do I configure a custom HandlersFactory when configuring Wink through Spring?

Posted by Serafin Sedano <se...@abiquo.com>.
Our wink version is 1.1.1-incubating, and Spring version 3.0.5.RELEASE.

Although in another projects we are using newer versions , the example I
provided was with those ones.

Regards.

Serafín.

2012/5/23 Edd Grant <ed...@eddgrant.com>

> Thanks Serafin,
>
> I've noticed a couple of differences between your working example and my
> non-working one (mainly the property name which you have set to
> 'winkPropertiesFactory' whereas I have it set to 'wink.propertiesFactory').
> I'm guessing this is important to Wink so will try modifying my config to
> match yours and see if I get anywhere with that.
>
> One other question, which version of Wink and Spring are you using?
>
> Cheers,
>
> Edd
>
> --
> View this message in context:
> http://apache-wink-users.3471013.n2.nabble.com/How-do-I-configure-a-custom-HandlersFactory-when-configuring-Wink-through-Spring-tp7570933p7572565.html
> Sent from the Apache Wink Users mailing list archive at Nabble.com.
>
>


-- 
Serafín Sedano | Software Engineer | Abiquo |  | serafin.sedano@abiquo.com

Re: How do I configure a custom HandlersFactory when configuring Wink through Spring?

Posted by Edd Grant <ed...@eddgrant.com>.
Thanks Serafin,

I've noticed a couple of differences between your working example and my
non-working one (mainly the property name which you have set to
'winkPropertiesFactory' whereas I have it set to 'wink.propertiesFactory').
I'm guessing this is important to Wink so will try modifying my config to
match yours and see if I get anywhere with that.

One other question, which version of Wink and Spring are you using?

Cheers,

Edd

--
View this message in context: http://apache-wink-users.3471013.n2.nabble.com/How-do-I-configure-a-custom-HandlersFactory-when-configuring-Wink-through-Spring-tp7570933p7572565.html
Sent from the Apache Wink Users mailing list archive at Nabble.com.

Re: How do I configure a custom HandlersFactory when configuring Wink through Spring?

Posted by Serafin Sedano <se...@abiquo.com>.
We are having no troubles by defining this bean:

 <bean id="wink.customPropertiesFactory"
class="org.springframework.beans.factory.config.PropertiesFactoryBean">
        <property name="locations">
            <list>
                <value>classpath:wink.properties</value>
            </list>
        </property>
    </bean>
<bean id="wink.placeholderConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="ignoreUnresolvablePlaceholders" value="true" />
        <property name="order" value="1" />
        <property name="propertiesArray">
            <list>
                <props>
                    <prop
key="winkPropertiesFactory">wink.customPropertiesFactory</prop>
                </props>
            </list>
        </property>
    </bean>

Where wink.properties is loaded through classpath and located in
src/main/resources and therefore in the war is placed in WEB-INF/classes

Regards.

Serafín.

2012/5/23 Edd Grant <ed...@eddgrant.com>

> Anyone have any guidance here?
>
> --
> View this message in context:
> http://apache-wink-users.3471013.n2.nabble.com/How-do-I-configure-a-custom-HandlersFactory-when-configuring-Wink-through-Spring-tp7570933p7572563.html
> Sent from the Apache Wink Users mailing list archive at Nabble.com.
>
>


-- 
Serafín Sedano | Software Engineer | Abiquo |  | serafin.sedano@abiquo.com

Re: How do I configure a custom HandlersFactory when configuring Wink through Spring?

Posted by Edd Grant <ed...@eddgrant.com>.
Anyone have any guidance here?

--
View this message in context: http://apache-wink-users.3471013.n2.nabble.com/How-do-I-configure-a-custom-HandlersFactory-when-configuring-Wink-through-Spring-tp7570933p7572563.html
Sent from the Apache Wink Users mailing list archive at Nabble.com.

Re: How do I configure a custom HandlersFactory when configuring Wink through Spring?

Posted by Serafin Sedano <se...@abiquo.com>.
Glad it helped.

Serafín.

2012/5/23 Edd Grant <ed...@eddgrant.com>

> Thanks, that sorted it! Can't say how relieved I am!
>
> --
> View this message in context:
> http://apache-wink-users.3471013.n2.nabble.com/How-do-I-configure-a-custom-HandlersFactory-when-configuring-Wink-through-Spring-tp7570933p7572567.html
> Sent from the Apache Wink Users mailing list archive at Nabble.com.
>
>


-- 
Serafín Sedano | Software Engineer | Abiquo |  | serafin.sedano@abiquo.com

Re: How do I configure a custom HandlersFactory when configuring Wink through Spring?

Posted by Edd Grant <ed...@eddgrant.com>.
Thanks, that sorted it! Can't say how relieved I am!

--
View this message in context: http://apache-wink-users.3471013.n2.nabble.com/How-do-I-configure-a-custom-HandlersFactory-when-configuring-Wink-through-Spring-tp7570933p7572567.html
Sent from the Apache Wink Users mailing list archive at Nabble.com.