cancel
Showing results for 
Search instead for 
Did you mean: 

Spring Bean is not recognized for annotation based

honor
Champ in-the-making
Champ in-the-making
Hello,

we decided to make own project for Activiti Rest using Spring Boot Activiti rest dependencies. And for Activiti-Explorer we downloaded source code and using it directly from source instead merging and making a single war from activiti-rest and activiti-explorer. so if i develope custom workflows, processes or implementations for service tasks, i create maven projects or submodules and adding them direclty   as dependency( or even parent poms in order to manage common dependencies). But i really dont know whether its recommended or best practice for using Activiti Rest and Explorer.


My Problem is. i can create new workflows and referencing delegaters like following


activiti:delegateExpression="${databaseDelegateBean}"





@Component("databaseDelegateBean")
@Scope(value = "prototype")
public class DatabaseServiceDelegate implements JavaDelegate {


    private Logger logger = LoggerFactory.getLogger(DatabaseServiceDelegate.class);

    @Autowired
    @Qualifier("dbHelperService")
    private DBHelperService dbHelperService;

    private Expression hostname;

    private Expression port;

    public DatabaseServiceDelegate(){
        logger.info("Hello my friend !!!!");
    }

    @Override
    public void execute(DelegateExecution delegateExecution) throws Exception {

    …




and its work like a charm. But Delegate bean is just recognized and created if i declare it in  "activiti-custom-context.xml" like following


    <bean id="databaseDelegateBean" class="com.vadi.designer.extension.database.handler.DatabaseServiceDelegate"/>


But unfortunately not, if i add Component annotation like above  and add package to basePackages in ComponentScan in ApplicationConfiguration class like following



@ComponentScan(basePackages = { "org.activiti.explorer.conf" , "com.designer.extension" })



Does anyone know, why it isnt working ? or am i doing wrong something ?


Thanks in Advance



2 REPLIES 2

warper
Star Contributor
Star Contributor
Hi honor!
"com.designer.extension" will not scan for "com.vadi.designer.extension"

I do not use application configuration class, but instead put package scan pathes into context.xml
<code>
    <aop:aspectj-autoproxy proxy-target-class="true"/>
    <context:component-scan base-package="com.activiti.extension.bean.**" />
</code>

honor
Champ in-the-making
Champ in-the-making
Hi Warper

i already found problem. actually i removed it for posting here Smiley Happy so packages are ok. But problem was indeed "**" for recursive component scan. Component has been found after changing it to "com.designer.extension.**"  Thank you for your reply !