解决引入spring
520
2022-08-16
spring cloud 配置阿里数据库连接池 druid的示例代码
1.配置pom
mIpIBIiqS
2.配置application.properties
#druid连接池
spring.datasource.type: com.alibaba.druid.pool.DruidDataSource
#最大活跃数
spring.datasource.maxActive: 20
#初始化数量
spring.datasource.initialSize: 1
#最大连接等待超时时间
spring.datasource.maxWait: 60000
#打开PSCache,并且指定每个连接PSCache的大小
spring.datasource.poolPreparedStatements: true
spring.datasource.maxPoolPreparedStatementPerConnectionSize: 20
#通过connectionProperties属性来打开mergeSql功能;慢SQL记录
#connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
spring.datasource.minIdle: 1
spring.datasource.timeBetweenEvictionRunsMillis: 60000
spring.datasource.minEvictableIdleTimeMillis: 300000
spring.datasource.validationQuery: select 1 from dual
spring.datasource.testWhileIdle: true
spring.datasource.testOnBorrow: false
spring.datasource.testOnReturn: false
#配置监控统计拦截的filters,去掉后监控界面sql将无法统计,'wall'用于防火墙
filters: stat, wall, log4j
3.Config配置类
/**
* 说明:第一数据源配置
* from:fhadmin.cn
*/
@Configuration
@MapperScan(basePackages = MasterDataSourceConfig.PACKAGE, sqlSessionFactoryRef = "masterSqlSessionFactory") //扫描 Mapper 接口并容器管理
public class MasterDataSourceConfig {
static final String PACKAGE = "org.fh.mapper.dsno1http://"; //master 目录
static final String MAPPER_LOCATION = "classpath:mybatis/dsno1/*/*.xml"; //扫描的 xml 目录
static final String CONFIG_LOCATION = "classpath:mybatis/dsno1/mybatis-config.xml"; //自定义的mybatis config 文件位置
static final String TYPE_ALIASES_PACKAGE = "org.fh.entity"; //扫描的 实体类 目录
@Value("${datasource.no1.url}")
private String url;
@Value("${datasource.no1.username}")
private String user;
@Value("${datasource.no1.password}")
private String password;
@Value("${datasource.no1.driver-class-name}")
private String driverClass;
@Bean(name = "masterDataSource")
@Primary
public DataSource masterDataSource() {
DruidDataSource dataSource = new DruidDataSource();
dataSource.setDriverClassName(driverClass);
dataSource.setUrl(url);
dataSource.setUsername(user);
dataSource.setPassword(password);
return dataSource;
}
@Bean(name = "masterTransactionManager")
public DataSourceTransactionManager masterTransactionManager() {
return new DataSourceTransactionManager(masterDataSource());
@Bean(name = "masterSqlSessionFactory")
public SqlSessionFactory masterSqlSessionFactory(@Qualifier("masterDataSource") DataSource masterDataSource)throws Exception {
final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
sessionFactory.setDataSource(masterDataSource);
sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(MasterDataSourceConfig.MAPPER_LOCATION));
sessionFactory.setConfigLocation(new DefaultResourceLoader().getResource(MasterDataSourceConfig.CONFIG_LOCATION));
sessionFactory.setTypeAliasesPackage(MasterDataSourceConfig.TYPE_ALIASES_PACKAGE);
return sessionFactory.getObject();
}
-----------------------------------------------------------------自定义表单28. 定义模版:拖拽左侧表单元素到右侧区域,编辑表单元素,保存表单模版29. 表单模版:编辑维护表单模版,复制表单模版,修改模版类型,预览表单模版30. 我的表单:选择表单模版,编辑表单规则,是否上传图片、附件、开启富文本、挂靠流程开关等31. 表单数据:从我的表单进去可增删改查表单数据,修改表单规则32. 挂靠记录:记录表单数据和流程实例ID关联记录,可删除
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~