Skip to content

Commit

Permalink
Merge pull request #55 from NitorCreations/set-datasource-transaction…
Browse files Browse the repository at this point in the history
…manager

Added DataSourceTransactionManager to NflowJettyConfiguration
  • Loading branch information
efonsell committed Oct 14, 2014
2 parents f80c99f + d29d9f2 commit dc28ee8
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import javax.inject.Inject;
import javax.inject.Named;
import javax.sql.DataSource;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
import javax.ws.rs.ext.RuntimeDelegate;
Expand All @@ -28,6 +29,9 @@
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
Expand All @@ -46,6 +50,7 @@
@PropertySource("classpath:nflow-jetty.properties")
@ComponentScan("com.nitorcreations.nflow.jetty")
@Import(value = { RestConfiguration.class, JmxConfiguration.class})
@EnableTransactionManagement
public class NflowJettyConfiguration {

private static final Logger logger = LoggerFactory.getLogger(NflowJettyConfiguration.class);
Expand Down Expand Up @@ -140,4 +145,8 @@ public ResourceListingProvider resourceListingProvider() {
public static class JaxRsApiApplication extends Application {
}

@Bean
public PlatformTransactionManager transactionManager(@Named("nflowDatasource") DataSource dataSource) {
return new DataSourceTransactionManager(dataSource);
}
}

0 comments on commit dc28ee8

Please sign in to comment.