【springboot】spring boot配置总结

SpringBoot 09——Spring Boot日志配置 Spring Boot 采用了 slf4j+logback 的组合形式,Spring Boot也提供对JUL、log4j2、Logback提供了默认配置 1、默认日志配置              修改日志默认级别        2、修改日志默认配置       修改日志文件生成路径                     修改日志输出格式          3、日志底层实... 阅读详情

springboot配置

jpa

spring.jpa.hibernate.dialect

  • sqlserver:org.hibernate.dialect.SQLServer2012Dialect
  • mysql:org.hibernate.dialect.MySQL5Dialect

druid

基础配置

# SQL_SERVER
spring:
  datasource:
    #使用druid配置多数据源,此处配置了两个数据源
    druid:
      one:
        driver-class-name: net.sourceforge.jtds.jdbc.Driver
        url: jdbc:jtds:sqlserver://192.168.40.48:1433/HY_MIOT
        username: sa
        password: Admin2012
        #连接超时时间
        max-wait: 60000
        #初始化连接数
        initial-size: 5
        validation-query: select 'x'
        test-while-idle: true
        test-on-borrow: false
        test-on-return: false
        #配置监控统计拦截的filters
        filters: stat
        #最大连接数
        max-active: 20
        #最小连接数
        min-idle: 3
        #连接在池中的最小生成时间,单位毫秒
        min-evictable-idle-time-millis: 300000
        #配置检测需要关闭的空闲连接的间隔时间,单位毫秒
        time-between-eviction-runs-millis: 60000
        #以下两个是关闭druid连接发生异常时自动重连功能
        connection-error-retry-attempts: 0
        break-after-acquire-failure: true
      two:
        driver-class-name: net.sourceforge.jtds.jdbc.Driver
        url: jdbc:jtds:sqlserver://192.168.40.48:1433/qsb_test
        username: sa
        password: Admin2012
        max-wait: 60000
        initial-size: 5
        validation-query: select 'x'
        test-while-idle: true
        test-on-borrow: false
        test-on-return: false
        filters: stat
        max-active: 20
        min-idle: 3
        min-evictable-idle-time-millis: 300000
        time-between-eviction-runs-millis: 60000

druid在springboot中配置

/**
 * druid配置
 */
@Configuration
public class DruidConfiguration {

    @Primary
    @Bean
    @ConfigurationProperties("spring.datasource.druid.one")
    public DataSource dataSourceOne() {
        return DruidDataSourceBuilder.create().build();
    }

    @Bean
    @ConfigurationProperties("spring.datasource.druid.two")
    public DataSource dataSourceTwo() {
        return DruidDataSourceBuilder.create().build();
    }

    @Bean
    public StatFilter stateFilter() {
        StatFilter statFilter = new StatFilter();
        //是否记录慢sql
        statFilter.setLogSlowSql(true);
        //慢sql定义的查询时间,单位毫秒
        statFilter.setSlowSqlMillis(10000);
        return statFilter;
    }
}

logback日志配置

  1. 加一个配置文件logback-spring.xml
  2. 这是常见的配置文件,控制台输出和文件输出的定义。文件配置把INFO级别的和ERROR级别的分开,方便查找原因。
    文件内容:
