1、配置文件
Spring Boot使用全局的配置文件征字,文件名是固定的都弹。
- application.properties
- application.yml
配置文件的作用:修改Spring Boot自動配置的默認值。
2匙姜、YAML語法
server:
port: 8081
path: /hello
person:
name: zhangsan
age: 20
boss: false
birth: 2017/11/12
#map寫法1:行內
maps1: {k1: v1, k2: v2}
#map寫法2
maps2:
k3: v3
k4: v4
#數組寫法1
lists1:
- l1
- l2
#數組寫法2:行內
lists2: [l3, l4]
# 對象
dog:
name: 小狗
age: 2
3畅厢、配置文件值注入
3.1、編寫javaBean
/**
* 將配置文件中的配置的每一個屬性值氮昧,映射到組件中
* @ConfigurationProperties: 告訴SpringBoot將本類中的所有屬性和配置文件中相關的配置進行綁定框杜。
* prefix: 配置文件中的prefix指定的屬性下的所有屬性與該組件屬性一一對應。
*
* @ConfigurationProperties: 默認從全局配置文件中獲取值
*
* 只有這個組件是容器中的組件袖肥,容器才能提供@ConfigurationProperties功能咪辱。
*/
@Component
@ConfigurationProperties(prefix = "person")
public class Person implements Serializable {
private String name;
private Integer age;
private Boolean boss;
private Date birth;
private Map<String, Object> maps;
private List<Object> lists;
private Dog dog;
//省略getter和setter
}
可以導入配置文件處理器,然后配置屬性的時候就會有提示
<!--配置文件處理器-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
</dependency>
3.2 @ConfigurationProperties
告訴SpringBoot將本類中的屬性和配置文件中相關的配置進行綁定椎组。
prefix: 配置文件中的prefix指定的屬性下的所有屬性與該組件屬性一一對應油狂。
默認從全局配置文件中獲取值
?
3.3、修改idea的properties默認文件編碼格式
3.4寸癌、@Value和@ConfigurationProperties獲取值的區(qū)別
@ConfigurationProperties | @Value | |
---|---|---|
功能 | 批量注入配置文件中的屬性 | 一個一個指定 |
松散綁定 | 支持松散綁定 | 不支持松散綁定 |
SpEL | 不支持 | 支持 |
JSR303數據校驗 | 支持专筷,@Validated @Email等 | 不支持 |
復雜類型封裝 | 支持 | 不支持 |
總結:
- 如果只是需要配置文件中的某個屬性,建議使用 @Value蒸苇。
- 如果需要映射到某個配置類中的屬性磷蛹,建議使用 @ConfigurationProperties。
3.5溪烤、配置文件注入值數據校驗:
@Component
@ConfigurationProperties(prefix = "person")
@Validated
public class Person implements Serializable {
@Email
private String name;
private Integer age;
private Boolean boss;
private Date birth;
private Map<String, Object> maps;
private List<Object> lists;
private Dog dog;
//省略getter和setter
}
3.6味咳、@PropertySource
用于讀取application.properties之外的properties文件
該注解需要配合@ConfigurationProperties一起使用
需要在@ConfigurationProperties中指定使用的前綴prefix(如果有)
-
需要在@PropertySource指定加載的properties文件
?
#employee.properties
employee.name=lisi
employee.age=30
employee.birth=2017/11/11
employee.boss=false
@Component
@PropertySource(value = {"classpath:employee.properties"},encoding = "UTF-8")
@ConfigurationProperties(prefix = "employee")
public class Employee implements Serializable {
private String name;
private Integer age;
private Date birth;
private Boolean boss;
//省略getter和setter
}
3.7、@ImportResource
- 導入spring的配置文件檬嘀,讓配置文件里面的內容生效莺葫。
SpringBoot里面沒有Spring的配置文件,即使用Spring項目中的xml格式的配置文件枪眉,SpringBoot不能自動識別,如果想讓Spring的配置文件生效再层,需要使用@ImportResource標注在一個配置類上贸铜,推薦標注在主配置類上堡纬。
<!-- beans.xml -->
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="helloService" class="org.com.cay.spring.boot.service.HelloService"></bean>
</beans>
@ImportResource(locations = {"classpath:beans.xml"})
SpringBoot推薦給容器中添加組件的方式:使用注解 @Bean
/**
* @Configuration: 指明當前類是一個注解類,用來代替原來的Spring的xml配置文件
*/
@Configuration
public class MyConfig {
//將方法的返回值添加到容器中蒿秦,容器中這個組件默認的id為方法名
@Bean
public HelloService helloService(){
System.out.println("添加組件:helloService");
return new HelloService();
}
}
4烤镐、配置文件占位符
4.1、隨機數
${random.int}
${random.long}
${random.uuid}
${random.int(value, [max])}
-
...
?
4.2棍鳖、占位符
-
可以引用之前的屬性值炮叶,如果沒有可以使用默認值:
-
例如:
{aaa}不存在渡处,則使用default代替aaa的值镜悉。
?
-
number=${random.int}
name=${random.uuid}
abc=${random.int(100,1000)}
content=${name}得到的值是${number}
#xyz=${random.int}
#如果${xyz}不存在,則使用0000代替
text=${abc}-${xyz:0000}
5医瘫、Profile
Profile是Spring對不同環(huán)境提供不同配置功能的支持侣肄,可通過激活、指定參數等方式快速切換環(huán)境醇份。
5.1稼锅、多Profile文件
在主配置文件編寫的時候,文件名可以是application-{profile}.properties/yml
- application.properties: 默認全局配置文件
- application-dev.properties/yml: 開發(fā)環(huán)境
- application-prod.properties/yml: 生產環(huán)境
- application-test.properties/yml: 測試環(huán)境
5.2僚纷、yml支持多文檔塊方式
server:
port: 8080
spring:
profiles:
active: dev
---
server:
port: 8084
spring:
profiles: dev
---
server:
port: 8085
spring:
profiles: prod
---
server:
port: 8086
spring:
profiles: test
5.3矩距、激活指定Profile
- 在全局配置文件中指定
spring.profiles.active=...
來指定當前的環(huán)境,并使用對應的application-{profile}.properties/yml作為當前環(huán)境使用的配置信息怖竭。 - 虛擬機參數:
Edit Configurations
--->VM options
---->-Dspring.profiles.active=...
- 命令行:
- 打包用命令
java -jar xxxx.jar --spring.profiles.active=...
- IDEA運行設置:
Edit Configurations
--->Program arguments
---->--spring.profiles.active=xx
- 打包用命令
6锥债、配置文件加載位置
Spring Boot啟動會掃描以下位置的application.properties/yml文件作為Spring Boot默認配置文件:
Spring Boot官方文檔章節(jié):加載application.properties配置文件
- 外置,在相對于應用程序運行目錄的/config子目錄里
- 外置侵状,在應用程序運行的目錄里
- 內置赞弥,在resources/config包內
-
內置,在classpath根目錄(resouces目錄下)
application.properties優(yōu)先級.png
總結:
- 優(yōu)先級由高到低趣兄,對于相同的屬性配置绽左,高優(yōu)先級的配置會覆蓋優(yōu)先級低的配置;對于其他不同的屬性配置艇潭,則會進行互補拼窥。
- 優(yōu)先級相同的情況下,同時有application.properties和application.yml蹋凝,那么application.yml里面的屬性就會覆蓋application.properties里的屬性鲁纠。
可以通過spring.config.location來改變默認的配置文件位置:
項目打包好以后,使用命令行參數的形式
--spring.config.location=...
來啟動項目鳍寂,用來指定配置文件的新位置改含,從而使指定的新配置文件和包內的默認加載的配置文件共同起作用行程互補配置。
java -jar spring-boot-02-config-SNAPSHOT.jar --spring.config.location=F:/application.properties
7迄汛、外部配置加載順序
Spring Boot也可以從以下位置加載配置捍壤; 優(yōu)先級從高到低骤视;高優(yōu)先級的配置覆蓋低優(yōu)先級的配置,所有的配置會形成互補配置
- 命令行參數
所有的配置都可以在命令行上進行指定
java -jar spring-boot-02-config-SNAPSHOT.jar --server.port=8087 --server.context-path=/abc
多個配置用空格分開鹃觉; --配置項=值
當然由于使用命令行參數或修改默認的屬性配置的方式并一定是安全的专酗,所以可以通過代碼禁止使用命令行。
SpringApplication application = new SpringApplication(SpringBoot02ConfigApplication.class);
//禁止通過命令行參數修改默認配置屬性
application.setAddCommandLineProperties(false);
//啟動
application.run(args);
- 來自java:comp/env的JNDI屬性
- Java系統屬性(System.getProperties())
- 操作系統環(huán)境變量
- RandomValuePropertySource配置的random.*屬性值
由jar包外 ----向----> jar包內進行尋找盗扇;
優(yōu)先加載帶profile
- jar包外部的application-{profile}.properties或application.yml(帶spring.profile)配置文件
- jar包內部的application-{profile}.properties或application.yml(帶spring.profiles)配置文件
再來加載不帶profile
- jar包外部的application.properties或application.yml(不帶spring.profile)配置文件
- jar包內部的application.properties或application.yml(不帶spring.profile)配置文件
@Configuration注解類上的@PropertySource
-
通過SpringApplication.setDefaultProperties指定的默認屬性
//使用指定的配置文件 SpringApplication application = new SpringApplication(SpringBoot02ConfigApplication.class); //加載指定的配置文件 InputStream is = SpringBoot02ConfigApplication.class.getClassLoader().getResourceAsStream("app.properties"); Properties properties = new Properties(); try { properties.load(is); } catch (IOException e) { e.printStackTrace(); } //設置屬性 application.setDefaultProperties(properties); //啟動 application.run(args);
所有支持的配置加載來源:參考官方文檔
8祷肯、自動配置原理
配置文件能配置的屬性請參照:官方所有自動配置屬性
8.1、自動配置原理
Spring Boot啟動的時候加載主配置類疗隶,開啟了自動配置功能@EnableAutoConfiguration
-
@EnableAutoConfiguration作用:
- 利用EnableAutoConfigurationImportSelector給容器中導入一些組件:
- 可以查看selectImports()方法的內容:
List<String> configurations = getCandidateConfigurations(annotationMetadata, attributes);
? 內部:
List<String> configurations = SpringFactoriesLoader.loadFactoryNames( getSpringFactoriesLoaderFactoryClass(), getBeanClassLoader());
掃描所有jar包類路徑下的
META-INF/spring.factories
佑笋,然后把掃描到這些文件的內容包裝成Properties對象,從Properties中獲取到 EnableAutoConfiguration.class 類對應的值抽减,然后添加到容器中允青。# Auto Configure org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ org.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfiguration,\ org.springframework.boot.autoconfigure.aop.AopAutoConfiguration,\ org.springframework.boot.autoconfigure.amqp.RabbitAutoConfiguration,\ org.springframework.boot.autoconfigure.batch.BatchAutoConfiguration,\ org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration,\ org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration,\ org.springframework.boot.autoconfigure.cloud.CloudAutoConfiguration,\ org.springframework.boot.autoconfigure.context.ConfigurationPropertiesAutoConfiguration,\ org.springframework.boot.autoconfigure.context.MessageSourceAutoConfiguration,\ org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration,\ org.springframework.boot.autoconfigure.couchbase.CouchbaseAutoConfiguration,\ org.springframework.boot.autoconfigure.dao.PersistenceExceptionTranslationAutoConfiguration,\ org.springframework.boot.autoconfigure.data.cassandra.CassandraDataAutoConfiguration,\ org.springframework.boot.autoconfigure.data.cassandra.CassandraRepositoriesAutoConfiguration,\ org.springframework.boot.autoconfigure.data.couchbase.CouchbaseDataAutoConfiguration,\ org.springframework.boot.autoconfigure.data.couchbase.CouchbaseRepositoriesAutoConfiguration,\ org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchAutoConfiguration,\ org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchDataAutoConfiguration,\ org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchRepositoriesAutoConfiguration,\ org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration,\ org.springframework.boot.autoconfigure.data.ldap.LdapDataAutoConfiguration,\ org.springframework.boot.autoconfigure.data.ldap.LdapRepositoriesAutoConfiguration,\ org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration,\ org.springframework.boot.autoconfigure.data.mongo.MongoRepositoriesAutoConfiguration,\ org.springframework.boot.autoconfigure.data.neo4j.Neo4jDataAutoConfiguration,\ org.springframework.boot.autoconfigure.data.neo4j.Neo4jRepositoriesAutoConfiguration,\ org.springframework.boot.autoconfigure.data.solr.SolrRepositoriesAutoConfiguration,\ org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration,\ org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration,\ org.springframework.boot.autoconfigure.data.rest.RepositoryRestMvcAutoConfiguration,\ org.springframework.boot.autoconfigure.data.web.SpringDataWebAutoConfiguration,\ org.springframework.boot.autoconfigure.elasticsearch.jest.JestAutoConfiguration,\ org.springframework.boot.autoconfigure.freemarker.FreeMarkerAutoConfiguration,\ org.springframework.boot.autoconfigure.gson.GsonAutoConfiguration,\ org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration,\ org.springframework.boot.autoconfigure.hateoas.HypermediaAutoConfiguration,\ org.springframework.boot.autoconfigure.hazelcast.HazelcastAutoConfiguration,\ org.springframework.boot.autoconfigure.hazelcast.HazelcastJpaDependencyAutoConfiguration,\ org.springframework.boot.autoconfigure.info.ProjectInfoAutoConfiguration,\ org.springframework.boot.autoconfigure.integration.IntegrationAutoConfiguration,\ org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration,\ org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,\ org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration,\ org.springframework.boot.autoconfigure.jdbc.JndiDataSourceAutoConfiguration,\ org.springframework.boot.autoconfigure.jdbc.XADataSourceAutoConfiguration,\ org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration,\ org.springframework.boot.autoconfigure.jms.JmsAutoConfiguration,\ org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration,\ org.springframework.boot.autoconfigure.jms.JndiConnectionFactoryAutoConfiguration,\ org.springframework.boot.autoconfigure.jms.activemq.ActiveMQAutoConfiguration,\ org.springframework.boot.autoconfigure.jms.artemis.ArtemisAutoConfiguration,\ org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration,\ org.springframework.boot.autoconfigure.groovy.template.GroovyTemplateAutoConfiguration,\ org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration,\ org.springframework.boot.autoconfigure.jooq.JooqAutoConfiguration,\ org.springframework.boot.autoconfigure.kafka.KafkaAutoConfiguration,\ org.springframework.boot.autoconfigure.ldap.embedded.EmbeddedLdapAutoConfiguration,\ org.springframework.boot.autoconfigure.ldap.LdapAutoConfiguration,\ org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration,\ org.springframework.boot.autoconfigure.mail.MailSenderAutoConfiguration,\ org.springframework.boot.autoconfigure.mail.MailSenderValidatorAutoConfiguration,\ org.springframework.boot.autoconfigure.mobile.DeviceResolverAutoConfiguration,\ org.springframework.boot.autoconfigure.mobile.DeviceDelegatingViewResolverAutoConfiguration,\ org.springframework.boot.autoconfigure.mobile.SitePreferenceAutoConfiguration,\ org.springframework.boot.autoconfigure.mongo.embedded.EmbeddedMongoAutoConfiguration,\ org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration,\ org.springframework.boot.autoconfigure.mustache.MustacheAutoConfiguration,\ org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration,\ org.springframework.boot.autoconfigure.reactor.ReactorAutoConfiguration,\ org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration,\ org.springframework.boot.autoconfigure.security.SecurityFilterAutoConfiguration,\ org.springframework.boot.autoconfigure.security.FallbackWebSecurityAutoConfiguration,\ org.springframework.boot.autoconfigure.security.oauth2.OAuth2AutoConfiguration,\ org.springframework.boot.autoconfigure.sendgrid.SendGridAutoConfiguration,\ org.springframework.boot.autoconfigure.session.SessionAutoConfiguration,\ org.springframework.boot.autoconfigure.social.SocialWebAutoConfiguration,\ org.springframework.boot.autoconfigure.social.FacebookAutoConfiguration,\ org.springframework.boot.autoconfigure.social.LinkedInAutoConfiguration,\ org.springframework.boot.autoconfigure.social.TwitterAutoConfiguration,\ org.springframework.boot.autoconfigure.solr.SolrAutoConfiguration,\ org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration,\ org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration,\ org.springframework.boot.autoconfigure.transaction.jta.JtaAutoConfiguration,\ org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration,\ org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration,\ org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration,\ org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration,\ org.springframework.boot.autoconfigure.web.HttpEncodingAutoConfiguration,\ org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration,\ org.springframework.boot.autoconfigure.web.MultipartAutoConfiguration,\ org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration,\ org.springframework.boot.autoconfigure.web.WebClientAutoConfiguration,\ org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration,\ org.springframework.boot.autoconfigure.websocket.WebSocketAutoConfiguration,\ org.springframework.boot.autoconfigure.websocket.WebSocketMessagingAutoConfiguration,\ org.springframework.boot.autoconfigure.webservices.WebServicesAutoConfiguration
每一個xxxAutoConfiguration類都是容器中的一個組件,都加入到容器中卵沉,由此完成自動配置颠锉。
?
每一個自動配置類進行自動配置功能
-
以HttpEncodingAutoConfiguration為例解釋自動配置原理:
@Configuration @EnableConfigurationProperties(HttpEncodingProperties.class) @ConditionalOnWebApplication @ConditionalOnClass(CharacterEncodingFilter.class) @ConditionalOnProperty(prefix = "spring.http.encoding", value = "enabled", matchIfMissing = true) public class HttpEncodingAutoConfiguration { //... @Bean @ConditionalOnMissingBean(CharacterEncodingFilter.class) public CharacterEncodingFilter characterEncodingFilter() { CharacterEncodingFilter filter = new OrderedCharacterEncodingFilter(); filter.setEncoding(this.properties.getCharset().name()); filter.setForceRequestEncoding(this.properties.shouldForce(Type.REQUEST)); filter.setForceResponseEncoding(this.properties.shouldForce(Type.RESPONSE)); return filter; } }
?
-
@EnableConfigurationProperties: 啟動指定類的ConfigurationProperties功能,將配置文件中的值和xxxxProperties綁定起來史汗,并把屬性value的值加入到Spring的IOC容器中琼掠。
- 所有在配置文件中能配置的屬性都是在xxxProperties類中封裝著,配置文件能配置哪些屬性就可以參照某個功能對應的屬性類
@ConfigurationProperties(prefix = "spring.http.encoding")//從配置文件中獲取指定的值與bean的屬性進行綁定 public class HttpEncodingProperties { public static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8"); }
@Conditional:Spring底層注解停撞,可以根據不同的條件瓷蛙,如果滿足指定的條件,整個配置類里面的配置就會生效戈毒。
@ConditionalOnWebApplication:判斷當前應用是否是web應用艰猬,如果是,則當前配置類就生效埋市。
@ConditionalOnClass:判斷當前項目中有沒有value所指定的類
@ConditionalOnProperty:判斷配置文件中是否存在某個配置項:spring.http.encoding.enabled冠桃, matchIfMissing表示如果不存在該配置下,則表示該配置項的值為matchIfMissing指定的值道宅。
以
@ConditionalOnProperty(prefix = "spring.http.encoding", value = "enabled", matchIfMissing = true)
為例食听,判斷是否配置了spring.http.encoding.enabled該項,如果未配置污茵,則該值也默認為生效的樱报。 -
@EnableConfigurationProperties: 啟動指定類的ConfigurationProperties功能,將配置文件中的值和xxxxProperties綁定起來史汗,并把屬性value的值加入到Spring的IOC容器中琼掠。
? 總結:自動配置類是根據當前不同的條件判斷,決定該配置類是否生效泞当,一旦該配置類生效后迹蛤,就會向容器中添加各種組件,這些組件的屬性都是從對應的Properties類中獲取,而這些類里面的每一個屬性又是和配置文件綁定笤受。
8.2穷缤、細節(jié)
@Conditional派生注解(Spring注解版原生的@Conditional作用)
作用:必須是@Conditional指定的條件滿足或者成立,才給容器中添加組件箩兽,配置項里面的內容才能生效。
@Conditional擴展注解 | 作用(判斷是否滿足當前指定條件) |
---|---|
@ConditionalOnJava | 系統的java版本是否符合要求 |
@ConditionalOnBean | 容器中存在指定Bean |
@ConditionalOnMissingBean | 容器中不存在指定Bean |
@ConditionalOnExpression | 滿足SpEL表達式指定 |
@ConditionalOnClass | 系統中有指定的類 |
@ConditionalOnMissingClass | 系統中沒有指定的類 |
@ConditionalOnSingleCandidate | 容器中只有一個指定的Bean章喉,或者這個Bean是首選Bean |
@ConditionalOnProperty | 系統中指定的屬性是否有指定的值 |
@ConditionalOnResource | 類路徑下是否存在指定資源文件 |
@ConditionalOnWebApplication | 當前是web環(huán)境 |
@ConditionalOnNotWebApplication | 當前不是web環(huán)境 |
@ConditionalOnJndi | JNDI存在指定項 |
自動配置類必須在一定的條件下才能生效汗贫。
可以在application.properties中設置 debug=true 屬性,這樣項目啟動過程中控制臺會打印輸出自動配置報告秸脱,這樣就可以很方便的知道哪些自動配置類生效了落包。
=========================
AUTO-CONFIGURATION REPORT
=========================
Positive matches:(自動配置類啟用的)
-----------------
DispatcherServletAutoConfiguration matched:
- @ConditionalOnClass found required class 'org.springframework.web.servlet.DispatcherServlet'; @ConditionalOnMissingClass did not find unwanted class (OnClassCondition)
- @ConditionalOnWebApplication (required) found StandardServletEnvironment (OnWebApplicationCondition)
...
Negative matches: (沒有啟動,沒有匹配成功的自動配置類)
-----------------
ActiveMQAutoConfiguration:
Did not match:
- @ConditionalOnClass did not find required classes 'javax.jms.ConnectionFactory', 'org.apache.activemq.ActiveMQConnectionFactory' (OnClassCondition)
...