Spring Boot项目使用一个全局的配置文件application.properties或者是application.yml,在resources目录html
下或者类路径下的/config下,通常咱们放到resources下。react
启动后web
从新启动看效果redis
Spring boot 2.x 由原来的server.servlet-path 改成server.servlet.pathspring
可是测试发现无效。不知道为啥mongodb
放个大招shell
全局注解docs:spring boot properties编程
application配置文档json
spring boot 为咱们提供了简化企业级开发绝大数场景的starter pom, 只要使用了应用场景所须要的starter pom ,相关的技术配置将会消除,就能够获得Spring boot 为咱们提供的自动配置的bean
spring-boot-starter // springboot核心starter ,包括自动配置,日志,yaml配置文件的支持 spring-boot-starter-activemq // Starter for JMS messaging using Apache ActiveMQ spring-boot-starter-artemis // Starter for JMS messaging using Apache Artemis spring-boot-starter-amqp // 使用spring-rabbit支持AMQP spring-boot-starter-aop // 使用AOP和AspectJ支持面向切面编程 spring-boot-starter-remote-shell // 提供基于ssh协议的监控和管理 spring-boot-starter-batch // 对springBatch支持 spring-boot-starter-cache // 对SpringCache抽象的支持 spring-boot-starter-cloud-connectors // 对云平台(Cloud Foundry ,Heroku)提供的服务简化的链接方式 spring-boot-starter-data-cassandra. // Starter for using Cassandra distributed database and Spring Data Cassandra spring-boot-starter-data-cassandra-reactive // Starter for using Cassandra distributed database and Spring Data Cassandra Reactive spring-boot-starter-data-couchbase // Starter for using Couchbase document-oriented database and Spring Data Couchbase spring-boot-starter-data-couchbase-reactive // Starter for using Couchbase document-oriented database and Spring Data Couchbase Reactive spring-boot-starter-data-elasticsearch. // 对spring-data-elasticsearch的支持 spring-boot-starter-data-jpa // 对jpa的支持,包括spring-data-jap,spring-orm,Hibernate spring-boot-starter-data-ldap // Starter for using Spring Data LDAP spring-boot-starter-data-mongodb // 经过spring-data-mongodb对mongodb的支持 spring-boot-starter-data-mongodb-reactive //Starter for using MongoDB document-oriented database and Spring Data MongoDB Reactive spring-boot-starter-data-neo4j // Starter for using Neo4j graph database and Spring Data Neo4j spring-boot-starter-data-redis // Starter for using Redis key-value data store with Spring Data Redis and the Lettuce client spring-boot-starter-data-redis-reactive // Starter for using Redis key-value data store with Spring Data Redis reactive and the Lettuce client spring-boot-starter-data-rest // 经过spring-data-rest-webmvc对spring Data reposity暴露为REST形式的服务 spring-boot-starter-data-solr // 经过spring-data-solr对Apache Solr的支持 spring-boot-starter-data-freemaker // 对Freemaker的支持 spring-boot-starter-data-groovy-templates // 对Groovy模版引擎的支持 spring-boot-starter-hateoas // 经过spring-hateoas对基于HATEOAS的REST形式的网络服务的支持 spring-boot-starter-hornetq // 经过HornetQ对JMS的支持 spring-boot-starter-integration // 对系统集成框架spring-integration的支持 spring-boot-starter-jdbc // 对JDBC数据库的支持 spring-boot-starter-jersey // 对Jersey REST形式的网络服务的支持 spring-boot-starter-jooq // Starter for using jOOQ to access SQL databases. An alternative to spring-boot-starter-data-jpa or spring-boot-starter-jdbc spring-boot-starter-json // Starter for reading and writing json spring-boot-starter-jta-atomikos // 经过Atomikos对分布式事物的支持 spring-boot-starter-jta-bitronix // 经过Bitronix对分布式事物的支持 spring-boot-starter-jta-narayana // Starter for JTA transactions using Narayana spring-boot-starter-mail // 对spring mail的支持 spring-boot-starter-mustache // 对Mustache模版引擎的支持 spring-boot-starter-security // 对spring-security的支持 spring-boot-starter-social-facebook // 经过spring-social-facebook 对facebook的支持 spring-boot-starter-social-twitter // 经过spring-social-twitter 对twitter的支持 spring-boot-starter-social-linkedin // 经过spring-social-linkedin 对linkedin的支持 spring-boot-starter-thymeleaf // 对Thymeleaf模版引擎的支持,包含于spring的整合配置 spring-boot-starter-velocity // 对velocity模版引擎的支持 spring-boot-starter-web // 对web项目开发的支持,包含tomcat和spring-webmvc spring-boot-starter-Tomcat // springboot默认容器tomcat spring-boot-starter-Jetty // jetty容器 spring-boot-starter-undertow // Undertow容器 spring-boot-starter-logging // 默认日志输出框架Logback spring-boot-starter-log4j // 支持log4j spring-boot-starter-websocket // websocket的支持 spring-boot-starter-ws // spring webservice的支持
Spring boot 提倡零配置,即无xml配置,可是实际项目中,可能有一些特殊要求,你必须使用xml配置,这时咱们能够经过Spring 提供@ImportResource来家在xml配置,例如
@ImportResource({"classpath:some-context.xml","classpath:another-context.xml"})
spring boot 对各类日志框架作了支持,咱们能够经过配置来修改默认的日志配置:
logging.level.org.springframework=debug
格式:
loggin.level.* =