<?xml version="1.0" encoding="UTF-8"?>
<configuration  scan="true" scanPeriod="60 seconds" debug="false">
    <contextName>qsb-dt</contextName>
    <!--property定义参数变量  可以用${}方式调用-->
    <!--日志目录配置-->
    <property name="log.path" value="./log" />
    <!--控制台颜色配置-->
    <property name="CONSOLE_LOG_PATTERN"
              value="%date{yyyy-MM-dd HH:mm:ss} | %highlight(%-5level) | %boldYellow(%thread) | %boldGreen(%logger) | %msg%n"/>
    <!--输出到控制台-->
    <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
        <!-- <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
             <level>ERROR</level>
         </filter>-->
        <!--展示格式 layout-->
        <layout class="ch.qos.logback.classic.PatternLayout">
            <pattern>${CONSOLE_LOG_PATTERN}</pattern>
            <!--<pattern>%d{HH:mm:ss.SSS} %contextName [%thread] %-5level %logger{36} - %msg%n</pattern>-->
        </layout>
    </appender>

    <!--输出到文件,INFO级别的-->
    <appender name="fileInfoLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <!--如果只是想要 Info 级别的日志,只是过滤 info 还是会输出 Error 日志,因为 Error 的级别高,
                所以我们使用下面的策略,可以避免输出 Error 的日志-->
        <filter class="ch.qos.logback.classic.filter.LevelFilter">
            <!--过滤 Error-->
            <level>ERROR</level>
            <!--匹配到就禁止-->
            <onMatch>DENY</onMatch>
            <!--没有匹配到就允许-->
            <onMismatch>ACCEPT</onMismatch>
        </filter>
        <!--日志名称,如果没有File 属性,那么只会使用FileNamePattern的文件路径规则
            如果同时有<File>和<FileNamePattern>,那么当天日志是<File>,明天会自动把今天
            的日志改名为今天的日期。即,<File> 的日志都是当天的。
        -->
        <File>${log.path}/dt-info.log</File>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${log.path}/dt-info.%d{yyyy-MM-dd}.log</fileNamePattern>
            <!--只保留最近90天的日志-->
            <maxHistory>90</maxHistory>
            <!--用来指定日志文件的上限大小,那么到了这个值,就会删除旧的日志-->
            <!--<totalSizeCap>1GB</totalSizeCap>-->
        </rollingPolicy>
        <encoder>
            <!--指定文件的编码-->
            <!--<charset>UTF-8</charset>-->
            <pattern>%d{HH:mm:ss.SSS} %contextName [%thread] %-5level %logger{36} - %msg%n</pattern>
        </encoder>
    </appender>

    <appender name="fileErrorLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <!--如果只是想要 Error 级别的日志,那么需要过滤一下,默认是 info 级别的,ThresholdFilter-->
        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
            <level>Error</level>
        </filter>
        <!--日志名称,如果没有File 属性,那么只会使用FileNamePattern的文件路径规则
            如果同时有<File>和<FileNamePattern>,那么当天日志是<File>,明天会自动把今天
            的日志改名为今天的日期。即,<File> 的日志都是当天的。
        -->
        <File>${log.path}/dt-error.log</File>
        <!--滚动策略,按照时间滚动 TimeBasedRollingPolicy-->
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <!--文件路径,定义了日志的切分方式——把每一天的日志归档到一个文件中,以防止日志填满整个磁盘空间-->
            <FileNamePattern>${log.path}/dt-error.%d{yyyy-MM-dd}.log</FileNamePattern>
            <!--只保留最近90天的日志-->
            <maxHistory>90</maxHistory>
            <!--用来指定日志文件的上限大小,那么到了这个值,就会删除旧的日志-->
            <!--<totalSizeCap>1GB</totalSizeCap>-->
        </rollingPolicy>
        <!--日志输出编码格式化-->
        <encoder>
            <!--<charset>UTF-8</charset>-->
            <pattern>%d{HH:mm:ss.SSS} %contextName [%thread] %-5level %logger{36} - %msg%n</pattern>
        </encoder>
    </appender>

    <!--必须的根节点,里面的appender就是上面定义的,需要在这里注册-->
    <root level="info">
        <appender-ref ref="console" />
        <appender-ref ref="fileInfoLog" />
        <appender-ref ref="fileErrorLog" />
    </root>

</configuration>

springboot功能

开发环境热启动

  1. pom.xml 中添加依赖
<!--开发环境热部署插件-->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-devtools</artifactId>
    <optional>true</optional>
