cancel
Showing results for 
Search instead for 
Did you mean: 

custom spring context

activitinike
Champ in-the-making
Champ in-the-making
Hello,

I am trying to configure custom spring context with custom java logic in actitivi-app web.cml, but it doesn't wotk.

Please guide how to configure spring context beans.

web.xml
     <listener>          <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>      </listener>      <context-param>          <param-name>contextConfigLocation</param-name>          <param-value>/WEB-INF/foo-spring-beans.xml</param-value>      </context-param> ‍‍‍‍‍‍‍‍‍‍‍


foo-spring-beans.xml
<?xml version="1.1" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans"   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"   xmlns:task="http://www.springframework.org/schema/task" xmlns:context="http://www.springframework.org/schema/context"   xsi:schemaLocation="        http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd        http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.1.xsd        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd">                  <!– Util bean to get custom requestFactory for RestTemplate –>       <bean id="restTemplateSSLUtil" class="com.mypackage.RestTemplateSSLUtil" />       <!– RestTemplate with custom requestFactory –>   <bean id="restTemplate" class="org.springframework.web.client.RestTemplate">      <constructor-arg name="requestFactory">         <bean factory-bean="restTemplateSSLUtil" factory-method="getRestTemplateSSLFactoryInstance" />      </constructor-arg>   </bean>   </beans>‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍


Thanks,
1 REPLY 1

jbarrez
Star Contributor
Star Contributor
The web.xml is not read. You need to have beans with @Configuration on your classpath in a component scanned package.

Which environment are you trying this on?