<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Activiti with Spring Boot and two datasources in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/activiti-with-spring-boot-and-two-datasources/m-p/205954#M159084</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have set up a project with the Activiti Spring Boot configuration. Because I don't want to pollute the Activiti db with the tables related to the business logic of this application, I have set up two data sources:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="language-java line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;@Bean&lt;BR /&gt;@Primary&lt;BR /&gt;@ConfigurationProperties(prefix="datasource.app")&lt;BR /&gt;public DataSource appDataSource() {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return DataSourceBuilder.create().build();&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;@Bean&lt;BR /&gt;@ConfigurationProperties(prefix="datasource.activiti")&lt;BR /&gt;public DataSource activitiDataSource() {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return DataSourceBuilder.create().build();&lt;BR /&gt;}&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The appDataSource is marked as primary since I plan to make use of the autoconfig of JPA with it. What I'm wondering is how to configure Activiti to pick up the secondary activitiDataSource instead of appDataSource. Someone has posted a very similar and unanswered&amp;nbsp; &lt;/SPAN&gt;&lt;A href="http://stackoverflow.com/questions/26889416/specify-separate-datasource-for-activiti-in-a-spring-boot-app" rel="nofollow noopener noreferrer"&gt;question on Stack Overflow&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 24 Aug 2015 08:54:33 GMT</pubDate>
    <dc:creator>sebljun</dc:creator>
    <dc:date>2015-08-24T08:54:33Z</dc:date>
    <item>
      <title>Activiti with Spring Boot and two datasources</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/activiti-with-spring-boot-and-two-datasources/m-p/205954#M159084</link>
      <description>I have set up a project with the Activiti Spring Boot configuration. Because I don't want to pollute the Activiti db with the tables related to the business logic of this application, I have set up two data sources:@Bean@Primary@ConfigurationProperties(prefix="datasource.app")public DataSource appDa</description>
      <pubDate>Mon, 24 Aug 2015 08:54:33 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/activiti-with-spring-boot-and-two-datasources/m-p/205954#M159084</guid>
      <dc:creator>sebljun</dc:creator>
      <dc:date>2015-08-24T08:54:33Z</dc:date>
    </item>
    <item>
      <title>Re: Activiti with Spring Boot and two datasources</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/activiti-with-spring-boot-and-two-datasources/m-p/205955#M159085</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In the process engine configuration you can specify the datasource name. But in combination with Spring Boot I don't know the answer immediately. Did you look into the source code, how the Activiti process engine configuration is created with Activiti Spring Boot?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best regards,&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Aug 2015 07:59:52 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/activiti-with-spring-boot-and-two-datasources/m-p/205955#M159085</guid>
      <dc:creator>trademak</dc:creator>
      <dc:date>2015-08-26T07:59:52Z</dc:date>
    </item>
    <item>
      <title>Re: Activiti with Spring Boot and two datasources</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/activiti-with-spring-boot-and-two-datasources/m-p/205956#M159086</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I did now and found the configuration in &lt;/SPAN&gt;&lt;A href="https://github.com/Activiti/Activiti/blob/master/modules/activiti-spring-boot/spring-boot-starters/activiti-spring-boot-starter-basic/src/main/java/org/activiti/spring/boot/DataSourceProcessEngineAutoConfiguration.java#L38" rel="nofollow noopener noreferrer"&gt;DataSourceProcessEngineAutoConfiguration&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;By adding this class I managed to override the default configuration and specify what data source I wanted with @Qualifier:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;java&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;@Configuration&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;@AutoConfigureAfter(DataSourceAutoConfiguration.class)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;public class ActivitiDatasourceConfiguration extends AbstractProcessEngineAutoConfiguration {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; @Bean&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public SpringProcessEngineConfiguration springProcessEngineConfiguration(&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @Qualifier("activitiDataSource") DataSource dataSource,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PlatformTransactionManager transactionManager,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SpringAsyncExecutor springAsyncExecutor) throws IOException {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return this.baseSpringProcessEngineConfiguration(dataSource, transactionManager, springAsyncExecutor);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;/java&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I do not know if this is the appropriate way to do this but so far it has worked for me.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;As an aside the &lt;/SPAN&gt;&lt;A href="http://docs.spring.io/spring-boot/docs/current/reference/html/howto-database-initialization.html#howto-execute-flyway-database-migrations-on-startup" rel="nofollow noopener noreferrer"&gt;Flyway Spring Boot integration&lt;/A&gt;&lt;SPAN&gt; solves this problem in a convenient way. The desired datasource is simply annotated with @FlywayDataSource. If there is interest for a similar solution, I might make an attempt at creating a pull request.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Aug 2015 09:40:10 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/activiti-with-spring-boot-and-two-datasources/m-p/205956#M159086</guid>
      <dc:creator>sebljun</dc:creator>
      <dc:date>2015-08-26T09:40:10Z</dc:date>
    </item>
  </channel>
</rss>