</dependency>
  1. 修改idea build project automatically (勾选)
    file->settings->build,execution,deployment -> compile

  2. alt+shift+ctrl+/ 设置register (勾选)
    compiler.automake.allow.when.app.running

获取ApplicationContext的方式

  • 说明:适用于web和非web方式
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;

@Component
@Lazy(false)
public class ApplicationContextRegister implements ApplicationContextAware {
    private static final Logger LOGGER = LoggerFactory.getLogger(ApplicationContextRegister.class);
    private static ApplicationContext APPLICATION_CONTEXT;

    /**  * 设置spring上下文  *  * @param applicationContext spring上下文  * @throws BeansException  */
    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        LOGGER.debug("ApplicationContext registed-->{}", applicationContext);  APPLICATION_CONTEXT = applicationContext;
    }

    public static ApplicationContext getApplicationContext() {
        return APPLICATION_CONTEXT;
    }
}

多数据源的配置和切面切换

  1. 添加多数据源的配置,需要druid依赖
spring:
  datasource:
    type: com.alibaba.druid.pool.DruidDataSource
    url: jdbc:jtds:sqlserver://192.168.40.1:1433/ds
    driver-class-name: net.sourceforge.jtds.jdbc.Driver
    username: sa
    password: xxx
  application:
    name: qsb-dt

# 更多数据源
custom:
  datasource:
    names: ds1,ds2
    ds1:
      type: com.alibaba.druid.pool.DruidDataSource
      driver-class-name: net.sourceforge.jtds.jdbc.Driver
      url: jdbc:jtds:sqlserver://192.168.40.1:1433/ds1
      username: sa
      password: xxx
    ds2:
      type: com.alibaba.druid.pool.DruidDataSource
      driver-class-name: net.sourceforge.jtds.jdbc.Driver
      url: jdbc:jtds:sqlserver://192.168.40.1:1433/ds2
      username: sa
      password: xxx
  1. 创建以下所有类
    • DynamicDataSource
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;
/**
 * 其实springboot已经集成了一个切换多数据源的方法,AbstractRoutingDataSource
 * 可以理解为一个map,它的key是数据源的名称,可以自己定义,它的value就是对应
 * 的数据源,底层的切换不需要关心,只需要告诉
 /
public class DynamicDataSource extends AbstractRoutingDataSource {

    @Override
    protected Object determineCurrentLookupKey() {
        return DynamicDataSourceContextHolder.getDataSourceType();
    }

}
  • DynamicDataSourceContextHolder
import java.util.ArrayList;
import java.util.List;

/**
 * 这是动态数据员的实际切换类。底层的切换不需要关心,只需要告诉需要的数据源
 * 的name就可以了。这边的保持当前数据源的name用的是ThreadLocal,为的是线程安
 * 全,保障线程安全。
 */
public class DynamicDataSourceContextHolder {

    private static final ThreadLocal<String> contextHolder = new ThreadLocal<String>();
    public static List<String> dataSourceIds = new ArrayList<>();

    //切换数据源的方法
    public static void setDataSourceType(String dataSourceType) {
        contextHolder.set(dataSourceType);
    }

    public static String getDataSourceType() {
        return contextHolder.get();
    }

    public static void clearDataSourceType() {
        contextHolder.remove();
    }

    /**
     * 判断指定DataSrouce当前是否存在
     *
     * @param dataSourceId
     */
    public static boolean containsDataSource(String dataSourceId){
        return dataSourceIds.contains(dataSourceId);
    }
}
  • DynamicDataSourceRegister
/**
 * 动态数据源注册<br/>
 * 启动动态数据源请在启动类中(如SpringBootSampleApplication)
 * 添加 @Import(DynamicDataSourceRegister.class)
 *
 */
