SpringBoot+MyBatista+MySql+application.yml配置别名映射

SpringBoot+MyBatista+MySql+application.yml配置别名映射

1、创建SpringBoot项目,导入依赖

   <!-- SpringBoot Web -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <!-- SpringBoot 加载配置文件 -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-configuration-processor</artifactId>
        </dependency>
        <!-- SpringBoot 热加载 -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <optional>true</optional>
        </dependency>
        <!-- SpringBoot lombok -->
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            
  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是一个简单的Spring Boot RabbitMQ应用程序的完整application.yml配置代码示例: ```yaml spring: rabbitmq: host: localhost port: 5672 username: guest password: guest virtual-host: / listener: simple: acknowledge-mode: manual concurrency: 1 max-concurrency: 1 template: exchange: example.exchange routing-key: example.routingKey ``` 解释: - `spring.rabbitmq.host`:RabbitMQ服务器的主机名或IP地址。 - `spring.rabbitmq.port`:RabbitMQ服务器的端口号。 - `spring.rabbitmq.username`:连接RabbitMQ服务器的用户名。 - `spring.rabbitmq.password`:连接RabbitMQ服务器的密码。 - `spring.rabbitmq.virtual-host`:连接RabbitMQ服务器的虚拟主机。 - `spring.rabbitmq.listener.simple.acknowledge-mode`:确认模式,这里是手动确认模式。 - `spring.rabbitmq.listener.simple.concurrency`:消费者线程数。 - `spring.rabbitmq.listener.simple.max-concurrency`:最大消费者线程数。 - `spring.rabbitmq.template.exchange`:消息发送时使用的交换机名。 - `spring.rabbitmq.template.routing-key`:消息发送时使用的路由键。 你也可以通过application.yml文件配置RabbitMQ的其他参数,例如: ```yaml spring: rabbitmq: host: localhost port: 5672 username: guest password: guest virtual-host: / listener: simple: acknowledge-mode: manual concurrency: 1 max-concurrency: 1 template: exchange: example.exchange routing-key: example.routingKey cache: channel: size: 100 checkout-timeout: 5000 connection: mode: connection size: 10 validated: true ``` 解释: - `spring.rabbitmq.cache.channel.size`:通道缓存的大小。 - `spring.rabbitmq.cache.channel.checkout-timeout`:通道缓存中的通道检出超时时间(毫秒)。 - `spring.rabbitmq.cache.connection.mode`:缓存模式,这里是连接模式。 - `spring.rabbitmq.cache.connection.size`:连接缓存的大小。 - `spring.rabbitmq.cache.connection.validated`:连接是否需要验证。 请注意,以上参数仅为示例,具体配置可能因应用程序需求而异。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值