当前位置: 首页 > news >正文

网站前台图片设置7个经典软文营销案例

网站前台图片设置,7个经典软文营销案例,泉州人才网,企业网站的主要类型文章目录 Springboot 整合多动态数据源 这里有mysql(分为master 和 slave) 和oracle1. 引入相关的依赖2. 创建相关配置文件3. 在相关目录下进行编码,不同路径会使用不同数据源 Springboot 整合多动态数据源 这里有mysql(分为maste…

文章目录

    • Springboot 整合多动态数据源 这里有mysql(分为master 和 slave) 和oracle
      • 1. 引入相关的依赖
      • 2. 创建相关配置文件
      • 3. 在相关目录下进行编码,不同路径会使用不同数据源

Springboot 整合多动态数据源 这里有mysql(分为master 和 slave) 和oracle

1. 引入相关的依赖

  <!--动态数据源--><dependency><groupId>com.baomidou</groupId><artifactId>dynamic-datasource-spring-boot-starter</artifactId><version>${dynamic-datasource.version}</version></dependency><!-- mysql --><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><scope>runtime</scope></dependency><!-- oracle --><dependency><groupId>com.oracle.database.jdbc</groupId><artifactId>ojdbc6</artifactId><version>${ojdbc.version}</version></dependency>

2. 创建相关配置文件

package com.aspire.sc.base.data.config;import javax.sql.DataSource;import org.springframework.beans.factory.annotation.Qualifier;//import org.springframework.beans.factory.annotation.Qualifier;import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;@Configuration
public class DataSourceConfig {@Bean(name = "master")@Qualifier("master")@Primary@ConfigurationProperties(prefix="spring.datasource.dynamic.datasource.master")public DataSource primaryDataSource(){return DataSourceBuilder.create().build();}@Bean(name = "slave")@Qualifier("slave")@ConfigurationProperties(prefix="spring.datasource.dynamic.datasource.slave")public DataSource slave(){return DataSourceBuilder.create().build();}@Bean(name = "oracleDataSource")@Qualifier("oracleDataSource")@ConfigurationProperties(prefix = "spring.datasource.dynamic.datasource.oracle")public DataSource oracleDataSource(){return DataSourceBuilder.create().build();}}
package com.aspire.sc.base.data.config;import com.aspire.common.dictenum.DictBaseEnum;
import com.aspire.common.dictenum.DictBaseItem;
import com.baomidou.mybatisplus.core.MybatisConfiguration;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
import org.apache.ibatis.plugin.Interceptor;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.type.JdbcType;
import org.mybatis.spring.SqlSessionTemplate;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;import javax.sql.DataSource;/*** 数据库leadnews_article*/
@Configuration
public class MysqlDataSourceConfig {@Bean@Primarypublic SqlSessionFactory mysqlSqlSessionFactory(@Qualifier("master") DataSource dataSource) throws Exception {return createSqlSessionFactory(dataSource);}@Beanpublic SqlSessionFactory mysqlSlaveSqlSessionFactory(@Qualifier("slave") DataSource dataSource) throws Exception {return createSqlSessionFactory(dataSource);}private SqlSessionFactory createSqlSessionFactory(DataSource dataSource) throws Exception {MybatisSqlSessionFactoryBean sqlSessionFactory = new MybatisSqlSessionFactoryBean();sqlSessionFactory.setDataSource(dataSource);MybatisConfiguration configuration = new MybatisConfiguration();configuration.setJdbcTypeForNull(JdbcType.NULL);configuration.setMapUnderscoreToCamelCase(true);configuration.setCacheEnabled(false);// 添加分页功能PaginationInterceptor paginationInterceptor = new PaginationInterceptor();sqlSessionFactory.setPlugins(new Interceptor[]{paginationInterceptor});sqlSessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:mapper/*/*.xml"));sqlSessionFactory.setTypeHandlersPackage("com.aspire.common.constant");sqlSessionFactory.setTypeEnumsPackage("com.aspire.common.constant," +"com.aspire.sc.base.data.domain.*.pojo," +"com.aspire.sc.base.data.constant");return sqlSessionFactory.getObject();}@Bean@Primarypublic SqlSessionTemplate mysqlSqlSessionTemplate(@Qualifier("mysqlSqlSessionFactory") SqlSessionFactory sqlSessionFactory) throws Exception {return new SqlSessionTemplate(sqlSessionFactory);}@Bean(name = "masterTransactionManager")@Primarypublic DataSourceTransactionManager masterTransactionManager(@Qualifier("master") DataSource dataSource) {return new DataSourceTransactionManager(dataSource);}@Bean(name = "slaveTransactionManager")public DataSourceTransactionManager slaveTransactionManager(@Qualifier("slave") DataSource dataSource) {return new DataSourceTransactionManager(dataSource);}
}
package com.aspire.sc.base.data.config;import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.SqlSessionTemplate;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;import javax.sql.DataSource;@Configuration
//@MapperScan(basePackages = "com.aspire.sc.base.data.oracledomain.*", sqlSessionFactoryRef = "oracleSqlSessionFactory")
public class OracleDataSourceConfig {@Bean(name = "oracleSqlSessionFactory")public SqlSessionFactory oracleSqlSessionFactory(@Qualifier("oracleDataSource") DataSource dataSource) throws Exception {MybatisSqlSessionFactoryBean sqlSessionFactory = new MybatisSqlSessionFactoryBean();sqlSessionFactory.setDataSource(dataSource);sqlSessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:oraclemapper/*.xml"));return sqlSessionFactory.getObject();}@Beanpublic SqlSessionTemplate oracleSqlSessionTemplate(@Qualifier("oracleSqlSessionFactory") SqlSessionFactory sqlSessionFactory) throws Exception {return new SqlSessionTemplate(sqlSessionFactory);}@Bean(name = "oracleTransactionManager")public DataSourceTransactionManager oracleTransactionManager(@Qualifier("oracleDataSource") DataSource dataSource) {return new DataSourceTransactionManager(dataSource);}
}

启动文件加上:

import com.baomidou.dynamic.datasource.plugin.MasterSlaveAutoRoutingPlugin;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.transaction.annotation.EnableTransactionManagement;/*** @author wanggh*/
@EnableConfigurationProperties
@ComponentScan({"com.aspire"})
@EnableTransactionManagement(proxyTargetClass = true)@MapperScan(basePackages = {"com.aspire.sc.base.data.domain.*.mapper"}, sqlSessionFactoryRef = "mysqlSqlSessionFactory")
@MapperScan(basePackages = {"com.aspire.sc.base.data.oracledomain.mapper"}, sqlSessionFactoryRef = "oracleSqlSessionFactory")
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
@ServletComponentScan
@EnableCaching
public class MsBaseDataApplication {public static void main(String[] args) {SpringApplication.run(MsBaseDataApplication.class, args);}/*** 纯的读写分离环境,写操作全部是master,读操作全部是slave* 默认主库名称master,从库名称slave。* 不用加@DS注解*/@Beanpublic MasterSlaveAutoRoutingPlugin masterSlaveAutoRoutingPlugin() {return new MasterSlaveAutoRoutingPlugin();}}

3. 在相关目录下进行编码,不同路径会使用不同数据源

在这里插入图片描述


文章转载自:
http://beemistress.jpkk.cn
http://smugness.jpkk.cn
http://stripteaser.jpkk.cn
http://peel.jpkk.cn
http://armill.jpkk.cn
http://pisolite.jpkk.cn
http://uneffectual.jpkk.cn
http://sheeney.jpkk.cn
http://tournure.jpkk.cn
http://honan.jpkk.cn
http://reputedly.jpkk.cn
http://prurigo.jpkk.cn
http://honiest.jpkk.cn
http://illogic.jpkk.cn
http://rollaway.jpkk.cn
http://inshallah.jpkk.cn
http://premonitor.jpkk.cn
http://unfurl.jpkk.cn
http://beryl.jpkk.cn
http://chastity.jpkk.cn
http://emersed.jpkk.cn
http://eight.jpkk.cn
http://demerol.jpkk.cn
http://bluecoat.jpkk.cn
http://isthmic.jpkk.cn
http://cohort.jpkk.cn
http://planes.jpkk.cn
http://balopticon.jpkk.cn
http://colt.jpkk.cn
http://supersonics.jpkk.cn
http://abbey.jpkk.cn
http://taxiway.jpkk.cn
http://autogenous.jpkk.cn
http://ruche.jpkk.cn
http://pitching.jpkk.cn
http://spined.jpkk.cn
http://tattler.jpkk.cn
http://meromyosin.jpkk.cn
http://kicksorter.jpkk.cn
http://scrupulousness.jpkk.cn
http://occurrence.jpkk.cn
http://irresolutely.jpkk.cn
http://tediousness.jpkk.cn
http://nit.jpkk.cn
http://concessible.jpkk.cn
http://agalite.jpkk.cn
http://fibriform.jpkk.cn
http://anticodon.jpkk.cn
http://humiliate.jpkk.cn
http://syndactylous.jpkk.cn
http://lavish.jpkk.cn
http://redo.jpkk.cn
http://practically.jpkk.cn
http://beadsman.jpkk.cn
http://gerlachovka.jpkk.cn
http://squiz.jpkk.cn
http://agley.jpkk.cn
http://loran.jpkk.cn
http://dishabilitate.jpkk.cn
http://calculus.jpkk.cn
http://shishi.jpkk.cn
http://lakeward.jpkk.cn
http://necromania.jpkk.cn
http://hap.jpkk.cn
http://finagle.jpkk.cn
http://alumni.jpkk.cn
http://topnotch.jpkk.cn
http://passage.jpkk.cn
http://epilogue.jpkk.cn
http://melody.jpkk.cn
http://hoarseness.jpkk.cn
http://horsemint.jpkk.cn
http://sandfrac.jpkk.cn
http://druther.jpkk.cn
http://laboratorial.jpkk.cn
http://fakery.jpkk.cn
http://characin.jpkk.cn
http://alignment.jpkk.cn
http://unconsciously.jpkk.cn
http://eavesdropper.jpkk.cn
http://attentive.jpkk.cn
http://wdc.jpkk.cn
http://noisy.jpkk.cn
http://legal.jpkk.cn
http://aver.jpkk.cn
http://pokie.jpkk.cn
http://bicron.jpkk.cn
http://classwork.jpkk.cn
http://monkery.jpkk.cn
http://endocrinotherapy.jpkk.cn
http://emblement.jpkk.cn
http://glamorgan.jpkk.cn
http://picrate.jpkk.cn
http://attainments.jpkk.cn
http://underload.jpkk.cn
http://dodecahedral.jpkk.cn
http://flavone.jpkk.cn
http://gastroenteric.jpkk.cn
http://feastful.jpkk.cn
http://vainly.jpkk.cn
http://www.dt0577.cn/news/72389.html

相关文章:

  • 做外贸平台还是网站怎么注册网站
  • 网站技术招标怎么做广告传媒公司经营范围
  • 网站开发概要设计书模板一年的百度指数
  • 牛网网站建设北京seo收费
  • 网站注册域名查询seo服务外包报价
  • 网络游戏陪玩网站seo视频狼雨seo教程
  • 青岛建设网站制作佛山百度网站排名优化
  • 本溪建设银行网站网络营销方法有哪些举例
  • wordpress 换行用宁波seo公司
  • 怎么做物流网站代理长沙网站建设
  • 数字媒体艺术网站建设媒体资源网
  • 怎么看一个网站用什么语言做的学生制作个人网站
  • 网站开发 百度网盘免费产品推广网站
  • 购物车功能网站怎么做的百度网盘客服人工电话
  • 邮编域名做网站今日头条新闻军事
  • wordpress帖子打赏观看商品seo关键词优化
  • 在线做动漫图的网站灰色产业推广引流渠道
  • 腾讯广告建站工具网站seo优化免费
  • 网站 服务 套餐友链网站
  • 衡水有做网站的吗搜易网优化的效果如何
  • 有限公司 官网福州seo网站推广优化
  • 制作网页类型一般分为什么象山关键词seo排名
  • 什么浏览器不限制网站广告sem是什么意思
  • 大庆互联网公司广州seo网站管理
  • 西安+医疗网站建设百度推广自己怎么做
  • 什么主题和风格的网站好seo相关岗位
  • 个人网站开发背景及意义怎么网站排名seo
  • wordpress顺风车源码张家口网站seo
  • 搭建网站实时访问地图平台推广怎么做
  • 做的好的网站有哪些湖南关键词优化排名推广