public class DynamicDataSourceRegister
        implements ImportBeanDefinitionRegistrar, EnvironmentAware {

    private static final Logger logger = LoggerFactory.getLogger(DynamicDataSourceRegister.class);

    private ConversionService conversionService = new DefaultConversionService();
    private PropertyValues dataSourcePropertyValues;

    // 如配置文件中未指定数据源类型,使用该默认值
    private static final Object DATASOURCE_TYPE_DEFAULT = "org.apache.tomcat.jdbc.pool.DataSource";
    // private static final Object DATASOURCE_TYPE_DEFAULT =
    // "com.zaxxer.hikari.HikariDataSource";

    // 数据源
    private DataSource defaultDataSource;
    private Map<String, DataSource> customDataSources = new HashMap<>();

    @Override
    public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
        Map<Object, Object> targetDataSources = new HashMap<Object, Object>();
        // 将主数据源添加到更多数据源中
        targetDataSources.put("dataSource", defaultDataSource);
        DynamicDataSourceContextHolder.dataSourceIds.add("dataSource");
        // 添加更多数据源
        targetDataSources.putAll(customDataSources);
        for (String key : customDataSources.keySet()) {
            DynamicDataSourceContextHolder.dataSourceIds.add(key);
        }

        // 创建DynamicDataSource
        GenericBeanDefinition beanDefinition = new GenericBeanDefinition();
        beanDefinition.setBeanClass(DynamicDataSource.class);
        beanDefinition.setSynthetic(true);
        MutablePropertyValues mpv = beanDefinition.getPropertyValues();
        mpv.addPropertyValue("defaultTargetDataSource", defaultDataSource);
        mpv.addPropertyValue("targetDataSources", targetDataSources);
        registry.registerBeanDefinition("dataSource", beanDefinition);

        logger.info("Dynamic DataSource Registry");
    }

    /**
     * 创建DataSource
     *
     * @return
     */
    @SuppressWarnings("unchecked")
    public DataSource buildDataSource(Map<String, Object> dsMap) {
        try {
            Object type = dsMap.get("type");
            if (type == null)
                type = DATASOURCE_TYPE_DEFAULT;// 默认DataSource

            Class<? extends DataSource> dataSourceType;
            dataSourceType = (Class<? extends DataSource>) Class.forName((String) type);

            String driverClassName = dsMap.get("driver-class-name").toString();
            String url = dsMap.get("url").toString();
            String username = dsMap.get("username").toString();
            String password = dsMap.get("password").toString();

            DataSourceBuilder factory = DataSourceBuilder.create().driverClassName(driverClassName).url(url)
                    .username(username).password(password).type(dataSourceType);
            return factory.build();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        return null;
    }

    /**
     * 加载多数据源配置
     */
    @Override
    public void setEnvironment(Environment env) {
        initDefaultDataSource(env);
        initCustomDataSources(env);
    }

    /**
     * 初始化主数据源
     *
     */
    private void initDefaultDataSource(Environment env) {
        // 读取主数据源
        RelaxedPropertyResolver propertyResolver = new RelaxedPropertyResolver(env, "spring.datasource.");
        Map<String, Object> dsMap = new HashMap<>();
        dsMap.put("type", propertyResolver.getProperty("type"));
        dsMap.put("driver-class-name", propertyResolver.getProperty("driver-class-name"));
        dsMap.put("url", propertyResolver.getProperty("url"));
        dsMap.put("username", propertyResolver.getProperty("username"));
        dsMap.put("password", propertyResolver.getProperty("password"));
        logger.info("{}", dsMap);
        defaultDataSource = buildDataSource(dsMap);

        dataBinder(defaultDataSource, env);
    }

    /**
     * 为DataSource绑定更多数据
     *
     * @param dataSource
     * @param env
     */
    private void dataBinder(DataSource dataSource, Environment env){
        RelaxedDataBinder dataBinder = new RelaxedDataBinder(dataSource);
        //dataBinder.setValidator(new LocalValidatorFactory().run(this.applicationContext));
        dataBinder.setConversionService(conversionService);
        dataBinder.setIgnoreNestedProperties(false);//false
        dataBinder.setIgnoreInvalidFields(false);//false
        dataBinder.setIgnoreUnknownFields(true);//true
        if (dataSource instanceof DruidDataSource) {
            ((DruidDataSource) dataSource).setValidationQuery("select 'x'");
        }
        if(dataSourcePropertyValues == null){
            Map<String, Object> rpr = new RelaxedPropertyResolver(env, "spring.datasource").getSubProperties(".");
            Map<String, Object> values = new HashMap<>(rpr);
            // 排除已经设置的属性
            values.remove("type");
            values.remove("driver-class-name");
            values.remove("url");
            values.remove("username");
            values.remove("password");
            dataSourcePropertyValues = new MutablePropertyValues(values);
        }
        dataBinder.bind(dataSourcePropertyValues);
    }

    /**
     * 初始化更多数据源
     *
     */
    private void initCustomDataSources(Environment env) {
        // 读取配置文件获取更多数据源,也可以通过defaultDataSource读取数据库获取更多数据源
        RelaxedPropertyResolver propertyResolver = new RelaxedPropertyResolver(env, "custom.datasource.");
        String dsPrefixs = propertyResolver.getProperty("names");
        for (String dsPrefix : dsPrefixs.split(",")) {// 多个数据源
            Map<String, Object> dsMap = propertyResolver.getSubProperties(dsPrefix + ".");
            DataSource ds = buildDataSource(dsMap);
            customDataSources.put(dsPrefix, ds);
            dataBinder(ds, env);
        }
    }
  • TargetDataSource
import java.lang.annotation.*;

/**
 * 在方法上使用,用于指定使用哪个数据源
 *
 */
@Target({ ElementType.METHOD, ElementType.TYPE })
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface TargetDataSource {
    String name();
}
  • DynamicDataSourceAspect
@Aspect
@Order(-1)// 保证该AOP在@Transactional之前执行
@Component
public class DynamicDataSourceAspect {

    private static final Logger logger = LoggerFactory.getLogger(DynamicDataSourceAspect.class);

    @Before("@annotation(ds)")
    public void changeDataSource(JoinPoint point, TargetDataSource ds) throws Throwable {
        String dsId = ds.name();
        if (!DynamicDataSourceContextHolder.containsDataSource(dsId)) {
            logger.error("数据源[{}]不存在,使用默认数据源 > {}", ds.name(), point.getSignature());
        } else {
            logger.debug("Use DataSource : {} > {}", ds.name(), point.getSignature());
            DynamicDataSourceContextHolder.setDataSourceType(ds.name());
        }
    }

    @After("@annotation(ds)")
    public void restoreDataSource(JoinPoint point, TargetDataSource ds) {
        logger.debug("Revert DataSource : {} > {}", ds.name(), point.getSignature());
        DynamicDataSourceContextHolder.clearDataSourceType();
    }

}
  1. 用测试service进行测试
@Service
public class TestService {
    @Autowired private BdPersonMapper bdPersonMapper;

    /**
     * 指定数据源
     */
    @TargetDataSource(name="ds1")
    public List<BdPerson> findAll1(){
        return bdPersonMapper.findAll();
    }

    /**
     * 指定数据源
     */
    @TargetDataSource(name="ds2")
    public List<BdPerson> findAll2(){
        return bdPersonMapper.findAll();
    }
}
Springboot配置两个数据库 | Spring Boot 17 一、JDBCUtil方式连接第二个数据库 1、执行select语句 String sql = "select id,name,age from user"; // 数据库连接 DruidDataSource druidDataSource = JDBCUtils.getDruidDataSource(ds); JdbcTemplate jdbcTemplate = new JdbcTemplate(druidDataSource); List<Map<String, Object&gt.. 阅读详情

相关推荐

头歌操作系统2023春季课堂练习2.1:外部中断

本关任务:通过相关知识以及实验回答:版本 1 内核的第 6 次时钟中断发生时,断点和恢复点(指令地址)分别是多少?回答问题:当第一行 0/1 字符全部输出完毕的时候一共发生了几次时钟中断,即第一行完全填满时 jiffies 记录的已发生次数为多少?本关任务:通过实际操作回答在输出第一行 0/1 字符的过程中(如下图所示),共发生了几次时钟中断?2.此时 bochs 虚拟机输出的 0/1 字符串是什么?(只填写数字,不填写空格!根据相关知识进行实际操作,一直输入 c 直到 0/1 将第一行完全填满。

weixin_64821608的博客 8126

Spring Data JPA 之 多数据源配置

我们都知道 DataSource 的本质是获得数据库连接,⽽ AbstractRoutingDataSource 帮我们实现了动态获得数据源的可能性。

曾小二的博客 7148

RK3588S开发板实战:手把手教你调试IMX415摄像头(附常见问题排查)

本文提供了基于RK3588S开发板调试IMX415摄像头的完整实战指南。从硬件连接到软件配置,详细解析了设备树(DTS)设置、驱动加载验证及V4L2工具链使用,并附带了常见问题排查方法,帮助开发者快速解决摄像头调试中的典型问题,实现图像采集与性能调优。

assembly8low的博客 590

java sql server 2012_Java Hibernate与SQL Server 2012不起作用?

我有一个可与SQL Server 2008 R2一起使用的Java Hibernate项目配置,现在具有新的OS 8.1(来自7)和SQL Server2012(快速),我无法连接到SQL Server。自从语法上与2008R2一起使用以来,在语法上正确的相关配置:datasource.propertiesjdbc.driverClassName=net.sourceforge.jtds.jdbc...

weixin_34650199的博客 555

SHAP图全解析:从理论到实践,教你如何读懂和优化模型特征

本文全面解析SHAP图,从博弈论基础到实战应用,指导读者如何解读和利用SHAP值优化机器学习模型。通过详解特征重要性条形图、小提琴图、依赖图及决策图等关键可视化工具,帮助数据科学家精准诊断模型、识别特征交互,并将洞见转化为特征工程与模型调试的实际行动,有效提升模型可解释性与性能。

svm4gardener的博客 187

告别专业软件!用QGIS+GDAL免费搞定S-57电子海图,附全套符号库和样式文件

本文详细介绍了如何利用免费开源工具QGIS和GDAL处理S-57电子海图,包括数据转换、符号库配置和专业可视化方案。通过实战指南,用户无需依赖昂贵的商业软件,即可实现从S-57到SHP的转换及专业级海图制作,特别适合预算有限的个人和小型机构。

weixin_33701294的博客 391

Spring Boot 多数据源配置(JPA)

一般一个系统至少有一个数据源,用来持久化业务数据以及查询。单个数据源的系统很常见,在 Spring Boot 框架下配置也很简单。在约定大于配置这个思想下,只需要在配置文件中简单配置下数据库连接信息就行了。除了单数据源系统,在实际工作中,还会遇到多数据源系统。

3170

加权均值向量算法(INFO)详解:从数学原理到智能算法

本文系统介绍了加权均值向量算法(INFO)的理论基础、数学模型与实现应用。该算法基于加权均值数学概念,通过MeanRule规则平衡探索与开发能力,具有结构新颖、参数合理的特点。核心内容包括:1) 算法理论基础,阐述加权均值数学定义与小波函数权重计算;2) 算法原理,详细解析更新规则、向量组合和局部搜索三阶段数学模型;3) 实现方法,提供MATLAB代码关键参数解析;4) 改进方向,介绍INFO-KELM混合模型等变体;5) 应用案例,涵盖函数优化、工程设计与机器学习领域。

qq_42212808的博客 233

JPA方言问题

JPA方言问题,是在进行JPA开发时,可能遇到的问题。主要遇到问题的场景为:JPA由于要适应不同数据库,而不同数据库表结构和数据类型存在的一定的区别,从而造成方言问题。

wangzhezhilu001的专栏 1415

Python爬虫实战:爬取国家企业信用信息公示系统(最新反反爬技术解析)

在当今大数据时代,企业信用数据对于市场分析、风险评估和商业决策具有重要价值。国家企业信用信息公示系统作为官方权威的企业信息平台,包含了全国各类企业的注册信息、行政处罚、经营异常等关键数据。复杂的反爬机制(动态Token、验证码、请求频率限制)数据渲染方式多样(部分内容由JavaScript动态加载)法律与合规风险(需遵守《网络安全法》和网站Robots协议)本文将详细介绍如何使用Python最新技术栈构建一个高效、稳定的企业信用信息爬虫,并重点解析应对各种反爬策略的解决方案。

2201_76125261的博客 2695

RT-DETR改进策略【独家融合改进】| SPD-Conv+PPA 再次提升模型针对小目标的特征提取能力

SPD-Conv是一种新的 CNN 构建模块,用于替代传统 CNN 架构中使用的步长卷积(strided convolution)和池化(pooling)层,它由空间到深度(Space-to-depth,SPD)层和非步长卷积(non - strided convolution)层组成。

