custom spring context loder
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2016 04:49 PM
Please guide on setting custom spring context in activiti-app.war.
In SericeTask javaDelegate, we have many dependencies to inject (RestTemplate, some DAO etc..)
<context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/classes/applicationContext.xml</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener>
I tried to add spring context loader, but autowiring always return null onject.
Thanks for any help.
- Labels:
-
Archive
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2016 06:26 AM
Anyway, putting your configuration classes with the beans you want to expose in the component scanned packages should do the trick.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2016 07:29 AM
Do you mean xml based spring configuration will not work as web.xml not read and can't load spring configuration?
We use activiti-app.war and custom jar containing service tasks as java delegate which has dependencies of custom DAOs, RestTemplate and more…

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2016 10:14 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2016 11:56 AM
According to below thread, web.xml is not read, and I cant find any default or existing spring configuration file.
https://forums.activiti.org/content/custom-spring-context
<code>
<?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: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">
<context:annotation-config/>
<context:component-scan base-package="com.myservicetask.package"/>
<!– RestTemplate definition for autowiring –>
<bean id="restTemplate" class="org.springframework.web.client.RestTemplate" />
</beans>
</code>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2016 12:21 PM
The Enterprise version uses JavaConfig and no XML. Also the web.xml is bare minimum and only needed to bootup the Spring container. To add custom logic, use for example https://docs.alfresco.com/activiti/docs/dev-guide/1.4.0/#_spring_beans
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2016 03:16 PM
It works with https://docs.alfresco.com/activiti/docs/dev-guide/1.4.0/#_spring_beans
Is it possible to use our custom package instead of : com.activiti.extension.bean and com.activiti.extension.conf ?
I tried using custom packages with @ComponentScan annotation, but it always fails with:
<code> org.activiti.engine.impl.javax.el.PropertyNotFoundException: Cannot resolve identifier </code>
Thanks for any further assistance.
If possible, kindly move this topic to Enterprise forum please?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2016 06:19 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2016 04:36 PM
<java>
package com.sample.bpm.conf;
import com.sample.bpm.bean.SampleBean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@Configuration
@ComponentScan(basePackageClasses={SampleConfig.class, SampleBean.class})
public class SampleConfig{
…
}
</java>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2016 12:37 PM
The @ComponentScan on that bean can point to any of the packages you'd like to scan additionally.
