> For the complete documentation index, see [llms.txt](https://jack80342.gitbook.io/spring-boot/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jack80342.gitbook.io/spring-boot/iv.-spring-boot-features/32.-messaging/32.1.-jms/32.1.2-artemis-support.md).

# 32.1.2 Artemis支持

如果发现classpath下存在[Artemis](http://activemq.apache.org/artemis/)依赖，Spring Boot将自动配置一个`ConnectionFactory`。如果需要broker，Spring Boot将启动内嵌的broker，并对其自动配置（除非模式mode属性被显式设置）。支持的modes包括：`embedded`（明确需要内嵌broker，如果classpath下不存在则出错），`native`（使用`netty`传输协议连接broker）。当配置`native`模式，Spring Boot将配置一个连接broker的`ConnectionFactory`，该broker使用默认的设置运行在本地机器。 **注** 使用`spring-boot-starter-artemis` 'Starter'，则连接已存在的Artemis实例及Spring设施集成JMS所需依赖都会提供，添加`org.apache.activemq:artemis-jms-server`依赖，你可以使用内嵌模式。

Artemis配置控制在外部配置属性`spring.artemis.*`中，例如，在`application.properties`声明以下片段：

```
spring.artemis.mode=native
spring.artemis.host=192.168.1.210
spring.artemis.port=9876
spring.artemis.user=admin
spring.artemis.password=secret
```

当使用内嵌模式时，你可以选择是否启用持久化，及目的地列表。这些可以通过逗号分割的列表来指定，也可以分别定义`org.apache.activemq.artemis.jms.server.config.JMSQueueConfiguration`或`org.apache.activemq.artemis.jms.server.config.TopicConfiguration`类型的bean来进一步配置队列和topic。具体支持选项可参考[ArtemisProperties](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/artemis/ArtemisProperties.java)。