Limiiiing的博客 1153

JPA多数据源配置

JPA多数据源配置

qq_51711350的博客 2452

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

【SpringBoot】Spring Boot 项目的打包配置

Spring Boot 基础项目:适合构建独立应用,打包成 JAR 包,包含所有依赖,配置 spring-boot-maven-plugin。Spring Boot + HTML 项目:适用于前端静态资源服务,静态文件(如 HTML、CSS、JS)放在 src/main/resources/static 中,打包为 JAR 包。Spring Boot + Web 项目:适用于需要 Web 层的应用,可以选择内嵌 Web 容器或部署到外部容器,打包为 JAR 或 WAR 包。

qq_40759033的博客 1892

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

Spring Boot 自动配置

当 Spring 容器启动后,一些配置类、bean 对象等就自动存入 Ioc 容器中,而不再需要我们手动去声明,从而简化了程序开发过程,省去了繁琐的配置操作。Spring Boot 的自动配置,就是 SpinrgBoot 将依赖 jar 包中的配置类以及 Bean加载到Spring Ioc 容器中的过程,在本篇文章中,我们主要学习一下两个方面:1. Spring 如何将对象加载到 Spring Ioc 容器中 2. SpringBoot 是如何进行

2301_76161469的博客 3866

【SpringBoot】Spring Boot配置优先级详解

