Advertisement
Guest User

Untitled

a guest
Feb 27th, 2015
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. package com.springapp.config;
  2.  
  3. import org.slf4j.Logger;
  4. import org.slf4j.LoggerFactory;
  5. import org.springframework.beans.factory.annotation.Autowired;
  6. import org.springframework.context.annotation.AdviceMode;
  7. import org.springframework.context.annotation.Bean;
  8. import org.springframework.context.annotation.ComponentScan;
  9. import org.springframework.context.annotation.Configuration;
  10. import org.springframework.jdbc.datasource.DataSourceTransactionManager;
  11. import org.springframework.transaction.PlatformTransactionManager;
  12. import org.springframework.transaction.annotation.EnableTransactionManagement;
  13.  
  14. import javax.sql.DataSource;
  15.  
  16. /**
  17. * Service config will scan all @service component of the application.
  18. * http://javaetmoi.com/2014/06/spring-framework-java-configuration/
  19. *
  20. */
  21. @Configuration
  22. //@EnableAsync
  23. //@EnableScheduling
  24. //@EnableAspectJAutoProxy
  25. //@EnableCaching
  26. @ComponentScan(value = {"com.springapp.service.support"})
  27. //@EnableTransactionManagement(mode = AdviceMode.PROXY)
  28. public class ServiceConfig {
  29.  
  30. private final Logger log = LoggerFactory.getLogger(ServiceConfig.class);
  31.  
  32. @Autowired
  33. private DataSource dataSource;
  34.  
  35. @Bean
  36. public PlatformTransactionManager transactionManager() {
  37. return new DataSourceTransactionManager(dataSource);
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement