I'm trying to use the util:constant tag for ioc, but I'm getting the following error message:
Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: Error registering bean with name 'threadPoolExecutor' defined in class path resource [spring.xml]: Unknown property sub-element: <util:constant>
Here's my xml:
<?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:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd">
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>classpath:config.properties</value>
</property>
</bean>
<bean id="main" class="pikefin.Main">
<property name="executorSample" ref="executorSample"/>
</bean>
<bean id="executorSample" class="pikefin.ExecutorSample">
<constructor-arg ref="threadPoolExecutor" />
</bean>
<bean id="threadPoolExecutor" class="java.util.concurrent.ThreadPoolExecutor">
<constructor-arg index="0" value="2"/>
<constructor-arg index="1" value="2"/>
<constructor-arg index="2" value="10"/>
<constructor-arg index="3"><util:constant static-field="java.util.concurrent.TimeUnit.SECONDS"/></constructor-arg>
<constructor-arg index="4" ref="arrayBlockingPool"/>
</bean>
<bean id="arrayBlockingPool" class="java.util.concurrent.ArrayBlockingQueue">
<constructor-arg value="5"/>
</bean>
</beans>
Update:
Here's my xml with the <value> tag added which causes a different error message:
Invalid content was found starting with element 'util:constant'. No child element is expected at this point.
(Sidenote: for some reason my formatting controls have disappeared when posting in SO)
<?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:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd">
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<value>classpath:config.properties</value>
</property>
</bean>
<bean id="main" class="pikefin.Main">
<property name="executorSample" ref="executorSample"/>
</bean>
<bean id="executorSample" class="pikefin.ExecutorSample">
<constructor-arg ref="threadPoolExecutor" />
</bean>
<bean id="threadPoolExecutor" class="java.util.concurrent.ThreadPoolExecutor">
<constructor-arg index="0" value="2"/>
<constructor-arg index="1" value="2"/>
<constructor-arg index="2" value="10"/>
<constructor-arg index="3">
<value>
<util:constant static-field="java.util.concurrent.TimeUnit.SECONDS"/>
</value>
</constructor-arg>
<constructor-arg index="4" ref="arrayBlockingPool"/>
</bean>
<bean id="arrayBlockingPool" class="java.util.concurrent.ArrayBlockingQueue">
<constructor-arg value="5"/>
</bean>
</beans>
For enum's you can directly assign the values and Spring will take care of binding it to the correct enum:
<constructor-arg index="3" value="SECONDS">
Also, your original entry worked for me perfectly:
<bean id="threadPoolExecutor" class="java.util.concurrent.ThreadPoolExecutor">
<constructor-arg index="0" value="2"/>
<constructor-arg index="1" value="2"/>
<constructor-arg index="2" value="10"/>
<constructor-arg index="3"><util:constant static-field="java.util.concurrent.TimeUnit.SECONDS"/></constructor-arg>
<constructor-arg index="4" ref="arrayBlockingPool"/>
</bean>
Related
This is my example-default.xml,
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd">
<bean abstract="true" id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
<!-- Set to true to enable distributed class loading for examples, default is false. -->
<property name="peerClassLoadingEnabled" value="true"/>
<!-- Enable task execution events for examples. -->
<property name="includeEventTypes">
<list>
<!--Task execution events-->
<util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_STARTED"/>
<util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_FINISHED"/>
<util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_FAILED"/>
<util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_TIMEDOUT"/>
<util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_SESSION_ATTR_SET"/>
<util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_REDUCED"/>
<!--Cache events-->
<util:constant static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_PUT"/>
<util:constant static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_READ"/>
<util:constant static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_REMOVED"/>
</list>
</property>
<property name="CacheExpiryPolicy">
<bean class="org.apache.ignite.configuration.CacheConfiguration">
<property name="expiryPolicyFactory">
<bean class="javax.cache.expiry.CreatedExpiryPolicy" factory-method="factoryOf">
<constructor-arg>
<bean class="javax.cache.expiry.Duration">
<constructor-arg value="MINUTES"/>
<constructor-arg value="5"/>
</bean>
</constructor-arg>
</bean>
</property>
</bean>
</property>
But the above gives Bean property 'CacheExpiryPolicy' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
How I can solve this?
I found an apache-ignite-users forum question on this.
Please refer to this here
So, the final updated xml according to that forum reference is :
<?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:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd">
<!-- Added cache expiry policy -->
<bean id="cacheExpiryPolicy"
class="javax.cache.configuration.FactoryBuilder$SingletonFactory">
<constructor-arg>
<bean class="javax.cache.expiry.CreatedExpiryPolicy">
<constructor-arg>
<bean class="javax.cache.expiry.Duration">
<constructor-arg value="MINUTES" />
<constructor-arg value="5" />
</bean>
</constructor-arg>
</bean>
</constructor-arg>
</bean>
<bean abstract="true" id="ignite.cfg"
class="org.apache.ignite.configuration.IgniteConfiguration">
<!-- Set to true to enable distributed class loading for examples, default
is false. -->
<property name="peerClassLoadingEnabled" value="true" />
<!-- Enable task execution events for examples. -->
<property name="includeEventTypes">
<list>
<!--Task execution events -->
<util:constant
static-field="org.apache.ignite.events.EventType.EVT_TASK_STARTED" />
<util:constant
static-field="org.apache.ignite.events.EventType.EVT_TASK_FINISHED" />
<util:constant
static-field="org.apache.ignite.events.EventType.EVT_TASK_FAILED" />
<util:constant
static-field="org.apache.ignite.events.EventType.EVT_TASK_TIMEDOUT" />
<util:constant
static-field="org.apache.ignite.events.EventType.EVT_TASK_SESSION_ATTR_SET" />
<util:constant
static-field="org.apache.ignite.events.EventType.EVT_TASK_REDUCED" />
<!--Cache events -->
<util:constant
static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_PUT" />
<util:constant
static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_READ" />
<util:constant
static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_REMOVED" />
</list>
</property>
<!-- set the cacheConfiguration property -->
<property name="cacheConfiguration">
<list>
<bean
class="org.apache.ignite.configuration.CacheConfiguration">
<property name="name" value="default" />
<property name="atomicityMode" value="ATOMIC" />
<property name="expiryPolicyFactory">
<bean parent="cacheExpiryPolicy" />
</property>
</bean>
</list>
</property>
</bean>
</beans>
Here is the example from the documentation:
<property name="cacheConfiguration">
<list>
<bean class="org.apache.ignite.configuration.CacheConfiguration">
<property name="name" value="cacheWithExpiryPolicy"/>
<property name="expiryPolicyFactory">
<bean class="javax.cache.expiry.CreatedExpiryPolicy" factory-method="factoryOf">
<constructor-arg>
<bean class="javax.cache.expiry.Duration">
<constructor-arg value="MINUTES"/>
<constructor-arg value="5"/>
</bean>
</constructor-arg>
</bean>
</property>
</bean>
</list>
</property>
I am trying to annotation to auto-wire but getting compile error, I am not able to get the error message, there is only red cross at that line in spring XML. where I am doing wrong?
spring.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
https://www.springframework.org/schema/context/spring-context.xsd"
xmlns:context="http://www.springframework.org/schema/context/">
<!--commenting it out as we are using component annotation for this class-->
<!-- <bean id="circle" class="org.devesh.learning.spring.Circle">
</bean>
-->
<bean id ="pointA" class="org.devesh.learning.spring.Point">
<property name="x" value="${pointA.pointX}"></property>
<property name="y" value="${pointA.pointY}"></property>
</bean>
<bean id = "center" class="org.devesh.learning.spring.Point">
<property name="x" value="20"></property>
<property name="y" value="0"></property>
</bean>
<bean id = "pointC" class="org.devesh.learning.spring.Point">
<qualifier value="circle related"></qualifier>
<property name="x" value="-20"></property>
<property name="y" value="0"></property>
</bean>
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations" value="pointconfig.properties"></property>
</bean>
<bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor"></bean>
<context:component-scan base-package="org.devesh.learning.spring"/>
</beans>
Is it a possible typo?
as is:
xmlns:context="http://www.springframework.org/schema/context/
to be :
xmlns:context="http://www.springframework.org/schema/context
I have encountered a problem of failed to create bean in spring suddenly. The webapp is already deployed and has been running for several months. However, below error message comes suddenly. It can be resolved by restarting the webapp, but comes again without any hints. Does anyone have any idea of this case?
Tomcat 6 is being used to host the webapp.
[2013/05/03 12:02:56:421 HKT] ajp-8009-42 org.ajax4jsf.webapp.BaseXMLFilter(227) - Exception in the filter chain
javax.servlet.ServletException: Error creating bean with name 'reportGenerationBean' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'scheduleBean' while setting bean property 'scheduleBean'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scheduleBean': Invocation of init method failed; nested exception is java.lang.ArrayIndexOutOfBoundsException
applicationContext.xml as below
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:tx="http://www.springframework.org/schema/tx"
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-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
<context:property-placeholder location="classpath*:webapp.properties,classpath*:env_prod.properties"/>
<context:annotation-config />
<bean id="facesUtils" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="staticMethod">
<value>com.webapp.util.FacesUtils.init</value>
</property>
<property name="arguments">
<list>
<value>com.webapp.config.SpringBeanEnum</value>
<value>com.webapp.config.FacesBeanEnum</value>
</list>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory"><ref local="inspectbookSessionFactory"/></property>
</bean>
<context:component-scan base-package="com.webapp.bo, com.webapp.service" />
<tx:annotation-driven transaction-manager="transactionManager" />
<bean id="hibernateDAO" abstract="true">
<property name="sessionFactory"><ref local="inspectbookSessionFactory"/></property>
</bean>
<!-- Temporary Setting -->
<bean id="ItemSearchBeanDao" class="com.webapp.dao.tmp.ItemSearchBeanDao" parent="hibernateDAO">
<property name="maxRecordNo" value="${no_of_record.order}"/>
</bean>
<bean id="BookedSearchBeanDao" class="com.webapp.dao.tmp.BookedSearchBeanDao" parent="hibernateDAO">
<property name="maxRecordNo" value="${no_of_record.booked}"/>
</bean>
<bean id="ScheduleBeanDao" class="com.webapp.dao.tmp.ScheduleBeanDao" parent="hibernateDAO"></bean>
<bean id="WhItemSearchBeanDao" class="com.webapp.dao.tmp.WhItemSearchBeanDao" parent="hibernateDAO">
<property name="maxRecordNo" value="${no_of_record.whItem}"/>
</bean>
<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
<property name="host" value="-secret-"/>
</bean>
<bean id="EmailUtil" class="com.webapp.util.EmailUtil">
<property name="mailSender" ref="mailSender"/>
</bean>
<bean id="freeMarkerTemplateMailer" class="com.webapp.bo.email.impl.FreeMarkerTemplateMailer">
<property name="mailSender" ref="mailSender"/>
</bean>
<bean id="emailService" class="com.webapp.bo.email.impl.EmailServiceImpl" >
<property name="orgunitDao" ref="OrgunitDAO"/>
<property name="contactMethodDao" ref="ContactMethodDAO"/>
<property name="mailer" ref="freeMarkerTemplateMailer"/>
</bean>
<bean id="scheduleEmail" class="com.webapp.bo.schedule.impl.ScheduleEmailImpl" >
<property name="orgunitDao" ref="OrgunitDAO"/>
<property name="scheduleBeanDao" ref="ScheduleBeanDao"/>
<property name="emailService" ref="emailService"/>
</bean>
<bean name="scheduleJob" class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass" value="com.webapp.service.schedule.ScheduleJob" />
<property name="jobDataAsMap">
<map>
<entry key="scheduleEmail" value-ref="scheduleEmail" />
</map>
</property>
</bean>
<!-- JSF backing bean START -->
<bean id="vendorSearchBean" class="com.webapp.service.search.item.VendorSearchBean" scope="session">
<property name="maxRecordNo" value="${no_of_record.vendor}"/>
</bean>
<bean id="itemSearchBean" name="itemSearchBean" class="com.webapp.service.search.item.NewItemSearchBean" scope="session">
<property name="maxRecordNo" value="${no_of_record.order}"/>
<property name="popupBean" ref="popupBean"/>
</bean>
<bean id="itemSearchPopupBean" name="itemSearchPopupBean" class="com.webapp.service.search.item.NewItemSearchBean" scope="session">
<property name="maxRecordNo" value="${no_of_record.order}"/>
</bean>
<bean id="detailBean" class="com.webapp.service.detail.DetailBean" scope="session">
<property name="itemSearchBean" ref="itemSearchBean"/>
<property name="itemSearchPopupBean" ref="itemSearchPopupBean"/>
<property name="popupBean" ref="popupBean"/>
</bean>
<bean id="bookedSearchBean" class="com.webapp.service.search.booked.BookedSearchBean" scope="session">
<property name="maxRecordNo" value="${no_of_record.booked}"/>
</bean>
<bean id="scheduleConfirmBean" class="com.webapp.service.schedule.ScheduleConfirmBean" scope="session">
<property name="popupBean" ref="popupBean"/>
</bean>
<bean id="scheduleBean" class="com.webapp.service.search.schedule.ScheduleBean" scope="session">
<property name="popupBean" ref="popupBean"/>
</bean>
<bean id="dropBean" class="com.webapp.service.search.schedule.DropBean" scope="request">
<property name="scheduleBean" ref="scheduleBean"/>
</bean>
<bean id="inspectContactBean" class="com.webapp.service.detail.contact.InspectContactBean" scope="session">
<property name="detailBean" ref="detailBean"/>
</bean>
<bean id="inspectLocationBean" class="com.webapp.service.detail.contact.InspectLocationBean" scope="session">
<property name="detailBean" ref="detailBean"/>
</bean>
<bean id="whItemSearchBean" class="com.webapp.service.search.warehouse.WhItemSearchBean" scope="session">
<property name="maxRecordNo" value="${no_of_record.whItem}"/>
<!--<property name="propertiesUtil" ref="propertiesUtil"/>-->
</bean>
<!-- Autocomplete -->
<bean id="autocomplete" class="com.webapp.service.common.AutocompleteBean" scope="session"></bean>
<!-- PackingListBean -->
<bean id="packingListBean" class="com.webapp.service.common.PackingListBean" scope="session">
<property name="itemSearchBean" ref="itemSearchBean"/>
<property name="popupBean" ref="popupBean"/>
</bean>
<!-- Report Bean -->
<bean id="reportGenerationBean" class="com.webapp.service.report.ReportGenerationBean" scope="request">
<property name="itemSearchBean" ref="itemSearchBean"/>
<property name="packingListBean" ref="packingListBean"/>
<property name="scheduleBean" ref="scheduleBean"/>
</bean>
<!-- popupBean -->
<bean id="popupBean" class="com.webapp.service.common.PopupControlBean" scope="session">
</bean>
<!-- JSF backing bean END -->
</beans>
I'm trying to get a web service up using jaxrs and jetty:
This is my jaxrms.xml file:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cxf="http://cxf.apache.org/core"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xsi:schemaLocation="
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<!-- import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" /-->
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<bean id="restService" class="com.as.rover.service.rest.RestService" >
</bean>
<jaxrs:server id="jaxrsRestService" address="/rest/">
<jaxrs:serviceBeans>
<ref bean="restService" />
</jaxrs:serviceBeans>
</jaxrs:server>
</beans>
This is my jetty.xml file:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<bean class="com.as.rover.service.JettyManager" factory-method="getInstance" id="jettyManager">
<property name="server" >
<bean id="jetty-server" class="org.eclipse.jetty.server.Server" init-method="start" destroy-method="stop">
<property name="connectors">
<list>
<bean id="Connector" class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<property name="port" value="8080"/>
</bean>
</list>
</property>
<property name="handler">
<bean id="handlers" class="org.eclipse.jetty.server.handler.HandlerList">
<property name="handlers">
<list>
<ref bean="servletContextHandler"></ref>
<!--bean class="org.eclipse.jetty.server.handler.ResourceHandler">
<property name="directoriesListed" value="true"/>
<property name="welcomeFiles">
<list>
<value>index.html</value>
</list>
</property>
<property name="resourceBase" value="."/>
</bean>
<bean class="org.eclipse.jetty.server.handler.DefaultHandler"/-->
<!-- add more handlers here -->
</list>
</property>
</bean>
</property>
</bean>
</property>
</bean>
<bean id="web-context" class="org.eclipse.jetty.webapp.WebAppContext">
<property name="resourceBase" value="./src/main/web"></property>
<property name="contextPath" value="/services/*"></property>
<bean id="servletContextHandler" class="org.eclipse.jetty.servlet.ServletContextHandler">
<property name="contextPath" value="/" />
</bean>
<bean id="javaVersion" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="targetObject" ref="servletContextHandler"/>
<property name="targetMethod" value="addServlet"/>
<property name="arguments">
<list>
<bean class="org.eclipse.jetty.servlet.ServletHolder">
<property name="name" value="services" />
<property name="servlet">
<bean class="org.apache.cxf.transport.servlet.CXFServlet"/>
</property>
</bean>
<value>/</value>
</list>
</property>
</bean>
</beans>
My rest service class looks like this:
#Path("/test") // bind to versionnr in path
public class RestService{
#GET
public long get() {
return 1L;
}
}
Whenever I make a request to localhost:8080/services/test I get the following error message:
service not found.
I want to configure my embedded jetty server with jaxrs but it doesn't seem to work. Have I misconfigured jetty?
If you are using Spring, and all your dependencies are well placed, the only thing you need to expose a restful service is your first file.
cxf-rt-transports-http-jetty will take care of the link between your service code and the jetty server.
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.2.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
<context:annotation-config />
<bean id="serviceImpl" class="com.as.rover.service.rest.serviceImpl" ></bean>
<!-- CXF -->
<import resource="classpath:META-INF/cxf/cxf.xml" />
<jaxrs:server id="JaxrsService" address="http://localhost:6066/services">
<jaxrs:serviceBeans>
<ref bean="serviceImpl" />
</jaxrs:serviceBeans>
</jaxrs:server>
Hope it helps.
When i click on /signIn/facebook button it redirect me to facebook page i authorize and then it redirect me to my redirectUrl but with parametr error=provider. What i do wrong? As far as i know it shoud redirect to SignInAdapter and to compare userIds or something like this. How can i debug these. Why it's not working. My signInController should to redirect me to the signup page isn't it? here is my configuration:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd"
default-lazy-init="true">
<bean id="connectionFactoryLocator"
class="org.springframework.social.connect.support.ConnectionFactoryRegistry">
<property name="connectionFactories">
<list>
<bean
class="org.springframework.social.facebook.connect.FacebookConnectionFactory">
<constructor-arg value="${facebook.appId}" />
<constructor-arg value="${facebook.appSecret}" />
</bean>
</list>
</property>
</bean>
<bean id="usersConnectionRepository"
class="org.springframework.social.connect.jdbc.JdbcUsersConnectionRepository">
<constructor-arg ref="dataSource" />
<constructor-arg ref="connectionFactoryLocator" />
<constructor-arg ref="textEncryptor" />
</bean>
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/shop" />
<property name="username" value="root" />
<property name="password" value="root" />
</bean>
<bean id="connectionRepository" factory-method="createConnectionRepository"
factory-bean="usersConnectionRepository" scope="request">
<constructor-arg value="guest" />
<aop:scoped-proxy proxy-target-class="false" />
</bean>
<bean class="org.springframework.social.connect.web.ProviderSignInController">
<constructor-arg ref="simpleSignInAdapter" />
<property name="applicationUrl" value="${application.url}" />
<property name="signUpUrl" value="/signup" />
</bean>
<bean id="simpleSignInAdapter" class="com.social.SimpleSignInAdapter" />
<bean class="org.springframework.social.connect.web.ConnectController">
<!-- relies on by-type autowiring for the constructor-args -->
<property name="applicationUrl" value="${application.url}" />
</bean>
<bean id="textEncryptor" class="org.springframework.security.crypto.encrypt.Encryptors"
factory-method="noOpText" />
</beans>