通过上述规则和实例,可以灵活管理Spring Boot应用的配置,适应不同环境需求。具体配置方式需根据实际场景选择,如生产环境推荐使用外部配置文件或环境变量,开发环境可使用命令行参数快速调试。Spring Boot的配置优先级决定了不同配置源之间的覆盖关系,遵循。通过JVM参数设置,优先级仅次于命令行参数。若存在多个同名文件,按目录优先级加载。代码中设置的默认值,优先级最低。形式传递,直接覆盖其他配置。通过系统环境变量设置,例如。(JAR包外部的配置文件)(JAR包内部的配置文件)

2302_79600390的博客 2227

Spring Boot学习记录 02SpringBoot 数据配置

SpringBoot数据配置 Spring注解配置 Spring全注解配置,常用注解: @Configuration :声明在类上,作为配置类(代替xml文件) @Bean :声明在方法上,将方法返回值导入Bean容器,(代替 标签) @value :属性注入(需要属性文件进行搭配应用) @PropertySource :指定外部属性文件 以下代码用 连接池配置进行 测试 在以上篇章 首次应用的代码 基础上进行更改 pom.xml 引入 Druid连接池依赖 <dependency>

柏竹的博客 297
上一篇: 【数据结构】Merkle tree学习
下一篇: 【mysql】win10环境mysql 5.7.22的安装
ColdFireMan
博客等级 码龄10年 27粉丝 112原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值