package com.example.demo.provider;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.tomcat.jdbc.pool.DataSource;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ImportResource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.PlatformTransactionManager;
/**
* 路径:com.example.demo.provider
* 类名:
* 功能:《用一句话描述一下》
* 备注:
* 创建人:tanyinping
* 创建时间:2018/6/15 16:15
* 修改人:
* 修改备注:
* 修改时间:
*/
@SpringBootApplication
@MapperScan("com.example.demo.provider.dao")
@ImportResource("classpath:provider.xml")
public class ApringbootDubboProviderApplication {
@Bean
@ConfigurationProperties(prefix="spring.datasource")
public DataSource dataSource() {
return new org.apache.tomcat.jdbc.pool.DataSource();
}
@Bean
public SqlSessionFactory sqlSessionFactoryBean() throws Exception {
SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
sqlSessionFactoryBean.setDataSource(dataSource());
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
sqlSessionFactoryBean.setMapperLocations(resolver.getResources("classpath:/mapper/*.xml"));
return sqlSessionFactoryBean.getObject();
}
@Bean
public PlatformTransactionManager transactionManager() {
return new DataSourceTransactionManager(dataSource());
}
public static void main(String[] args) throws InterruptedException {
SpringApplication.run(ApringbootDubboProviderApplication.class, args);
//pom中没有加spring-boot-starter-web依赖,启动时没有tomcat容器,会自动退出,所以加了一个sleep防止自动退出
Thread.sleep(Long.MAX_VALUE);
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
springboot+dubbo+myBatis集成
共138个文件
xml:84个
class:11个
java:11个
4星 · 超过85%的资源 需积分: 50 149 下载量 96 浏览量
2018-06-18
21:09:33
上传
评论 2
收藏 295KB ZIP 举报
温馨提示
使用dubbo+zookeeper实现简化的微服务架构,springboot+dubbo+zookeeper+myBatis实现微服务集成
资源推荐
资源详情
资源评论
收起资源包目录
springboot+dubbo+myBatis集成 (138个子文件)
ApringbootDubboProviderApplication.class 2KB
UserController.class 1KB
UserServiceImpl.class 1KB
SpringbootDubboClientApplication.class 906B
User.class 831B
SpringbootDubboApiApplication.class 754B
ApringbootDubboProviderApplicationTests.class 697B
SpringbootDubboClientApplicationTests.class 673B
SpringbootDubboApiApplicationTests.class 672B
UserService.class 211B
UserMapper.class 210B
mvnw.cmd 5KB
mvnw.cmd 5KB
mvnw.cmd 5KB
mvnw.cmd 5KB
.gitignore 268B
.gitignore 268B
.gitignore 249B
.gitignore 249B
springboot-dubbo-client.iml 7KB
apringboot-dubbo-provider.iml 6KB
springboot-dubbo-api.iml 4KB
springboot-dubbo-parent.iml 956B
springboot-dubbo-server.iml 555B
maven-wrapper.jar 46KB
maven-wrapper.jar 46KB
maven-wrapper.jar 46KB
maven-wrapper.jar 46KB
ApringbootDubboProviderApplication.java 2KB
UserController.java 1KB
UserServiceImpl.java 983B
SpringbootDubboClientApplication.java 726B
User.java 712B
UserMapper.java 393B
UserService.java 388B
ApringbootDubboProviderApplicationTests.java 359B
SpringbootDubboApiApplicationTests.java 349B
SpringbootDubboClientApplicationTests.java 348B
SpringbootDubboApiApplication.java 336B
mvnw 6KB
mvnw 6KB
mvnw 6KB
mvnw 6KB
.name 23B
application.properties 326B
application.properties 326B
maven-wrapper.properties 110B
maven-wrapper.properties 110B
maven-wrapper.properties 110B
maven-wrapper.properties 110B
application.properties 18B
application.properties 18B
application.properties 0B
application.properties 0B
workspace.xml 78KB
uiDesigner.xml 9KB
pom.xml 3KB
pom.xml 2KB
pom.xml 2KB
provider.xml 2KB
provider.xml 2KB
pom.xml 1KB
consumer.xml 1KB
consumer.xml 1KB
modules.xml 1KB
compiler.xml 1KB
misc.xml 935B
Maven__org_springframework_boot_spring_boot_test_autoconfigure_1_5_9_RELEASE.xml 793B
pom.xml 784B
Maven__org_springframework_boot_spring_boot_starter_logging_1_5_9_RELEASE.xml 772B
Maven__org_springframework_boot_spring_boot_starter_tomcat_1_5_9_RELEASE.xml 765B
Maven__org_springframework_boot_spring_boot_autoconfigure_1_5_9_RELEASE.xml 758B
Maven__org_springframework_boot_spring_boot_starter_test_1_5_9_RELEASE.xml 751B
Maven__org_springframework_boot_spring_boot_starter_web_1_5_9_RELEASE.xml 744B
Maven__org_mybatis_spring_boot_mybatis_spring_boot_autoconfigure_1_3_1.xml 730B
Maven__org_springframework_boot_spring_boot_starter_jdbc_1_5_9_RELEASE.xml 727B
Maven__com_vaadin_external_google_android_json_0_0_20131108_vaadin1.xml 724B
Maven__org_springframework_boot_spring_boot_starter_1_5_9_RELEASE.xml 716B
Maven__org_springframework_boot_spring_boot_test_1_5_9_RELEASE.xml 695B
Maven__org_springframework_spring_expression_4_3_13_RELEASE.xml 689B
Maven__org_mybatis_spring_boot_mybatis_spring_boot_starter_1_3_1.xml 688B
Maven__org_apache_tomcat_embed_tomcat_embed_websocket_8_5_23.xml 684B
Maven__org_springframework_spring_context_4_3_13_RELEASE.xml 668B
Maven__com_fasterxml_jackson_core_jackson_annotations_2_8_0.xml 668B
Maven__org_springframework_spring_webmvc_4_3_13_RELEASE.xml 661B
Maven__org_apache_tomcat_tomcat_annotations_api_8_5_23.xml 660B
Maven__org_springframework_boot_spring_boot_1_5_9_RELEASE.xml 660B
encodings.xml 659B
Maven__org_hibernate_hibernate_validator_5_3_6_Final.xml 658B
Maven__com_fasterxml_jackson_core_jackson_databind_2_8_10.xml 654B
Maven__org_springframework_spring_beans_4_3_13_RELEASE.xml 654B
Maven__org_apache_tomcat_embed_tomcat_embed_core_8_5_23.xml 649B
Maven__org_springframework_spring_test_4_3_13_RELEASE.xml 647B
Maven__org_springframework_spring_core_4_3_13_RELEASE.xml 647B
Maven__org_springframework_spring_web_4_3_13_RELEASE.xml 640B
Maven__org_springframework_spring_aop_4_3_13_RELEASE.xml 640B
Maven__javax_validation_validation_api_1_1_0_Final.xml 635B
Maven__org_apache_tomcat_embed_tomcat_embed_el_8_5_23.xml 635B
Maven__org_jboss_logging_jboss_logging_3_3_1_Final.xml 632B
Maven__com_fasterxml_jackson_core_jackson_core_2_8_10.xml 626B
共 138 条
- 1
- 2
tansci
- 粉丝: 282
- 资源: 26
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页