<html><head><script src="Spring%20Boot%20Reference%20Guide_files/analytics.js" async=""></script><script src="Spring%20Boot%20Reference%20Guide_files/docsearchbarspring.js" async="" type="text/javascript"></script> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Spring Boot Reference Guide</title><link rel="stylesheet" type="text/css" href="Spring%20Boot%20Reference%20Guide_files/manual-singlepage.css"><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><script type="text/javascript" src="Spring%20Boot%20Reference%20Guide_files/jquery-1.js"></script><link rel="stylesheet" href="Spring%20Boot%20Reference%20Guide_files/searchtool.css" type="text/css"><link rel="stylesheet" href="Spring%20Boot%20Reference%20Guide_files/searchtool_spring.css" type="text/css"><style>/* docsearchbarspring Training Classes */ .S2UniGeoipBanner { margin-top: 0px !important; letter-spacing: 0px !important; line-height: 1.2 !important; text-align: left !important; text-indent: 0 !important; text-transform: none !important; word-spacing: 0px !important; cursor: pointer !important; left: 210px !important; position: absolute !important; top: 6px !important; } .S2UniGeoipBanner .S2GPcourse_name { font-size: 11px !important; font-weight: bold !important; font-family: Arial !important; text-transform: uppercase !important; color: #88f !important; } .S2UniGeoipBanner .S2GPcity, .S2UniGeoipBanner .S2GPstart_date { font-family: Arial !important; font-size: 11px !important; color: #bbb !important; } .S2UniGeoipBanner .learn-more-button { display:none !important; }</style></head><body alink="#0000FF" bgcolor="white" link="#0000FF" text="black" vlink="#840084"><div class="book" lang="en"><div class="titlepage"><div><div><h1 class="title"><a name="d0e3"></a>Spring Boot Reference Guide</h1></div><div><div xmlns:d="http://docbook.org/ns/docbook" class="authorgroup"><h2>Authors</h2><span class="author"><span class="firstname">Phillip</span> <span class="surname">Webb</span></span>, <span class="author"><span class="firstname">Dave</span> <span class="surname">Syer</span></span>, <span class="author"><span class="firstname">Josh</span> <span class="surname">Long</span></span>, <span class="author"><span class="firstname">Stéphane</span> <span class="surname">Nicoll</span></span>, <span class="author"><span class="firstname">Rob</span> <span class="surname">Winch</span></span>, <span class="author"><span class="firstname">Andy</span> <span class="surname">Wilkinson</span></span>, <span class="author"><span class="firstname">Marcel</span> <span class="surname">Overdijk</span></span>, <span class="author"><span class="firstname">Christian</span> <span class="surname">Dupuis</span></span>, <span class="author"><span class="firstname">Sébastien</span> <span class="surname">Deleuze</span></span></div></div><div><p class="releaseinfo">1.2.2.RELEASE</p></div><div><p class="copyright">Copyright © 2013-2015 </p></div><div><div class="legalnotice"><a name="d0e98" href="#d0e98"></a><p> Copies of this document may be made for your own use and for distribution to others, provided that you do not charge any fee for such copies and further provided that each copy contains this Copyright Notice, whether distributed in print or electronically. </p></div></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="part"><a href="#boot-documentation">I. Spring Boot Documentation</a></span></dt><dd><dl><dt><span class="chapter"><a href="#boot-documentation-about">1. About the documentation</a></span></dt><dt><span class="chapter"><a href="#boot-documentation-getting-help">2. Getting help</a></span></dt><dt><span class="chapter"><a href="#boot-documentation-first-steps">3. First steps</a></span></dt><dt><span class="chapter"><a href="#_working_with_spring_boot">4. Working with Spring Boot</a></span></dt><dt><span class="chapter"><a href="#_learning_about_spring_boot_features">5. Learning about Spring Boot features</a></span></dt><dt><span class="chapter"><a href="#_moving_to_production">6. Moving to production</a></span></dt><dt><span class="chapter"><a href="#_advanced_topics">7. Advanced topics</a></span></dt></dl></dd><dt><span class="part"><a href="#getting-started">II. Getting started</a></span></dt><dd><dl><dt><span class="chapter"><a href="#getting-started-introducing-spring-boot">8. Introducing Spring Boot</a></span></dt><dt><span class="chapter"><a href="#getting-started-system-requirements">9. System Requirements</a></span></dt><dd><dl><dt><span class="section"><a href="#_servlet_containers">9.1. Servlet containers</a></span></dt></dl></dd><dt><span class="chapter"><a href="#getting-started-installing-spring-boot">10. Installing Spring Boot</a></span></dt><dd><dl><dt><span class="section"><a href="#getting-started-installation-instructions-for-java">10.1. Installation instructions for the Java developer</a></span></dt><dd><dl><dt><span class="section"><a href="#getting-started-maven-installation">10.1.1. Maven installation</a></span></dt><dt><span class="section"><a href="#getting-started-gradle-installation">10.1.2. Gradle installation</a></span></dt></dl></dd><dt><span class="section"><a href="#getting-started-installing-the-cli">10.2. Installing the Spring Boot CLI</a></span></dt><dd><dl><dt><span class="section"><a href="#getting-started-manual-cli-installation">10.2.1. Manual installation</a></span></dt><dt><span class="section"><a href="#getting-started-gvm-cli-installation">10.2.2. Installation with GVM</a></span></dt><dt><span class="section"><a href="#getting-started-homebrew-cli-installation">10.2.3. OSX Homebrew installation</a></span></dt><dt><span class="section"><a href="#getting-started-macports-cli-installation">10.2.4. MacPorts installation</a></span></dt><dt><span class="section"><a href="#getting-started-cli-command-line-completion">10.2.5. Command-line completion</a></span></dt><dt><span class="section"><a href="#getting-started-cli-example">10.2.6. Quick start Spring CLI example</a></span></dt></dl></dd><dt><span class="section"><a href="#getting-started-upgrading-from-an-earlier-version">10.3. Upgrading from an earlier version of Spring Boot</a></span></dt></dl></dd><dt><span class="chapter"><a href="#getting-started-first-application">11. Developing your first Spring Boot application</a></span></dt><dd><dl><dt><span class="section"><a href="#getting-started-first-application-pom">11.1. Creating the POM</a></span></dt><dt><span class="section"><a href="#getting-started-first-application-dependencies">11.2. Adding classpath dependencies</a></span></dt><dt><span class="section"><a href="#getting-started-first-application-code">11.3. Writing the code</a></span></dt><dd><dl><dt><span class="section"><a href="#getting-started-first-application-annotations">11.3.1. The @RestController and @RequestMapping annotations</a></span></dt><dt><span class="section"><a href="#getting-started-first-application-auto-configuration">11.3.2. The @EnableAutoConfiguration annotation</a></span></dt><dt><span class="section"><a href="#getting-started-first-application-main-method">11.3.3. The “main” method</a></span></dt></dl></dd><dt><span class="section"><a href="#getting-started-first-application-run">11.4. Running the example</a></span></dt><dt><span class="section"><a href="#getting-started-first-application-executable-jar">11.5. Creating an executable jar</a></span></dt></dl></dd><dt><span class="chapter"><a href="#getting-started-whats-next">12. What to read next</a></span></dt></dl></dd><dt><span class="part"><a href="#using-boot">III. Using Spring Boot</a></span></dt><dd><dl><dt><span class="chapter"><a href="#using-boot-build-systems">13. Build systems</a></span></dt><dd><dl><dt><span class="section"><a href="#using-boot-maven">13.1. Maven</a></span></dt><dd><dl><dt><span class="section"><a href="#using-boot-maven-parent-pom">13.1.1. Inheriting the starter parent</a></span></dt><dt><span class="section"><a href="#using-boot-maven-without-a-parent">13.1.2. Using Spring Boot without the parent POM</a></span></dt><dt><span class="section"><a href="#using-boot-maven-java-version">13.1.3. Changing the Java version</a></span></dt><dt><span class="section"><a href="#using-boot-maven-plugin">13.1.4. Using the Spring Boot Maven plugin</a></span></dt></dl></dd><dt><span class="section"><a href="#using-boot-gradle">13.2. Gradle</a></span></dt><dt><span class="section"><a href="#using-boot-ant">13.3. Ant</a></span></dt><dt><span class="section"><a href="#using-boot-starter-poms">13.4. Starter POMs</a></span></dt></dl></dd><dt><span class="chapter"><a href="#using-boot-structuring-your-code">14. Structuring your code</a></span></dt><dd><dl><dt><span class="section"><a href="#using-boot-using-the-default-package">14.1. Using the “default” package</a></span></dt><dt><span class="section"><a href="#using-boot-locating-the-main-class">14.2. Locating the main application class</a></span></dt></dl></dd><dt><span class="chapter"><a href="#using-boot-configuration-classes">15. Configuration classes</a></span></dt><dd><dl><dt><span class="section"><a href="#using-boot-importing-configuration">15.1. Importing additional configuration classes</a></span></dt><dt><span class="section"><a href="#using-boot-importing-xml-configuration">15.2. Importing XML configuration</a></span></dt></dl></dd><dt><span class="chapter"><a href="#using-boot-auto-configuration">16. Auto-configuration</a></span></dt><dd><dl><dt><span class="section"><a href="#using-boot-replacing-auto-configuration">16.1. Gradually replacing auto-configuration</a></span></dt><dt><span class="section"><a href="#using-boot-disabling-specific-auto-configutation">16.2. Disabling specific auto-configuration</a></span></dt></dl></dd><dt><span class="chapter"><a href="#using-boot-spring-beans-and-dependency-injection">17. Spring Beans and dependency injection</a></span></dt><dt><span class="chapter"><a href="#using-boot-using-springbootapplication-annotation">18. Using the @SpringBootApplication annotation</a></span></dt><dt><span class="chapter"><a href="#using-boot-running-your-application">19. Running your application</a></span></dt><dd><dl><dt><span class="section"><a href="#using-boot-running-from-an-ide">19.1. Running from an IDE</a></span></dt><dt><span class="section"><a href="#using-boot-running-as-a-packaged-application">19.2. Running as a packaged application</a></span></dt><dt><span class="section"><a href="#using-boot-running-with-the-maven-plugin">19.3. Using the Maven plugin</a></span></dt><dt><span class="section"><a href="#using-boot-running-with-the-gradle-plugin">19.4. Using the Gradle plugin</a></span></dt><dt><span class="section"><a href="#using-boot-hot-swapping">19.5. Hot swapping</a></span></dt></dl></dd><dt><span class="chapter"><a href="#using-boot-packaging-for-production">20. Packaging your application for production</a></span></dt><dt><span class="chapter"><a href="#using-boot-whats-next">21. What to read next</a></span></dt></dl></dd><dt><span class="part"><a href="#boot-features">IV. Spring Boot features</a></span></dt><dd><dl><dt><span class="chapter"><a href="#boot-features-spring-application">22. SpringApplication</a></span></dt><dd><dl><dt><span class="section"><a href="#boot-features-banner">22.1. Customizing the Banner</a></span></dt><dt><span class="section"><a href="#boot-features-customizing-spring-application">22.2. Customizing SpringApplication</a></span></dt><dt><span class="section"><a href="#boot-features-fluent-builder-api">22.3. Fluent builder API</a></span></dt><dt><span class="section"><a href="#boot-features-application-events-and-listeners">22.4. Application events and listeners</a></span></dt><dt><span class="section"><a href="#boot-features-web-environment">22.5. Web environment</a></span></dt><dt><span class="section"><a href="#boot-features-command-line-runner">22.6. Using the CommandLineRunner</a></span></dt><dt><span class="section"><a href="#boot-features-application-exit">22.7. Application exit</a></span></dt></dl></dd><dt><span class="chapter"><a href="#boot-features-external-config">23. Externalized Configuration</a></span></dt><dd><dl><dt><span class="section"><a href="#boot-features-external-config-random-values">23.1. Configuring random values</a></span></dt><dt><span class="section"><a href="#boot-features-external-config-command-line-args">23.2. Accessing command line properties</a></span></dt><dt><span class="section"><a href="#boot-features-external-config-application-property-files">23.3. Application property files</a></span></dt><dt><span class="section"><a href="#boot-features-external-config-profile-specific-properties">23.4. Profile-specific properties</a></span></dt><dt><span class="section"><a href="#boot-features-external-config-placeholders-in-properties">23.5. Placeholders in properties</a></span></dt><dt><span class="section"><a href="#boot-features-external-config-yaml">23.6. Using YAML instead of Properties</a></span></dt><dd><dl><dt><span class="section"><a href="#boot-features-external-config-loading-yaml">23.6.1. Loading YAML</a></span></dt><dt><span class="section"><a href="#boot-features-external-config-exposing-yaml-to-spring">23.6.2. Exposing YAML as properties in the Spring Environment</a></span></dt><dt><span class="section"><a href="#boot-features-external-config-multi-profile-yaml">23.6.3. Multi-profile YAML documents</a></span></dt><dt><span class="section"><a href="#boot-features-external-config-yaml-shortcomings">23.6.4. YAML shortcomings</a></span></dt></dl></dd><dt><span class="section"><a href="#boot-features-external-config-typesafe-configuration-properties">23.7. Typesafe Configuration Properties</a></span></dt><dd><dl><dt><span class="section"><a href="#boot-features-external-config-3rd-party-configuration">23.7.1. Third-party configuration</a></span></dt><dt><span class="section"><a href="#boot-features-external-config-relaxed-binding">23.7.2. Relaxed binding</a></span></dt><dt><span class="section"><a href="#boot-features-external-config-validation">23.7.3. @ConfigurationProperties Validation</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#boot-features-profiles">24. Profiles</a></span></dt><dd><dl><dt><span class="section"><a href="#boot-features-adding-active-profiles">24.1. Adding active profiles</a></span></dt><dt><span class="section"><a href="#boot-features-programmatically-setting-profiles">24.2. Programmatically setting profiles</a></span></dt><dt><span class="section"><a href="#boot-features-profile-specific-configuration">24.3. Profile specific configuration files</a></span></dt></dl></dd><dt><span class="chapter"><a href="#boot-features-logging">25. Logging</a></span></dt><dd><dl><dt><span class="section"><a href="#boot-features-logging-format">25.1. Log format</a></span></dt><dt><span class="section"><a href="#boot-features-logging-console-output">25.2. Console output</a></span></dt><dt><span class="section"><a href="#boot-features-logging-file-output">25.3. File output</a></span></dt><dt><span class="section"><a href="#boot-features-custom-log-levels">25.4. Log Levels</a></span></dt><dt><span class="section"><a href="#boot-features-custom-log-configuration">25.5. Custom log configuration</a></span></dt></dl></dd><dt><span class="chapter"><a href="#boot-features-developing-web-applications">26. Developing web applications</a></span></dt><dd><dl><dt><span class="section"><a href="#boot-features-spring-mvc">26.1. The ‘Spring Web MVC framework’</a></span></dt><dd><dl><dt><span class="section"><a href="#boot-features-spring-mvc-auto-configuration">26.1.1. Spring MVC auto-configuration</a></span></dt><dt><span class="section"><a href="#boot-features-spring-mvc-message-converters">26.1.2. HttpMessageConverters</a></span></dt><dt><span class="section"><a href="#boot-features-spring-message-codes">26.1.3. MessageCodesResolver</a></span></dt><dt><span class="section"><a href="#boot-features-spring-mvc-static-content">26.1.4. Static Content</a></span></dt><dt><span class="section"><a href="#boot-features-spring-mvc-template-engines">26.1.5. Template engines</a></span></dt><dt><span class="section"><a href="#boot-features-error-handling">26.1.6. Error Handling</a></span></dt><dd><dl><dt><span class="section"><a href="#boot-features-error-handling-websphere">Error Handling on WebSphere Application Server</a></span></dt></dl></dd><dt><span class="section"><a href="#boot-features-spring-hateoas">26.1.7. Spring HATEOAS</a></span></dt></dl></dd><dt><span class="section"><a href="#boot-features-jersey">26.2. JAX-RS and Jersey</a></span></dt><dt><span class="section"><a href="#boot-features-embedded-container">26.3. Embedded servlet container support</a></span></dt><dd><dl><dt><span class="section"><a href="#boot-features-embedded-container-servlets-and-filters">26.3.1. Servlets and Filters</a></span></dt><dt><span class="section"><a href="#boot-features-embedded-container-application-context">26.3.2. The EmbeddedWebApplicationContext</a></span></dt><dt><span class="section"><a href="#boot-features-customizing-embedded-containers">26.3.3. Customizing embedded servlet containers</a></span></dt><dd><dl><dt><span class="section"><a href="#boot-features-programmatic-embedded-container-customization">Programmatic customization</a></span></dt><dt><span class="section"><a href="#boot-features-customizing-configurableembeddedservletcontainerfactory-directly">Customizing ConfigurableEmbeddedServletContainer directly</a></span></dt></dl></dd><dt><span class="section"><a href="#boot-features-jsp-limitations">26.3.4. JSP limitations</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#boot-features-security">27. Security</a></span></dt><dt><span class="chapter"><a href="#boot-features-sql">28. Working with SQL databases</a></span></dt><dd><dl><dt><span class="section"><a href="#boot-features-configure-datasource">28.1. Configure a DataSource</a></span></dt><dd><dl><dt><span class="section"><a href="#boot-features-embedded-database-support">28.1.1. Embedded Database Support</a></span></dt><dt><span class="section"><a href="#boot-features-connect-to-production-database">28.1.2. Connection to a production database</a></span></dt><dt><span class="section"><a href="#boot-features-connecting-to-a-jndi-datasource">28.1.3. Connection to a JNDI DataSource</a></span></dt></dl></dd><dt><span class="section"><a href="#boot-features-using-jdbc-template">28.2. Using JdbcTemplate</a></span></dt><dt><span class="section"><a href="#boot-features-jpa-and-spring-data">28.3. JPA and ‘Spring Data’</a></span></dt><dd><dl><dt><span class="section"><a href="#boot-features-entity-classes">28.3.1. Entity Classes</a></span></dt><dt><span class="section"><a href="#boot-features-spring-data-jpa-repositories">28.3.2. Spring Data JPA Repositories</a></span></dt><dt><span class="section"><a href="#boot-features-creating-and-dropping-jpa-databases">28.3.3. Creating and dropping JPA databases</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#boot-features-nosql">29. Working with NoSQL technologies</a></span></dt><dd><dl><dt><span class="section"><a href="#boot-features-redis">29.1. Redis</a></span></dt><dd><dl><dt><span class="section"><a href="#boot-features-connecting-to-redis">29.1.1. Connecting to Redis</a></span></dt></dl></dd><dt><span class="section"><a href="#boot-features-mongodb">29.2. MongoDB</a></span></dt><dd><dl><dt><span class="section"><a href="#boot-features-connecting-to-mongodb">29.2.1. Connecting to a MongoDB database</a></span></dt><dt><span class="section"><a href="#boot-features-mongo-template">29.2.2. MongoTemplate</a></span></dt><dt><span class="section"><a href="#boot-features-spring-data-mongo-repositories">29.2.3. Spring Data MongoDB repositories</a></span></dt></dl></dd><dt><span class="section"><a href="#boot-features-gemfire">29.3. Gemfire</a></span></dt><dt><span class="section"><a href="#boot-features-solr">29.4. Solr</a></span></dt><dd><dl><dt><span class="section"><a href="#boot-features-connecting-to-solr">29.4.1. Connecting to Solr</a></span></dt><dt><span class="section"><a href="#boot-features-spring-data-solr-repositories">29.4.2. Spring Data Solr repositories</a></span></dt></dl></dd><dt><span class="section"><a href="#boot-features-elasticsearch">29.5. Elasticsearch</a></span></dt><dd><dl><dt><span class="section"><a href="#boot-features-connecting-to-elasticsearch">29.5.1. Connecting to Elasticsearch</a></span></dt><dt><span class="section"><a href="#boot-features-spring-data-elasticsearch-repositories">29.5.2. Spring Data Elasticsearch repositories</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#boot-features-messaging">30. Messaging</a></span></dt><dd><dl><dt><span class="section"><a href="#boot-features-jms">30.1. JMS</a></span></dt><dd><dl><dt><span class="section"><a href="#boot-features-hornetq">30.1.1. HornetQ support</a></span></dt><dt><span class="section"><a href="#boot-features-activemq">30.1.2. ActiveMQ support</a></span></dt><dt><span class="section"><a href="#boot-features-jms-jndi">30.1.3. Using a JNDI ConnectionFactory</a></span></dt><dt><span class="section"><a href="#boot-features-using-jms-sending">30.1.4. Sending a message</a></span></dt><dt><span class="section"><a href="#boot-features-using-jms-receiving">30.1.5. Receiving a message</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#boot-features-email">31. Sending email</a></span></dt><dt><span class="chapter"><a href="#boot-features-jta">32. Distributed Transactions with JTA</a></span></dt><dd><dl><dt><span class="section"><a href="#_using_an_atomikos_transaction_manager">32.1. Using an Atomikos transaction manager</a></span></dt><dt><span class="section"><a href="#_using_a_bitronix_transaction_manager">32.2. Using a Bitronix transaction manager</a></span></dt><dt><span class="section"><a href="#_using_a_java_ee_managed_transaction_manager">32.3. Using a Java EE managed transaction manager</a></span></dt><dt><span class="section"><a href="#_mixing_xa_and_non_xa_jms_connections">32.4. Mixing XA and non-XA JMS connections</a></span></dt><dt><span class="section"><a href="#_supporting_an_alternative_embedded_transaction_manager">32.5. Supporting an alternative embedded transaction manager</a></span></dt></dl></dd><dt><span class="chapter"><a href="#boot-features-integration">33. Spring Integration</a></span></dt><dt><span class="chapter"><a href="#boot-features-jmx">34. Monitoring and management over JMX</a></span></dt><dt><span class="chapter"><a href="#boot-features-testing">35. Testing</a></span></dt><dd><dl><dt><span class="section"><a href="#boot-features-test-scope-dependencies">35.1. Test scope dependencies</a></span></dt><dt><span class="section"><a href="#boot-features-testing-spring-applications">35.2. Testing Spring applications</a></span></dt><dt><span class="section"><a href="#boot-features-testing-spring-boot-applications">35.3. Testing Spring Boot applications</a></span></dt><dd><dl><dt><span class="section"><a href="#boot-features-testing-spring-boot-applications-with-spock">35.3.1. Using Spock to test Spring Boot applications</a></span></dt></dl></dd><dt><span class="section"><a href="#boot-features-test-utilities">35.4. Test utilities</a></span></dt><dd><dl><dt><span class="section"><a href="#boot-features-configfileapplicationcontextinitializer-test-utility">35.4.1. ConfigFileApplicationContextInitializer</a></span></dt><dt><span class="section"><a href="#boot-features-environment-test-utilities">35.4.2. EnvironmentTestUtils</a></span></dt><dt><span class="section"><a href="#boot-features-output-capture-test-utility">35.4.3. OutputCapture</a></span></dt><dt><span class="section"><a href="#boot-features-rest-templates-test-utility">35.4.4. TestRestTemplate</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#boot-features-developing-auto-configuration">36. Developing auto-configuration and using conditions</a></span></dt><dd><dl><dt><span class="section"><a href="#boot-features-understanding-auto-configured-beans">36.1. Understanding auto-configured beans</a></span></dt><dt><span class="section"><a href="#boot-features-locating-auto-configuration-candidates">36.2. Locating auto-configuration candidates</a></span></dt><dt><span class="section"><a href="#boot-features-condition-annotations">36.3. Condition annotations</a></span></dt><dd><dl><dt><span class="section"><a href="#boot-features-class-conditions">36.3.1. Class conditions</a></span></dt><dt><span class="section"><a href="#boot-features-bean-conditions">36.3.2. Bean conditions</a></span></dt><dt><span class="section"><a href="#boot-features-property-conditions">36.3.3. Property conditions</a></span></dt><dt><span class="section"><a href="#boot-features-resource-conditions">36.3.4. Resource conditions</a></span></dt><dt><span class="section"><a href="#boot-features-web-application-conditions">36.3.5. Web Application Conditions</a></span></dt><dt><span class="section"><a href="#boot-features-spel-conditions">36.3.6. SpEL expression conditions</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#boot-features-websockets">37. WebSockets</a></span></dt><dt><span class="chapter"><a href="#boot-features-whats-next">38. What to read next</a></span></dt></dl></dd><dt><span class="part"><a href="#production-ready">V. Spring Boot Actuator: Production-ready features</a></span></dt><dd><dl><dt><span class="chapter"><a href="#production-ready-enabling">39. Enabling production-ready features</a></span></dt><dt><span class="chapter"><a href="#production-ready-endpoints">40. Endpoints</a></span></dt><dd><dl><dt><span class="section"><a href="#production-ready-customizing-endpoints">40.1. Customizing endpoints</a></span></dt><dt><span class="section"><a href="#production-ready-health">40.2. Health information</a></span></dt><dt><span class="section"><a href="#_security_with_healthindicators">40.3. Security with HealthIndicators</a></span></dt><dd><dl><dt><span class="section"><a href="#_auto_configured_healthindicators">40.3.1. Auto-configured HealthIndicators</a></span></dt><dt><span class="section"><a href="#_writing_custom_healthindicators">40.3.2. Writing custom HealthIndicators</a></span></dt></dl></dd><dt><span class="section"><a href="#production-ready-application-info">40.4. Custom application info information</a></span></dt><dd><dl><dt><span class="section"><a href="#production-ready-application-info-automatic-expansion">40.4.1. Automatically expand info properties at build time</a></span></dt><dd><dl><dt><span class="section"><a href="#production-ready-application-info-automatic-expansion-maven">Automatic property expansion using Maven</a></span></dt><dt><span class="section"><a href="#production-ready-application-info-automatic-expansion-gradle">Automatic property expansion using Gradle</a></span></dt></dl></dd><dt><span class="section"><a href="#production-ready-git-commit-information">40.4.2. Git commit information</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#production-ready-monitoring">41. Monitoring and management over HTTP</a></span></dt><dd><dl><dt><span class="section"><a href="#production-ready-sensitive-endpoints">41.1. Securing sensitive endpoints</a></span></dt><dt><span class="section"><a href="#production-ready-customizing-management-server-context-path">41.2. Customizing the management server context path</a></span></dt><dt><span class="section"><a href="#production-ready-customizing-management-server-port">41.3. Customizing the management server port</a></span></dt><dt><span class="section"><a href="#production-ready-customizing-management-server-address">41.4. Customizing the management server address</a></span></dt><dt><span class="section"><a href="#production-ready-disabling-http-endpoints">41.5. Disabling HTTP endpoints</a></span></dt><dt><span class="section"><a href="#production-ready-health-access-restrictions">41.6. HTTP Health endpoint access restrictions</a></span></dt></dl></dd><dt><span class="chapter"><a href="#production-ready-jmx">42. Monitoring and management over JMX</a></span></dt><dd><dl><dt><span class="section"><a href="#production-ready-custom-mbean-names">42.1. Customizing MBean names</a></span></dt><dt><span class="section"><a href="#production-ready-disable-jmx-endpoints">42.2. Disabling JMX endpoints</a></span></dt><dt><span class="section"><a href="#production-ready-jolokia">42.3. Using Jolokia for JMX over HTTP</a></span></dt><dd><dl><dt><span class="section"><a href="#production-ready-customizing-jolokia">42.3.1. Customizing Jolokia</a></span></dt><dt><span class="section"><a href="#production-ready-disabling-jolokia">42.3.2. Disabling Jolokia</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#production-ready-remote-shell">43. Monitoring and management using a remote shell</a></span></dt><dd><dl><dt><span class="section"><a href="#production-ready-connecting-to-the-remote-shell">43.1. Connecting to the remote shell</a></span></dt><dd><dl><dt><span class="section"><a href="#production-ready-remote-shell-credentials">43.1.1. Remote shell credentials</a></span></dt></dl></dd><dt><span class="section"><a href="#production-ready-extending-the-remote-shell">43.2. Extending the remote shell</a></span></dt><dd><dl><dt><span class="section"><a href="#production-ready-remote-commands">43.2.1. Remote shell commands</a></span></dt><dt><span class="section"><a href="#production-ready-remote-shell-plugins">43.2.2. Remote shell plugins</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#production-ready-metrics">44. Metrics</a></span></dt><dd><dl><dt><span class="section"><a href="#production-ready-system-metrics">44.1. System metrics</a></span></dt><dt><span class="section"><a href="#production-ready-datasource-metrics">44.2. DataSource metrics</a></span></dt><dt><span class="section"><a href="#production-ready-session-metrics">44.3. Tomcat session metrics</a></span></dt><dt><span class="section"><a href="#production-ready-recording-metrics">44.4. Recording your own metrics</a></span></dt><dt><span class="section"><a href="#production-ready-public-metrics">44.5. Adding your own public metrics</a></span></dt><dt><span class="section"><a href="#production-ready-metric-repositories">44.6. Metric repositories</a></span></dt><dt><span class="section"><a href="#production-ready-code-hale-metrics">44.7. Dropwizard Metrics</a></span></dt><dt><span class="section"><a href="#production-ready-metrics-message-channel-integration">44.8. Message channel integration</a></span></dt></dl></dd><dt><span class="chapter"><a href="#production-ready-auditing">45. Auditing</a></span></dt><dt><span class="chapter"><a href="#production-ready-tracing">46. Tracing</a></span></dt><dd><dl><dt><span class="section"><a href="#production-ready-custom-tracing">46.1. Custom tracing</a></span></dt></dl></dd><dt><span class="chapter"><a href="#production-ready-process-monitoring">47. Process monitoring</a></span></dt><dd><dl><dt><span class="section"><a href="#production-ready-process-monitoring-configuration">47.1. Extend configuration</a></span></dt><dt><span class="section"><a href="#production-ready-process-monitoring-programmatically">47.2. Programmatically</a></span></dt></dl></dd><dt><span class="chapter"><a href="#production-ready-whats-next">48. What to read next</a></span></dt></dl></dd><dt><span class="part"><a href="#cloud-deployment">VI. Deploying to the cloud</a></span></dt><dd><dl><dt><span class="chapter"><a href="#cloud-deployment-cloud-foundry">49. Cloud Foundry</a></span></dt><dd><dl><dt><span class="section"><a href="#cloud-deployment-cloud-foundry-services">49.1. Binding to services</a></span></dt></dl></dd><dt><span class="chapter"><a href="#cloud-deployment-heroku">50. Heroku</a></span></dt><dt><span class="chapter"><a href="#cloud-deployment-openshift">51. Openshift</a></span></dt><dt><span class="chapter"><a href="#cloud-deployment-gae">52. Google App Engine</a></span></dt><dt><span class="chapter"><a href="#cloud-deployment-whats-next">53. What to read next</a></span></dt></dl></dd><dt><span class="part"><a href="#cli">VII. Spring Boot CLI</a></span></dt><dd><dl><dt><span class="chapter"><a href="#cli-installation">54. Installing the CLI</a></span></dt><dt><span class="chapter"><a href="#cli-using-the-cli">55. Using the CLI</a></span></dt><dd><dl><dt><span class="section"><a href="#cli-run">55.1. Running applications using the CLI</a></span></dt><dd><dl><dt><span class="section"><a href="#cli-deduced-grab-annotations">55.1.1. Deduced “grab” dependencies</a></span></dt><dt><span class="section"><a href="#cli-default-grab-deduced-coordinates">55.1.2. Deduced “grab” coordinates</a></span></dt><dt><span class="section"><a href="#cli-default-import-statements">55.1.3. Default import statements</a></span></dt><dt><span class="section"><a href="#cli-automatic-main-method">55.1.4. Automatic main method</a></span></dt><dt><span class="section"><a href="#cli-default-grab-deduced-coordinates-custom-metadata">55.1.5. Custom “grab” metadata</a></span></dt></dl></dd><dt><span class="section"><a href="#cli-testing">55.2. Testing your code</a></span></dt><dt><span class="section"><a href="#cli-multiple-source-files">55.3. Applications with multiple source files</a></span></dt><dt><span class="section"><a href="#cli-jar">55.4. Packaging your application</a></span></dt><dt><span class="section"><a href="#cli-init">55.5. Initialize a new project</a></span></dt><dt><span class="section"><a href="#cli-shell">55.6. Using the embedded shell</a></span></dt><dt><span class="section"><a href="#cli-install-uninstall">55.7. Adding extensions to the CLI</a></span></dt></dl></dd><dt><span class="chapter"><a href="#cli-groovy-beans-dsl">56. Developing application with the Groovy beans DSL</a></span></dt><dt><span class="chapter"><a href="#cli-whats-next">57. What to read next</a></span></dt></dl></dd><dt><span class="part"><a href="#build-tool-plugins">VIII. Build tool plugins</a></span></dt><dd><dl><dt><span class="chapter"><a href="#build-tool-plugins-maven-plugin">58. Spring Boot Maven plugin</a></span></dt><dd><dl><dt><span class="section"><a href="#build-tool-plugins-include-maven-plugin">58.1. Including the plugin</a></span></dt><dt><span class="section"><a href="#build-tool-plugins-maven-packaging">58.2. Packaging executable jar and war files</a></span></dt></dl></dd><dt><span class="chapter"><a href="#build-tool-plugins-gradle-plugin">59. Spring Boot Gradle plugin</a></span></dt><dd><dl><dt><span class="section"><a href="#build-tool-plugins-including-the-gradle-plugin">59.1. Including the plugin</a></span></dt><dt><span class="section"><a href="#build-tool-plugins-gradle-dependencies-without-versions">59.2. Declaring dependencies without versions</a></span></dt><dd><dl><dt><span class="section"><a href="#build-tool-plugins-gradle-custom-version-management">59.2.1. Custom version management</a></span></dt></dl></dd><dt><span class="section"><a href="#build-tool-plugins-gradle-exclude-rules">59.3. Default exclude rules</a></span></dt><dt><span class="section"><a href="#build-tool-plugins-gradle-packaging">59.4. Packaging executable jar and war files</a></span></dt><dt><span class="section"><a href="#build-tool-plugins-gradle-running-applications">59.5. Running a project in-place</a></span></dt><dt><span class="section"><a href="#build-tool-plugins-gradle-global-configuration">59.6. Spring Boot plugin configuration</a></span></dt><dt><span class="section"><a href="#build-tool-plugins-gradle-repackage-configuration">59.7. Repackage configuration</a></span></dt><dt><span class="section"><a href="#build-tool-plugins-gradle-repackage-custom-configuration">59.8. Repackage with custom Gradle configuration</a></span></dt><dd><dl><dt><span class="section"><a href="#build-tool-plugins-gradle-configuration-options">59.8.1. Configuration options</a></span></dt></dl></dd><dt><span class="section"><a href="#build-tool-plugins-understanding-the-gradle-plugin">59.9. Understanding how the Gradle plugin works</a></span></dt><dt><span class="section"><a href="#build-tool-plugins-gradle-publishing-artifacts-to-a-maven-repository">59.10. Publishing artifacts to a Maven repository using Gradle</a></span></dt><dd><dl><dt><span class="section"><a href="#build-tool-plugins-gradle-publishing-artifacts-to-a-maven-repository-inherit">59.10.1. Configuring Gradle to produce a pom that inherits dependency management</a></span></dt><dt><span class="section"><a href="#build-tool-plugins-gradle-publishing-artifacts-to-a-maven-repository-import">59.10.2. Configuring Gradle to produce a pom that imports dependency management</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#build-tool-plugins-other-build-systems">60. Supporting other build systems</a></span></dt><dd><dl><dt><span class="section"><a href="#build-tool-plugins-repackaging-archives">60.1. Repackaging archives</a></span></dt><dt><span class="section"><a href="#build-tool-plugins-nested-libraries">60.2. Nested libraries</a></span></dt><dt><span class="section"><a href="#build-tool-plugins-find-a-main-class">60.3. Finding a main class</a></span></dt><dt><span class="section"><a href="#build-tool-plugins-repackage-implementation">60.4. Example repackage implementation</a></span></dt></dl></dd><dt><span class="chapter"><a href="#build-tool-plugins-whats-next">61. What to read next</a></span></dt></dl></dd><dt><span class="part"><a href="#howto">IX. ‘How-to’ guides</a></span></dt><dd><dl><dt><span class="chapter"><a href="#howto-spring-boot-application">62. Spring Boot application</a></span></dt><dd><dl><dt><span class="section"><a href="#howto-troubleshoot-auto-configuration">62.1. Troubleshoot auto-configuration</a></span></dt><dt><span class="section"><a href="#howto-customize-the-environment-or-application-context">62.2. Customize the Environment or ApplicationContext before it starts</a></span></dt><dt><span class="section"><a href="#howto-build-an-application-context-hierarchy">62.3. Build an ApplicationContext hierarchy (adding a parent or root context)</a></span></dt><dt><span class="section"><a href="#howto-create-a-non-web-application">62.4. Create a non-web application</a></span></dt></dl></dd><dt><span class="chapter"><a href="#howto-properties-and-configuration">63. Properties & configuration</a></span></dt><dd><dl><dt><span class="section"><a href="#howto-externalize-configuration">63.1. Externalize the configuration of SpringApplication</a></span></dt><dt><span class="section"><a href="#howto-change-the-location-of-external-properties">63.2. Change the location of external properties of an application</a></span></dt><dt><span class="section"><a href="#howto-use-short-command-line-arguments">63.3. Use ‘short’ command line arguments</a></span></dt><dt><span class="section"><a href="#howto-use-yaml-for-external-properties">63.4. Use YAML for external properties</a></span></dt><dt><span class="section"><a href="#howto-set-active-spring-profiles">63.5. Set the active Spring profiles</a></span></dt><dt><span class="section"><a href="#howto-change-configuration-depending-on-the-environment">63.6. Change configuration depending on the environment</a></span></dt><dt><span class="section"><a href="#howto-discover-build-in-options-for-external-properties">63.7. Discover built-in options for external properties</a></span></dt></dl></dd><dt><span class="chapter"><a href="#howto-embedded-servlet-containers">64. Embedded servlet containers</a></span></dt><dd><dl><dt><span class="section"><a href="#howto-add-a-servlet-filter-or-servletcontextlistener">64.1. Add a Servlet, Filter or ServletContextListener to an application</a></span></dt><dt><span class="section"><a href="#howto-disable-registration-of-a-servlet-or-filter">64.2. Disable registration of a Servlet or Filter</a></span></dt><dt><span class="section"><a href="#howto-change-the-http-port">64.3. Change the HTTP port</a></span></dt><dt><span class="section"><a href="#howto-user-a-random-unassigned-http-port">64.4. Use a random unassigned HTTP port</a></span></dt><dt><span class="section"><a href="#howto-discover-the-http-port-at-runtime">64.5. Discover the HTTP port at runtime</a></span></dt><dt><span class="section"><a href="#howto-configure-ssl">64.6. Configure SSL</a></span></dt><dt><span class="section"><a href="#howto-configure-tomcat">64.7. Configure Tomcat</a></span></dt><dt><span class="section"><a href="#howto-enable-multiple-connectors-in-tomcat">64.8. Enable Multiple Connectors with Tomcat</a></span></dt><dt><span class="section"><a href="#howto-use-tomcat-behind-a-proxy-server">64.9. Use Tomcat behind a front-end proxy server</a></span></dt><dt><span class="section"><a href="#howto-use-jetty-instead-of-tomcat">64.10. Use Jetty instead of Tomcat</a></span></dt><dt><span class="section"><a href="#howto-configure-jetty">64.11. Configure Jetty</a></span></dt><dt><span class="section"><a href="#howto-use-undertow-instead-of-tomcat">64.12. Use Undertow instead of Tomcat</a></span></dt><dt><span class="section"><a href="#howto-configure-undertow">64.13. Configure Undertow</a></span></dt><dt><span class="section"><a href="#howto-enable-multiple-listeners-in-undertow">64.14. Enable Multiple Listeners with Undertow</a></span></dt><dt><span class="section"><a href="#howto-use-tomcat-7">64.15. Use Tomcat 7</a></span></dt><dd><dl><dt><span class="section"><a href="#_use_tomcat_7_with_maven">64.15.1. Use Tomcat 7 with Maven</a></span></dt><dt><span class="section"><a href="#_use_tomcat_7_with_gradle">64.15.2. Use Tomcat 7 with Gradle</a></span></dt></dl></dd><dt><span class="section"><a href="#howto-use-jetty-8">64.16. Use Jetty 8</a></span></dt><dd><dl><dt><span class="section"><a href="#howto-use-jetty-8-maven">64.16.1. Use Jetty 8 with Maven</a></span></dt><dt><span class="section"><a href="#howto-use-jetty-8-gradle">64.16.2. Use Jetty 8 with Gradle</a></span></dt></dl></dd><dt><span class="section"><a href="#howto-create-websocket-endpoints-using-serverendpoint">64.17. Create WebSocket endpoints using @ServerEndpoint</a></span></dt><dt><span class="section"><a href="#how-to-enable-http-response-compression">64.18. Enable HTTP response compression</a></span></dt><dd><dl><dt><span class="section"><a href="#how-to-enable-http-response-compression-tomcat">64.18.1. Enable Tomcat’s HTTP response compression</a></span></dt><dt><span class="section"><a href="#how-to-enable-http-compression-gzip-filter">64.18.2. Enable HTTP response compression using GzipFilter</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#howto-spring-mvc">65. Spring MVC</a></span></dt><dd><dl><dt><span class="section"><a href="#howto-write-a-json-rest-service">65.1. Write a JSON REST service</a></span></dt><dt><span class="section"><a href="#howto-write-an-xml-rest-service">65.2. Write an XML REST service</a></span></dt><dt><span class="section"><a href="#howto-customize-the-jackson-objectmapper">65.3. Customize the Jackson ObjectMapper</a></span></dt><dt><span class="section"><a href="#howto-customize-the-responsebody-rendering">65.4. Customize the @ResponseBody rendering</a></span></dt><dt><span class="section"><a href="#howto-multipart-file-upload-configuration">65.5. Handling Multipart File Uploads</a></span></dt><dt><span class="section"><a href="#howto-switch-off-the-spring-mvc-dispatcherservlet">65.6. Switch off the Spring MVC DispatcherServlet</a></span></dt><dt><span class="section"><a href="#howto-switch-off-default-mvc-configuration">65.7. Switch off the Default MVC configuration</a></span></dt><dt><span class="section"><a href="#howto-customize-view-resolvers">65.8. Customize ViewResolvers</a></span></dt></dl></dd><dt><span class="chapter"><a href="#howto-logging">66. Logging</a></span></dt><dd><dl><dt><span class="section"><a href="#howto-configure-logback-for-loggin">66.1. Configure Logback for logging</a></span></dt><dt><span class="section"><a href="#howto-configure-log4j-for-logging">66.2. Configure Log4j for logging</a></span></dt><dd><dl><dt><span class="section"><a href="#howto-configure-log4j-for-logging-yaml-or-json-config">66.2.1. Use YAML or JSON to configure Log4j 2</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#howto-data-access">67. Data Access</a></span></dt><dd><dl><dt><span class="section"><a href="#howto-configure-a-datasource">67.1. Configure a DataSource</a></span></dt><dt><span class="section"><a href="#howto-two-datasources">67.2. Configure Two DataSources</a></span></dt><dt><span class="section"><a href="#howto-use-spring-data-repositories">67.3. Use Spring Data repositories</a></span></dt><dt><span class="section"><a href="#howto-separate-entity-definitions-from-spring-configuration">67.4. Separate @Entity definitions from Spring configuration</a></span></dt><dt><span class="section"><a href="#howto-configure-jpa-properties">67.5. Configure JPA properties</a></span></dt><dt><span class="section"><a href="#howto-use-custom-entity-manager">67.6. Use a custom EntityManagerFactory</a></span></dt><dt><span class="section"><a href="#howto-use-two-entity-managers">67.7. Use Two EntityManagers</a></span></dt><dt><span class="section"><a href="#howto-use-traditional-persistence-xml">67.8. Use a traditional persistence.xml</a></span></dt><dt><span class="section"><a href="#howto-use-spring-data-jpa--and-mongo-repositories">67.9. Use Spring Data JPA and Mongo repositories</a></span></dt><dt><span class="section"><a href="#howto-use-exposing-spring-data-repositories-rest-endpoint">67.10. Expose Spring Data repositories as REST endpoint</a></span></dt></dl></dd><dt><span class="chapter"><a href="#howto-database-initialization">68. Database initialization</a></span></dt><dd><dl><dt><span class="section"><a href="#howto-initialize-a-database-using-jpa">68.1. Initialize a database using JPA</a></span></dt><dt><span class="section"><a href="#howto-initialize-a-database-using-hibernate">68.2. Initialize a database using Hibernate</a></span></dt><dt><span class="section"><a href="#howto-intialize-a-database-using-spring-jdbc">68.3. Initialize a database using Spring JDBC</a></span></dt><dt><span class="section"><a href="#howto-initialize-a-spring-batch-database">68.4. Initialize a Spring Batch database</a></span></dt><dt><span class="section"><a href="#howto-use-a-higher-level-database-migration-tool">68.5. Use a higher level database migration tool</a></span></dt><dd><dl><dt><span class="section"><a href="#howto-execute-flyway-database-migrations-on-startup">68.5.1. Execute Flyway database migrations on startup</a></span></dt><dt><span class="section"><a href="#howto-execute-liquibase-database-migrations-on-startup">68.5.2. Execute Liquibase database migrations on startup</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#howto-batch-applications">69. Batch applications</a></span></dt><dd><dl><dt><span class="section"><a href="#howto-execute-spring-batch-jobs-on-startup">69.1. Execute Spring Batch jobs on startup</a></span></dt></dl></dd><dt><span class="chapter"><a href="#howto-actuator">70. Actuator</a></span></dt><dd><dl><dt><span class="section"><a href="#howto-change-the-http-port-or-address-of-the-actuator-endpoints">70.1. Change the HTTP port or address of the actuator endpoints</a></span></dt><dt><span class="section"><a href="#howto-customize-the-whitelabel-error-page">70.2. Customize the ‘whitelabel’ error page</a></span></dt></dl></dd><dt><span class="chapter"><a href="#howto-security">71. Security</a></span></dt><dd><dl><dt><span class="section"><a href="#howto-switch-off-spring-boot-security-configuration">71.1. Switch off the Spring Boot security configuration</a></span></dt><dt><span class="section"><a href="#howto-change-the-authenticationmanager-and-add-user-accounts">71.2. Change the AuthenticationManager and add user accounts</a></span></dt><dt><span class="section"><a href="#howto-enable-https">71.3. Enable HTTPS when running behind a proxy server</a></span></dt></dl></dd><dt><span class="chapter"><a href="#howto-hotswapping">72. Hot swapping</a></span></dt><dd><dl><dt><span class="section"><a href="#howto-reload-static-content">72.1. Reload static content</a></span></dt><dt><span class="section"><a href="#howto-reload-thymeleaf-content">72.2. Reload Thymeleaf templates without restarting the container</a></span></dt><dt><span class="section"><a href="#howto-reload-freemarker-content">72.3. Reload FreeMarker templates without restarting the container</a></span></dt><dt><span class="section"><a href="#howto-reload-groovy-template-content">72.4. Reload Groovy templates without restarting the container</a></span></dt><dt><span class="section"><a href="#howto-reload-velocity-content">72.5. Reload Velocity templates without restarting the container</a></span></dt><dt><span class="section"><a href="#howto-reload-java-classes-without-restarting">72.6. Reload Java classes without restarting the container</a></span></dt><dd><dl><dt><span class="section"><a href="#howto-reload-springloaded-maven">72.6.1. Configuring Spring Loaded for use with Maven</a></span></dt><dt><span class="section"><a href="#howto-reload-springloaded-gradle-and-intellij">72.6.2. Configuring Spring Loaded for use with Gradle and IntelliJ</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#howto-build">73. Build</a></span></dt><dd><dl><dt><span class="section"><a href="#howto-customize-dependency-versions-with-maven">73.1. Customize dependency versions with Maven</a></span></dt><dt><span class="section"><a href="#howto-create-an-executable-jar-with-maven">73.2. Create an executable JAR with Maven</a></span></dt><dt><span class="section"><a href="#howto-create-an-additional-executable-jar">73.3. Create an additional executable JAR</a></span></dt><dt><span class="section"><a href="#howto-extract-specific-libraries-when-an-executable-jar-runs">73.4. Extract specific libraries when an executable jar runs</a></span></dt><dt><span class="section"><a href="#howto-create-a-nonexecutable-jar">73.5. Create a non-executable JAR with exclusions</a></span></dt><dt><span class="section"><a href="#howto-remote-debug-maven-run">73.6. Remote debug a Spring Boot application started with Maven</a></span></dt><dt><span class="section"><a href="#howto-remote-debug-gradle-run">73.7. Remote debug a Spring Boot application started with Gradle</a></span></dt><dt><span class="section"><a href="#howto-build-an-executable-archive-with-ant">73.8. Build an executable archive with Ant</a></span></dt><dt><span class="section"><a href="#howto-use-java-6">73.9. How to use Java 6</a></span></dt><dd><dl><dt><span class="section"><a href="#howto-use-java-6-embedded-container">73.9.1. Embedded servlet container compatibility</a></span></dt><dt><span class="section"><a href="#how-to-use-java-6-jta-api">73.9.2. JTA API compatibility</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#howto-traditional-deployment">74. Traditional deployment</a></span></dt><dd><dl><dt><span class="section"><a href="#howto-create-a-deployable-war-file">74.1. Create a deployable war file</a></span></dt><dt><span class="section"><a href="#howto-create-a-deployable-war-file-for-older-containers">74.2. Create a deployable war file for older servlet containers</a></span></dt><dt><span class="section"><a href="#howto-convert-an-existing-application-to-spring-boot">74.3. Convert an existing application to Spring Boot</a></span></dt><dt><span class="section"><a href="#howto-weblogic">74.4. Deploying a WAR to Weblogic</a></span></dt><dt><span class="section"><a href="#howto-servlet-2-5">74.5. Deploying a WAR in an Old (Servlet 2.5) Container</a></span></dt></dl></dd></dl></dd><dt><span class="part"><a href="#appendix">X. Appendices</a></span></dt><dd><dl><dt><span class="appendix"><a href="#common-application-properties">A. Common application properties</a></span></dt><dt><span class="appendix"><a href="#configuration-metadata">B. Configuration meta-data</a></span></dt><dd><dl><dt><span class="section"><a href="#configuration-metadata-format">B.1. Meta-data format</a></span></dt><dd><dl><dt><span class="section"><a href="#configuration-metadata-group-attributes">B.1.1. Group Attributes</a></span></dt><dt><span class="section"><a href="#configuration-metadata-property-attributes">B.1.2. Property Attributes</a></span></dt><dt><span class="section"><a href="#configuration-metadata-repeated-items">B.1.3. Repeated meta-data items</a></span></dt></dl></dd><dt><span class="section"><a href="#configuration-metadata-annotation-processor">B.2. Generating your own meta-data using the annotation processor</a></span></dt><dd><dl><dt><span class="section"><a href="#configuration-metadata-nested-properties">B.2.1. Nested properties</a></span></dt><dt><span class="section"><a href="#configuration-metadata-additional-metadata">B.2.2. Adding additional meta-data</a></span></dt></dl></dd></dl></dd><dt><span class="appendix"><a href="#auto-configuration-classes">C. Auto-configuration classes</a></span></dt><dd><dl><dt><span class="section"><a href="#auto-configuration-classes-from-autoconfigure-module">C.1. From the “spring-boot-autoconfigure” module</a></span></dt><dt><span class="section"><a href="#auto-configuration-classes-from-actuator">C.2. From the “spring-boot-actuator” module</a></span></dt></dl></dd><dt><span class="appendix"><a href="#executable-jar">D. The executable jar format</a></span></dt><dd><dl><dt><span class="section"><a href="#executable-jar-nested-jars">D.1. Nested JARs</a></span></dt><dd><dl><dt><span class="section"><a href="#executable-jar-jar-file-structure">D.1.1. The executable jar file structure</a></span></dt><dt><span class="section"><a href="#executable-jar-war-file-structure">D.1.2. The executable war file structure</a></span></dt></dl></dd><dt><span class="section"><a href="#executable-jar-jarfile">D.2. Spring Boot’s “JarFile” class</a></span></dt><dd><dl><dt><span class="section"><a href="#executable-jar-jarfile-compatibility">D.2.1. Compatibility with the standard Java “JarFile”</a></span></dt></dl></dd><dt><span class="section"><a href="#executable-jar-launching">D.3. Launching executable jars</a></span></dt><dd><dl><dt><span class="section"><a href="#executable-jar-launcher-manifest">D.3.1. Launcher manifest</a></span></dt><dt><span class="section"><a href="#executable-jar-exploded-archives">D.3.2. Exploded archives</a></span></dt></dl></dd><dt><span class="section"><a href="#executable-jar-property-launcher-features">D.4. PropertiesLauncher Features</a></span></dt><dt><span class="section"><a href="#executable-jar-restrictions">D.5. Executable jar restrictions</a></span></dt><dd><dl><dt><span class="section"><a href="#executable-jar-zip-entry-compression">D.5.1. Zip entry compression</a></span></dt><dt><span class="section"><a href="#executable-jar-system-classloader">D.5.2. System ClassLoader</a></span></dt></dl></dd><dt><span class="section"><a href="#executable-jar-alternatives">D.6. Alternative single jar solutions</a></span></dt></dl></dd><dt><span class="appendix"><a href="#appendix-dependency-versions">E. Dependency versions</a></span></dt></dl></dd></dl></div><div class="part"><div class="titlepage"><div><div><h1 class="title"><a name="boot-documentation" href="#boot-documentation"></a>Part I. Spring Boot Documentation</h1></div></div></div><div class="partintro"><div></div><p>This section provides a brief overview of Spring Boot reference documentation. Think of it as map for the rest of the document. You can read this reference guide in a linear fashion, or you can skip sections if something doesn’t interest you.</p></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="boot-documentation-about" href="#boot-documentation-about"></a>1. About the documentation</h2></div></div></div><p>The Spring Boot reference guide is available as <a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/reference/html" target="_top">html</a>, <a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/reference/pdf/spring-boot-reference.pdf" target="_top">pdf</a> and <a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/reference/epub/spring-boot-reference.epub" target="_top">epub</a> documents. The latest copy is available at <a class="link" href="http://docs.spring.io/spring-boot/docs/current/reference" target="_top">docs.spring.io/spring-boot/docs/current/reference</a>.</p><p>Copies of this document may be made for your own use and for distribution to others, provided that you do not charge any fee for such copies and further provided that each copy contains this Copyright Notice, whether distributed in print or electronically.</p></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="boot-documentation-getting-help" href="#boot-documentation-getting-help"></a>2. Getting help</h2></div></div></div><p>Having trouble with Spring Boot, We’d like to help!</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Try the <a class="link" href="#howto" title="Part IX. ‘How-to’ guides">How-to’s</a> — they provide solutions to the most common questions.</li><li class="listitem">Learn the Spring basics — Spring Boot builds on many other Spring projects, check the <a class="link" href="http://spring.io/" target="_top">spring.io</a> web-site for a wealth of reference documentation. If you are just starting out with Spring, try one of the <a class="link" href="http://spring.io/guides" target="_top">guides</a>.</li><li class="listitem">Ask a question - we monitor <a class="link" href="http://stackoverflow.com/" target="_top">stackoverflow.com</a> for questions tagged with <a class="link" href="http://stackoverflow.com/tags/spring-boot" target="_top"><code class="literal">spring-boot</code></a>.</li><li class="listitem">Report bugs with Spring Boot at <a class="link" href="https://github.com/spring-projects/spring-boot/issues" target="_top">github.com/spring-projects/spring-boot/issues</a>.</li></ul></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>All of Spring Boot is open source, including the documentation! If you find problems with the docs; or if you just want to improve them, please <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE" target="_top">get involved</a>.</p></td></tr></tbody></table></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="boot-documentation-first-steps" href="#boot-documentation-first-steps"></a>3. First steps</h2></div></div></div><p>If you’re just getting started with Spring Boot, or 'Spring' in general, <a class="link" href="#getting-started" title="Part II. Getting started">this is the place to start!</a></p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="strong"><strong>From scratch:</strong></span> <a class="link" href="#getting-started-introducing-spring-boot" title="8. Introducing Spring Boot">Overview</a> | <a class="link" href="#getting-started-system-requirements" title="9. System Requirements">Requirements</a> | <a class="link" href="#getting-started-installing-spring-boot" title="10. Installing Spring Boot">Installation</a></li><li class="listitem"><span class="strong"><strong>Tutorial:</strong></span> <a class="link" href="#getting-started-first-application" title="11. Developing your first Spring Boot application">Part 1</a> | <a class="link" href="#getting-started-first-application-code" title="11.3 Writing the code">Part 2</a></li><li class="listitem"><span class="strong"><strong>Running your example:</strong></span> <a class="link" href="#getting-started-first-application-run" title="11.4 Running the example">Part 1</a> | <a class="link" href="#getting-started-first-application-executable-jar" title="11.5 Creating an executable jar">Part 2</a></li></ul></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="_working_with_spring_boot" href="#_working_with_spring_boot"></a>4. Working with Spring Boot</h2></div></div></div><p>Ready to actually start using Spring Boot? <a class="link" href="#using-boot" title="Part III. Using Spring Boot">We’ve got you covered</a>.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="strong"><strong>Build systems:</strong></span> <a class="link" href="#using-boot-maven" title="13.1 Maven">Maven</a> | <a class="link" href="#using-boot-gradle" title="13.2 Gradle">Gradle</a> | <a class="link" href="#using-boot-ant" title="13.3 Ant">Ant</a> | <a class="link" href="#using-boot-starter-poms" title="13.4 Starter POMs">Starter POMs</a></li><li class="listitem"><span class="strong"><strong>Best practices:</strong></span> <a class="link" href="#using-boot-structuring-your-code" title="14. Structuring your code">Code Structure</a> | <a class="link" href="#using-boot-configuration-classes" title="15. Configuration classes">@Configuration</a> | <a class="link" href="#using-boot-auto-configuration" title="16. Auto-configuration">@EnableAutoConfiguration</a> | <a class="link" href="#using-boot-spring-beans-and-dependency-injection" title="17. Spring Beans and dependency injection">Beans and Dependency Injection</a></li><li class="listitem"><span class="strong"><strong>Running your code</strong></span> <a class="link" href="#using-boot-running-from-an-ide" title="19.1 Running from an IDE">IDE</a> | <a class="link" href="#using-boot-running-as-a-packaged-application" title="19.2 Running as a packaged application">Packaged</a> | <a class="link" href="#using-boot-running-with-the-maven-plugin" title="19.3 Using the Maven plugin">Maven</a> | <a class="link" href="#using-boot-running-with-the-gradle-plugin" title="19.4 Using the Gradle plugin">Gradle</a></li><li class="listitem"><span class="strong"><strong>Packaging your app:</strong></span> <a class="link" href="#using-boot-packaging-for-production" title="20. Packaging your application for production">Production jars</a></li><li class="listitem"><span class="strong"><strong>Spring Boot CLI:</strong></span> <a class="link" href="#cli" title="Part VII. Spring Boot CLI">Using the CLI</a></li></ul></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="_learning_about_spring_boot_features" href="#_learning_about_spring_boot_features"></a>5. Learning about Spring Boot features</h2></div></div></div><p>Need more details about Spring Boot’s core features? <a class="link" href="#boot-features" title="Part IV. Spring Boot features">This is for you</a>!</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="strong"><strong>Core Features:</strong></span> <a class="link" href="#boot-features-spring-application" title="22. SpringApplication">SpringApplication</a> | <a class="link" href="#boot-features-external-config" title="23. Externalized Configuration">External Configuration</a> | <a class="link" href="#boot-features-profiles" title="24. Profiles">Profiles</a> | <a class="link" href="#boot-features-logging" title="25. Logging">Logging</a></li><li class="listitem"><span class="strong"><strong>Web Applications:</strong></span> <a class="link" href="#boot-features-spring-mvc" title="26.1 The ‘Spring Web MVC framework’">MVC</a> | <a class="link" href="#boot-features-embedded-container" title="26.3 Embedded servlet container support">Embedded Containers</a></li><li class="listitem"><span class="strong"><strong>Working with data:</strong></span> <a class="link" href="#boot-features-sql" title="28. Working with SQL databases">SQL</a> | <a class="link" href="#boot-features-nosql" title="29. Working with NoSQL technologies">NO-SQL</a></li><li class="listitem"><span class="strong"><strong>Messaging:</strong></span> <a class="link" href="#boot-features-messaging" title="30. Messaging">Overview</a> | <a class="link" href="#boot-features-jms" title="30.1 JMS">JMS</a></li><li class="listitem"><span class="strong"><strong>Testing:</strong></span> <a class="link" href="#boot-features-testing" title="35. Testing">Overview</a> | <a class="link" href="#boot-features-testing-spring-boot-applications" title="35.3 Testing Spring Boot applications">Boot Applications</a> | <a class="link" href="#boot-features-test-utilities" title="35.4 Test utilities">Utils</a></li><li class="listitem"><span class="strong"><strong>Extending:</strong></span> <a class="link" href="#boot-features-developing-auto-configuration" title="36. Developing auto-configuration and using conditions">Auto-configuration</a> | <a class="link" href="#boot-features-condition-annotations" title="36.3 Condition annotations">@Conditions</a></li></ul></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="_moving_to_production" href="#_moving_to_production"></a>6. Moving to production</h2></div></div></div><p>When you’re ready to push your Spring Boot application to production, we’ve got <a class="link" href="#production-ready" title="Part V. Spring Boot Actuator: Production-ready features">some tricks that you might like</a>!</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="strong"><strong>Management endpoints:</strong></span> <a class="link" href="#production-ready-endpoints" title="40. Endpoints">Overview</a> | <a class="link" href="#production-ready-customizing-endpoints" title="40.1 Customizing endpoints">Customization</a></li><li class="listitem"><span class="strong"><strong>Connection options:</strong></span> <a class="link" href="#production-ready-monitoring" title="41. Monitoring and management over HTTP">HTTP</a> | <a class="link" href="#production-ready-jmx" title="42. Monitoring and management over JMX">JMX</a> | <a class="link" href="#production-ready-remote-shell" title="43. Monitoring and management using a remote shell">SSH</a></li><li class="listitem"><span class="strong"><strong>Monitoring:</strong></span> <a class="link" href="#production-ready-metrics" title="44. Metrics">Metrics</a> | <a class="link" href="#production-ready-auditing" title="45. Auditing">Auditing</a> | <a class="link" href="#production-ready-tracing" title="46. Tracing">Tracing</a> | <a class="link" href="#production-ready-process-monitoring" title="47. Process monitoring">Process</a></li></ul></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="_advanced_topics" href="#_advanced_topics"></a>7. Advanced topics</h2></div></div></div><p>Lastly, we have a few topics for the more advanced user.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="strong"><strong>Deploy to the cloud:</strong></span> <a class="link" href="#cloud-deployment-cloud-foundry" title="49. Cloud Foundry">Cloud Foundry</a> | <a class="link" href="#cloud-deployment-heroku" title="50. Heroku">Heroku</a> | <a class="link" href="#">CloudBees</a></li><li class="listitem"><span class="strong"><strong>Build tool plugins:</strong></span> <a class="link" href="#build-tool-plugins-maven-plugin" title="58. Spring Boot Maven plugin">Maven</a> | <a class="link" href="#build-tool-plugins-gradle-plugin" title="59. Spring Boot Gradle plugin">Gradle</a></li><li class="listitem"><span class="strong"><strong>Appendix:</strong></span> <a class="link" href="#common-application-properties" title="Appendix A. Common application properties">Application Properties</a> | <a class="link" href="#auto-configuration-classes" title="Appendix C. Auto-configuration classes">Auto-configuration classes</a> | <a class="link" href="#executable-jar" title="Appendix D. The executable jar format">Executable Jars</a></li></ul></div></div></div><div class="part"><div class="titlepage"><div><div><h1 class="title"><a name="getting-started" href="#getting-started"></a>Part II. Getting started</h1></div></div></div><div class="partintro"><div></div><p>If you’re just getting started with Spring Boot, or 'Spring' in general, this is the section for you! Here we answer the basic '“what?”', '“how?”' and '“why?”' questions. You’ll find a gentle introduction to Spring Boot along with installation instructions. We’ll then build our first Spring Boot application, discussing some core principles as we go.</p></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="getting-started-introducing-spring-boot" href="#getting-started-introducing-spring-boot"></a>8. Introducing Spring Boot</h2></div></div></div><p>Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that you can “just run”. We take an opinionated view of the Spring platform and third-party libraries so you can get started with minimum fuss. Most Spring Boot applications need very little Spring configuration.</p><p>You can use Spring Boot to create Java applications that can be started using <code class="literal">java -jar</code> or more traditional war deployments. We also provide a command line tool that runs “spring scripts”.</p><p>Our primary goals are:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Provide a radically faster and widely accessible getting started experience for all Spring development.</li><li class="listitem">Be opinionated out of the box, but get out of the way quickly as requirements start to diverge from the defaults.</li><li class="listitem">Provide a range of non-functional features that are common to large classes of projects (e.g. embedded servers, security, metrics, health checks, externalized configuration).</li><li class="listitem">Absolutely no code generation and no requirement for XML configuration.</li></ul></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="getting-started-system-requirements" href="#getting-started-system-requirements"></a>9. System Requirements</h2></div></div></div><p>By default, Spring Boot 1.2.2.RELEASE requires <a class="link" href="http://www.java.com/" target="_top">Java 7</a> and Spring Framework 4.1.3 or above. You can use Spring Boot with Java 6 with some additional configuration. See <a class="xref" href="#howto-use-java-6" title="73.9 How to use Java 6">Section 73.9, “How to use Java 6”</a> for more details. Explicit build support is provided for Maven (3.2+) and Gradle (1.12+).</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>Although you can use Spring Boot with Java 6 or 7, we generally recommend Java 8 if at all possible.</p></td></tr></tbody></table></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_servlet_containers" href="#_servlet_containers"></a>9.1 Servlet containers</h2></div></div></div><p>The following embedded servlet containers are supported out of the box:</p><div class="informaltable"><table style="border-collapse: collapse;border-top: 0.5pt solid ; border-bottom: 0.5pt solid ; border-left: 0.5pt solid ; border-right: 0.5pt solid ; "><colgroup><col class="col_1"><col class="col_2"><col class="col_3"></colgroup><thead><tr><th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top">Name</th><th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top">Servlet Version</th><th style="border-bottom: 0.5pt solid ; " align="left" valign="top">Java Version</th></tr></thead><tbody><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Tomcat 8</p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>3.1</p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Java 7+</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Tomcat 7</p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>3.0</p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Java 6+</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Jetty 9</p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>3.1</p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Java 7+</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Jetty 8</p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>3.0</p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Java 6+</p></td></tr><tr><td style="border-right: 0.5pt solid ; " align="left" valign="top"><p>Undertow 1.1</p></td><td style="border-right: 0.5pt solid ; " align="left" valign="top"><p>3.1</p></td><td style="" align="left" valign="top"><p>Java 7+</p></td></tr></tbody></table></div><p>You can also deploy Spring Boot applications to any Servlet 3.0+ compatible container.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="getting-started-installing-spring-boot" href="#getting-started-installing-spring-boot"></a>10. Installing Spring Boot</h2></div></div></div><p>Spring Boot can be used with “classic” Java development tools or installed as a command line tool. Regardless, you will need <a class="link" href="http://www.java.com/" target="_top">Java SDK v1.6</a> or higher. You should check your current Java installation before you begin:</p><pre class="screen">$ java -version</pre><p>If you are new to Java development, or if you just want to experiment with Spring Boot you might want to try the <a class="link" href="#getting-started-installing-the-cli" title="10.2 Installing the Spring Boot CLI">Spring Boot CLI</a> first, otherwise, read on for “classic” installation instructions.</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>Although Spring Boot is compatible with Java 1.6, if possible, you should consider using the latest version of Java.</p></td></tr></tbody></table></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="getting-started-installation-instructions-for-java" href="#getting-started-installation-instructions-for-java"></a>10.1 Installation instructions for the Java developer</h2></div></div></div><p>You can use Spring Boot in the same way as any standard Java library. Simply include the appropriate <code class="literal">spring-boot-*.jar</code> files on your classpath. Spring Boot does not require any special tools integration, so you can use any IDE or text editor; and there is nothing special about a Spring Boot application, so you can run and debug as you would any other Java program.</p><p>Although you <span class="emphasis"><em>could</em></span> just copy Spring Boot jars, we generally recommend that you use a build tool that supports dependency management (such as Maven or Gradle).</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="getting-started-maven-installation" href="#getting-started-maven-installation"></a>10.1.1 Maven installation</h3></div></div></div><p>Spring Boot is compatible with Apache Maven 3.2 or above. If you don’t already have Maven installed you can follow the instructions at <a class="link" href="http://maven.apache.org/" target="_top">maven.apache.org</a>.</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>On many operating systems Maven can be installed via a package manager. If you’re an OSX Homebrew user try <code class="literal">brew install maven</code>. Ubuntu users can run <code class="literal">sudo apt-get install maven</code>.</p></td></tr></tbody></table></div><p>Spring Boot dependencies use the <code class="literal">org.springframework.boot</code> <code class="literal">groupId</code>. Typically your Maven POM file will inherit from the <code class="literal">spring-boot-starter-parent</code> project and declare dependencies to one or more <a class="link" href="#using-boot-starter-poms" title="13.4 Starter POMs">“Starter POMs”</a>. Spring Boot also provides an optional <a class="link" href="#build-tool-plugins-maven-plugin" title="58. Spring Boot Maven plugin">Maven plugin</a> to create executable jars.</p><p>Here is a typical <code class="literal">pom.xml</code> file:</p><pre class="programlisting"><span class="hl-directive" style="color: maroon"><?xml version="1.0" encoding="UTF-8"?></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><project</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">xmlns</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"http://maven.apache.org/POM/4.0.0"</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">xmlns:xsi</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"http://www.w3.org/2001/XMLSchema-instance"</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">xsi:schemaLocation</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><modelVersion></span>4.0.0<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></modelVersion></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>com.example<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>myproject<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><version></span>0.0.1-SNAPSHOT<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></version></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"><!-- Inherit defaults from Spring Boot --></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><parent></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.boot<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-boot-starter-parent<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><version></span>1.2.2.RELEASE<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></version></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></parent></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"><!-- Add typical dependencies for a web application --></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependencies></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.boot<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-boot-starter-web<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependencies></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"><!-- Package as an executable jar --></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><build></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><plugins></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><plugin></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.boot<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-boot-maven-plugin<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></plugin></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></plugins></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></build></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></project></span></pre><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>The <code class="literal">spring-boot-starter-parent</code> is a great way to use Spring Boot, but it might not be suitable all of the time. Sometimes you may need to inherit from a different parent POM, or you might just not like our default settings. See <a class="xref" href="#using-boot-maven-without-a-parent" title="13.1.2 Using Spring Boot without the parent POM">Section 13.1.2, “Using Spring Boot without the parent POM”</a> for an alternative solution that uses an <code class="literal">import</code> scope.</p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="getting-started-gradle-installation" href="#getting-started-gradle-installation"></a>10.1.2 Gradle installation</h3></div></div></div><p>Spring Boot is compatible with Gradle 1.12 or above. If you don’t already have Gradle installed you can follow the instructions at <a class="link" href="http://www.gradle.org/" target="_top">www.gradle.org/</a>.</p><p>Spring Boot dependencies can be declared using the <code class="literal">org.springframework.boot</code> <code class="literal">group</code>. Typically your project will declare dependencies to one or more <a class="link" href="#using-boot-starter-poms" title="13.4 Starter POMs">“Starter POMs”</a>. Spring Boot provides a useful <a class="link" href="#build-tool-plugins-gradle-plugin" title="59. Spring Boot Gradle plugin">Gradle plugin</a> that can be used to simplify dependency declarations and to create executable jars.</p><div class="sidebar"><div class="titlepage"><div><div><p class="title"><b>Gradle Wrapper</b></p></div></div></div><p>The Gradle Wrapper provides a nice way of “obtaining” Gradle when you need to build a project. It’s a small script and library that you commit alongside your code to bootstrap the build process. See <a class="link" href="http://www.gradle.org/docs/current/userguide/gradle_wrapper.html" target="_top">www.gradle.org/docs/current/userguide/gradle_wrapper.html</a> for details.</p></div><p>Here is a typical <code class="literal">build.gradle</code> file:</p><pre class="programlisting">buildscript { repositories { jcenter() maven { url <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"http://repo.spring.io/snapshot"</span> } maven { url <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"http://repo.spring.io/milestone"</span> } } dependencies { classpath(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"org.springframework.boot:spring-boot-gradle-plugin:1.2.2.RELEASE"</span>) } } apply plugin: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'java'</span> apply plugin: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'spring-boot'</span> jar { baseName = <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'myproject'</span> version = <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'0.0.1-SNAPSHOT'</span> } repositories { jcenter() maven { url <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"http://repo.spring.io/snapshot"</span> } maven { url <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"http://repo.spring.io/milestone"</span> } } dependencies { compile(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"org.springframework.boot:spring-boot-starter-web"</span>) testCompile(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"org.springframework.boot:spring-boot-starter-test"</span>) }</pre></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="getting-started-installing-the-cli" href="#getting-started-installing-the-cli"></a>10.2 Installing the Spring Boot CLI</h2></div></div></div><p>The Spring Boot CLI is a command line tool that can be used if you want to quickly prototype with Spring. It allows you to run <a class="link" href="http://groovy.codehaus.org/" target="_top">Groovy</a> scripts, which means that you have a familiar Java-like syntax, without so much boilerplate code.</p><p>You don’t need to use the CLI to work with Spring Boot but it’s definitely the quickest way to get a Spring application off the ground.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="getting-started-manual-cli-installation" href="#getting-started-manual-cli-installation"></a>10.2.1 Manual installation</h3></div></div></div><p>You can download the Spring CLI distribution from the Spring software repository:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="link" href="http://repo.spring.io/release/org/springframework/boot/spring-boot-cli/1.2.2.RELEASE/spring-boot-cli-1.2.2.RELEASE-bin.zip" target="_top">spring-boot-cli-1.2.2.RELEASE-bin.zip</a></li><li class="listitem"><a class="link" href="http://repo.spring.io/release/org/springframework/boot/spring-boot-cli/1.2.2.RELEASE/spring-boot-cli-1.2.2.RELEASE-bin.tar.gz" target="_top">spring-boot-cli-1.2.2.RELEASE-bin.tar.gz</a></li></ul></div><p>Cutting edge <a class="link" href="http://repo.spring.io/snapshot/org/springframework/boot/spring-boot-cli/" target="_top">snapshot distributions</a> are also available.</p><p>Once downloaded, follow the <a class="link" href="http://raw.github.com/spring-projects/spring-boot/v1.2.2.RELEASE/spring-boot-cli/src/main/content/INSTALL.txt" target="_top">INSTALL.txt</a> instructions from the unpacked archive. In summary: there is a <code class="literal">spring</code> script (<code class="literal">spring.bat</code> for Windows) in a <code class="literal">bin/</code> directory in the <code class="literal">.zip</code> file, or alternatively you can use <code class="literal">java -jar</code> with the <code class="literal">.jar</code> file (the script helps you to be sure that the classpath is set correctly).</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="getting-started-gvm-cli-installation" href="#getting-started-gvm-cli-installation"></a>10.2.2 Installation with GVM</h3></div></div></div><p>GVM (the Groovy Environment Manager) can be used for managing multiple versions of various Groovy and Java binary packages, including Groovy itself and the Spring Boot CLI. Get <code class="literal">gvm</code> from <a class="link" href="http://gvmtool.net/" target="_top">gvmtool.net</a> and install Spring Boot with</p><pre class="screen">$ gvm install springboot $ spring --version Spring Boot v1.2.2.RELEASE</pre><p>If you are developing features for the CLI and want easy access to the version you just built, follow these extra instructions.</p><pre class="screen">$ gvm install springboot dev /path/to/spring-boot/spring-boot-cli/target/spring-boot-cli-1.2.2.RELEASE-bin/spring-1.2.2.RELEASE/ $ gvm use springboot dev $ spring --version Spring CLI v1.2.2.RELEASE</pre><p>This will install a local instance of <code class="literal">spring</code> called the <code class="literal">dev</code> instance inside your gvm repository. It points at your target build location, so every time you rebuild Spring Boot, <code class="literal">spring</code> will be up-to-date.</p><p>You can see it by doing this:</p><pre class="screen">$ gvm ls springboot ================================================================================ Available Springboot Versions ================================================================================ > + dev * 1.2.2.RELEASE ================================================================================ + - local version * - installed > - currently in use ================================================================================</pre></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="getting-started-homebrew-cli-installation" href="#getting-started-homebrew-cli-installation"></a>10.2.3 OSX Homebrew installation</h3></div></div></div><p>If you are on a Mac and using <a class="link" href="http://brew.sh/" target="_top">Homebrew</a>, all you need to do to install the Spring Boot CLI is:</p><pre class="screen">$ brew tap pivotal/tap $ brew install springboot</pre><p>Homebrew will install <code class="literal">spring</code> to <code class="literal">/usr/local/bin</code>.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>If you don’t see the formula, your installation of brew might be out-of-date. Just execute <code class="literal">brew update</code> and try again.</p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="getting-started-macports-cli-installation" href="#getting-started-macports-cli-installation"></a>10.2.4 MacPorts installation</h3></div></div></div><p>If you are on a Mac and using <a class="link" href="http://www.macports.org/" target="_top">MacPorts</a>, all you need to do to install the Spring Boot CLI is:</p><pre class="screen">$ sudo port install spring-boot-cli</pre></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="getting-started-cli-command-line-completion" href="#getting-started-cli-command-line-completion"></a>10.2.5 Command-line completion</h3></div></div></div><p>Spring Boot CLI ships with scripts that provide command completion for <a class="link" href="http://en.wikipedia.org/wiki/Bash_%28Unix_shell%29" target="_top">BASH</a> and <a class="link" href="http://en.wikipedia.org/wiki/Zsh" target="_top">zsh</a> shells. You can <code class="literal">source</code> the script (also named <code class="literal">spring</code>) in any shell, or put it in your personal or system-wide bash completion initialization. On a Debian system the system-wide scripts are in <code class="literal">/shell-completion/bash</code> and all scripts in that directory are executed when a new shell starts. To run the script manually, e.g. if you have installed using <code class="literal">GVM</code></p><pre class="screen">$ . ~/.gvm/springboot/current/shell-completion/bash/spring $ spring <HIT TAB HERE> grab help jar run test version</pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>If you install Spring Boot CLI using Homebrew or MacPorts, the command-line completion scripts are automatically registered with your shell.</p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="getting-started-cli-example" href="#getting-started-cli-example"></a>10.2.6 Quick start Spring CLI example</h3></div></div></div><p>Here’s a really simple web application that you can use to test your installation. Create a file called <code class="literal">app.groovy</code>:</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@RestController</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> ThisWillActuallyRun { <em><span class="hl-annotation" style="color: gray">@RequestMapping("/")</span></em> String home() { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"Hello World!"</span> } }</pre><p>Then simply run it from a shell:</p><pre class="screen">$ spring run app.groovy</pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>It will take some time when you first run the application as dependencies are downloaded. Subsequent runs will be much quicker.</p></td></tr></tbody></table></div><p>Open <a class="link" href="http://localhost:8080/" target="_top">localhost:8080</a> in your favorite web browser and you should see the following output:</p><pre class="screen">Hello World!</pre></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="getting-started-upgrading-from-an-earlier-version" href="#getting-started-upgrading-from-an-earlier-version"></a>10.3 Upgrading from an earlier version of Spring Boot</h2></div></div></div><p>If you are upgrading from an earlier release of Spring Boot check the “release notes” hosted on the <a class="link" href="http://github.com/spring-projects/spring-boot/wiki" target="_top">project wiki</a>. You’ll find upgrade instructions along with a list of “new and noteworthy” features for each release.</p><p>To upgrade an existing CLI installation use the appropriate package manager command (for example <code class="literal">brew upgrade</code>) or, if you manually installed the CLI, follow the <a class="link" href="#getting-started-manual-cli-installation" title="10.2.1 Manual installation">standard instructions</a> remembering to update your <code class="literal">PATH</code> environment variable to remove any older references.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="getting-started-first-application" href="#getting-started-first-application"></a>11. Developing your first Spring Boot application</h2></div></div></div><p>Let’s develop a simple “Hello World!” web application in Java that highlights some of Spring Boot’s key features. We’ll use Maven to build this project since most IDEs support it.</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>The <a class="link" href="http://spring.io/" target="_top">spring.io</a> web site contains many “Getting Started” guides that use Spring Boot. If you’re looking to solve a specific problem; check there first.</p></td></tr></tbody></table></div><p>Before we begin, open a terminal to check that you have valid versions of Java and Maven installed.</p><pre class="screen">$ java -version java version "1.7.0_51" Java(TM) SE Runtime Environment (build 1.7.0_51-b13) Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)</pre><pre class="screen">$ mvn -v Apache Maven 3.2.3 (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4; 2014-08-11T13:58:10-07:00) Maven home: /Users/user/tools/apache-maven-3.1.1 Java version: 1.7.0_51, vendor: Oracle Corporation</pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>This sample needs to be created in its own folder. Subsequent instructions assume that you have created a suitable folder and that it is your “current directory”.</p></td></tr></tbody></table></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="getting-started-first-application-pom" href="#getting-started-first-application-pom"></a>11.1 Creating the POM</h2></div></div></div><p>We need to start by creating a Maven <code class="literal">pom.xml</code> file. The <code class="literal">pom.xml</code> is the recipe that will be used to build your project. Open your favorite text editor and add the following:</p><pre class="programlisting"><span class="hl-directive" style="color: maroon"><?xml version="1.0" encoding="UTF-8"?></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><project</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">xmlns</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"http://maven.apache.org/POM/4.0.0"</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">xmlns:xsi</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"http://www.w3.org/2001/XMLSchema-instance"</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">xsi:schemaLocation</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><modelVersion></span>4.0.0<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></modelVersion></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>com.example<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>myproject<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><version></span>0.0.1-SNAPSHOT<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></version></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><parent></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.boot<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-boot-starter-parent<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><version></span>1.2.2.RELEASE<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></version></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></parent></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"><!-- Additional lines to be added here... --></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></project></span></pre><p>This should give you a working build, you can test it out by running <code class="literal">mvn package</code> (you can ignore the “jar will be empty - no content was marked for inclusion!'” warning for now).</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>At this point you could import the project into an IDE (most modern Java IDE’s include built-in support for Maven). For simplicity, we will continue to use a plain text editor for this example.</p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="getting-started-first-application-dependencies" href="#getting-started-first-application-dependencies"></a>11.2 Adding classpath dependencies</h2></div></div></div><p>Spring Boot provides a number of “Starter POMs” that make easy to add jars to your classpath. Our sample application has already used <code class="literal">spring-boot-starter-parent</code> in the <code class="literal">parent</code> section of the POM. The <code class="literal">spring-boot-starter-parent</code> is a special starter that provides useful Maven defaults. It also provides a <code class="literal">dependency-management</code> section so that you can omit <code class="literal">version</code> tags for “blessed” dependencies.</p><p>Other “Starter POMs” simply provide dependencies that you are likely to need when developing a specific type of application. Since we are developing a web application, we will add a <code class="literal">spring-boot-starter-web</code> dependency — but before that, let’s look at what we currently have.</p><pre class="screen">$ mvn dependency:tree [INFO] com.example:myproject:jar:0.0.1-SNAPSHOT</pre><p>The <code class="literal">mvn dependency:tree</code> command prints a tree representation of your project dependencies. You can see that <code class="literal">spring-boot-starter-parent</code> provides no dependencies by itself. Let’s edit our <code class="literal">pom.xml</code> and add the <code class="literal">spring-boot-starter-web</code> dependency just below the <code class="literal">parent</code> section:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependencies></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.boot<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-boot-starter-web<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependencies></span></pre><p>If you run <code class="literal">mvn dependency:tree</code> again, you will see that there are now a number of additional dependencies, including the Tomcat web server and Spring Boot itself.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="getting-started-first-application-code" href="#getting-started-first-application-code"></a>11.3 Writing the code</h2></div></div></div><p>To finish our application we need to create a single Java file. Maven will compile sources from <code class="literal">src/main/java</code> by default so you need to create that folder structure, then add a file named <code class="literal">src/main/java/Example.java</code>:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.boot.*; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.boot.autoconfigure.*; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.stereotype.*; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.web.bind.annotation.*; <em><span class="hl-annotation" style="color: gray">@RestController</span></em> <em><span class="hl-annotation" style="color: gray">@EnableAutoConfiguration</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> Example { <em><span class="hl-annotation" style="color: gray">@RequestMapping("/")</span></em> String home() { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">return</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"Hello World!"</span>; } <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">static</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">void</span> main(String[] args) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">throws</span> Exception { SpringApplication.run(Example.<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span>, args); } }</pre><p>Although there isn’t much code here, quite a lot is going on. Let’s step through the important parts.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="getting-started-first-application-annotations" href="#getting-started-first-application-annotations"></a>11.3.1 The @RestController and @RequestMapping annotations</h3></div></div></div><p>The first annotation on our <code class="literal">Example</code> class is <code class="literal">@RestController</code>. This is known as a <span class="emphasis"><em>stereotype</em></span> annotation. It provides hints for people reading the code, and for Spring, that the class plays a specific role. In this case, our class is a web <code class="literal">@Controller</code> so Spring will consider it when handling incoming web requests.</p><p>The <code class="literal">@RequestMapping</code> annotation provides “routing” information. It is telling Spring that any HTTP request with the path “/” should be mapped to the <code class="literal">home</code> method. The <code class="literal">@RestController</code> annotation tells Spring to render the resulting string directly back to the caller.</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>The <code class="literal">@RestController</code> and <code class="literal">@RequestMapping</code> annotations are Spring MVC annotations (they are not specific to Spring Boot). See the <a class="link" href="http://docs.spring.io/spring/docs/4.1.5.RELEASE/spring-framework-reference/htmlsingle#mvc" target="_top">MVC section</a> in the Spring Reference Documentation for more details.</p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="getting-started-first-application-auto-configuration" href="#getting-started-first-application-auto-configuration"></a>11.3.2 The @EnableAutoConfiguration annotation</h3></div></div></div><p>The second class-level annotation is <code class="literal">@EnableAutoConfiguration</code>. This annotation tells Spring Boot to “guess” how you will want to configure Spring, based on the jar dependencies that you have added. Since <code class="literal">spring-boot-starter-web</code> added Tomcat and Spring MVC, the auto-configuration will assume that you are developing a web application and setup Spring accordingly.</p><div class="sidebar"><div class="titlepage"><div><div><p class="title"><b>Starter POMs and Auto-Configuration</b></p></div></div></div><p>Auto-configuration is designed to work well with “Starter POMs”, but the two concepts are not directly tied. You are free to pick-and-choose jar dependencies outside of the starter POMs and Spring Boot will still do its best to auto-configure your application.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="getting-started-first-application-main-method" href="#getting-started-first-application-main-method"></a>11.3.3 The “main” method</h3></div></div></div><p>The final part of our application is the <code class="literal">main</code> method. This is just a standard method that follows the Java convention for an application entry point. Our main method delegates to Spring Boot’s <code class="literal">SpringApplication</code> class by calling <code class="literal">run</code>. <code class="literal">SpringApplication</code> will bootstrap our application, starting Spring which will in turn start the auto-configured Tomcat web server. We need to pass <code class="literal">Example.class</code> as an argument to the <code class="literal">run</code> method to tell <code class="literal">SpringApplication</code> which is the primary Spring component. The <code class="literal">args</code> array is also passed through to expose any command-line arguments.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="getting-started-first-application-run" href="#getting-started-first-application-run"></a>11.4 Running the example</h2></div></div></div><p>At this point our application should work. Since we have used the <code class="literal">spring-boot-starter-parent</code> POM we have a useful <code class="literal">run</code> goal that we can use to start the application. Type <code class="literal">mvn spring-boot:run</code> from the root project directory to start the application:</p><pre class="screen">$ mvn spring-boot:run . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v1.2.2.RELEASE) ....... . . . ....... . . . (log output here) ....... . . . ........ Started Example in 2.222 seconds (JVM running for 6.514)</pre><p>If you open a web browser to <a class="link" href="http://localhost:8080/" target="_top">localhost:8080</a> you should see the following output:</p><pre class="screen">Hello World!</pre><p>To gracefully exit the application hit <code class="literal">ctrl-c</code>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="getting-started-first-application-executable-jar" href="#getting-started-first-application-executable-jar"></a>11.5 Creating an executable jar</h2></div></div></div><p>Let’s finish our example by creating a completely self-contained executable jar file that we could run in production. Executable jars (sometimes called “fat jars”) are archives containing your compiled classes along with all of the jar dependencies that your code needs to run.</p><div class="sidebar"><div class="titlepage"><div><div><p class="title"><b>Executable jars and Java</b></p></div></div></div><p>Java does not provide any standard way to load nested jar files (i.e. jar files that are themselves contained within a jar). This can be problematic if you are looking to distribute a self-contained application.</p><p>To solve this problem, many developers use “shaded” jars. A shaded jar simply packages all classes, from all jars, into a single “uber jar”. The problem with shaded jars is that it becomes hard to see which libraries you are actually using in your application. It can also be problematic if the the same filename is used (but with different content) in multiple jars.</p><p>Spring Boot takes a <a class="link" href="#executable-jar" title="Appendix D. The executable jar format">different approach</a> and allows you to actually nest jars directly.</p></div><p>To create an executable jar we need to add the <code class="literal">spring-boot-maven-plugin</code> to our <code class="literal">pom.xml</code>. Insert the following lines just below the <code class="literal">dependencies</code> section:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><build></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><plugins></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><plugin></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.boot<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-boot-maven-plugin<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></plugin></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></plugins></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></build></span></pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>The <code class="literal">spring-boot-starter-parent</code> POM includes <code class="literal"><executions></code> configuration to bind the <code class="literal">repackage</code> goal. If you are not using the parent POM you will need to declare this configuration yourself. See the <a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/maven-plugin/usage.html" target="_top">plugin documentation</a> for details.</p></td></tr></tbody></table></div><p>Save your <code class="literal">pom.xml</code> and run <code class="literal">mvn package</code> from the command line:</p><pre class="screen">$ mvn package [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building myproject 0.0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] .... .. [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ myproject --- [INFO] Building jar: /Users/developer/example/spring-boot-example/target/myproject-0.0.1-SNAPSHOT.jar [INFO] [INFO] --- spring-boot-maven-plugin:1.2.2.RELEASE:repackage (default) @ myproject --- [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------</pre><p>If you look in the <code class="literal">target</code> directory you should see <code class="literal">myproject-0.0.1-SNAPSHOT.jar</code>. The file should be around 10 Mb in size. If you want to peek inside, you can use <code class="literal">jar tvf</code>:</p><pre class="screen">$ jar tvf target/myproject-0.0.1-SNAPSHOT.jar</pre><p>You should also see a much smaller file named <code class="literal">myproject-0.0.1-SNAPSHOT.jar.original</code> in the <code class="literal">target</code> directory. This is the original jar file that Maven created before it was repackaged by Spring Boot.</p><p>To run that application, use the <code class="literal">java -jar</code> command:</p><pre class="screen">$ java -jar target/myproject-0.0.1-SNAPSHOT.jar . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v1.2.2.RELEASE) ....... . . . ....... . . . (log output here) ....... . . . ........ Started Example in 2.536 seconds (JVM running for 2.864)</pre><p>As before, to gracefully exit the application hit <code class="literal">ctrl-c</code>.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="getting-started-whats-next" href="#getting-started-whats-next"></a>12. What to read next</h2></div></div></div><p>Hopefully this section has provided you with some of the Spring Boot basics, and got you on your way to writing your own applications. If you’re a task-oriented type of developer you might want to jump over to <a class="link" href="http://spring.io/" target="_top">spring.io</a> and check out some of the <a class="link" href="http://spring.io/guides/" target="_top">getting started</a> guides that solve specific “How do I do that with Spring” problems; we also have Spring Boot-specific <span class="emphasis"><em><a class="link" href="#howto" title="Part IX. ‘How-to’ guides">How-to</a></em></span> reference documentation.</p><p>Otherwise, the next logical step is to read <span class="emphasis"><em><a class="xref" href="#using-boot" title="Part III. Using Spring Boot">Part III, “Using Spring Boot”</a></em></span>. If you’re really impatient, you could also jump ahead and read about <span class="emphasis"><em><a class="link" href="#boot-features" title="Part IV. Spring Boot features">Spring Boot features</a></em></span>.</p></div></div><div class="part"><div class="titlepage"><div><div><h1 class="title"><a name="using-boot" href="#using-boot"></a>Part III. Using Spring Boot</h1></div></div></div><div class="partintro"><div></div><p>This section goes into more detail about how you should use Spring Boot. It covers topics such as build systems, auto-configuration and run/deployment options. We also cover some Spring Boot best practices. Although there is nothing particularly special about Spring Boot (it is just another library that you can consume), there are a few recommendations that, when followed, will make your development process just a little easier.</p><p>If you’re just starting out with Spring Boot, you should probably read the <span class="emphasis"><em><a class="link" href="#getting-started" title="Part II. Getting started">Getting Started</a></em></span> guide before diving into this section.</p></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="using-boot-build-systems" href="#using-boot-build-systems"></a>13. Build systems</h2></div></div></div><p>It is strongly recommended that you choose a build system that supports <span class="emphasis"><em>dependency management</em></span>, and one that can consume artifacts published to the “Maven Central” repository. We would recommend that you choose Maven or Gradle. It is possible to get Spring Boot to work with other build systems (Ant for example), but they will not be particularly well supported.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="using-boot-maven" href="#using-boot-maven"></a>13.1 Maven</h2></div></div></div><p>Maven users can inherit from the <code class="literal">spring-boot-starter-parent</code> project to obtain sensible defaults. The parent project provides the following features:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Java 1.6 as the default compiler level.</li><li class="listitem">UTF-8 source encoding.</li><li class="listitem">A Dependency Management section, allowing you to omit <code class="literal"><version></code> tags for common dependencies, inherited from the <code class="literal">spring-boot-dependencies</code> POM.</li><li class="listitem">Sensible <a class="link" href="https://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html" target="_top">resource filtering</a>.</li><li class="listitem">Sensible plugin configuration (<a class="link" href="http://mojo.codehaus.org/exec-maven-plugin/" target="_top">exec plugin</a>, <a class="link" href="http://maven.apache.org/surefire/maven-surefire-plugin/" target="_top">surefire</a>, <a class="link" href="https://github.com/ktoso/maven-git-commit-id-plugin" target="_top">Git commit ID</a>, <a class="link" href="http://maven.apache.org/plugins/maven-shade-plugin/" target="_top">shade</a>).</li><li class="listitem">Sensible resource filtering for <code class="literal">application.properties</code> and <code class="literal">application.yml</code></li></ul></div><p>On the last point: since the default config files accept Spring style placeholders (<code class="literal">${…}</code>) the Maven filtering is changed to use <code class="literal">@..@</code> placeholders (you can override that with a Maven property <code class="literal">resource.delimiter</code>).</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="using-boot-maven-parent-pom" href="#using-boot-maven-parent-pom"></a>13.1.1 Inheriting the starter parent</h3></div></div></div><p>To configure your project to inherit from the <code class="literal">spring-boot-starter-parent</code> simply set the <code class="literal">parent</code>:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"><!-- Inherit defaults from Spring Boot --></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><parent></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.boot<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-boot-starter-parent<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><version></span>1.2.2.RELEASE<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></version></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></parent></span></pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>You should only need to specify the Spring Boot version number on this dependency. If you import additional starters, you can safely omit the version number.</p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="using-boot-maven-without-a-parent" href="#using-boot-maven-without-a-parent"></a>13.1.2 Using Spring Boot without the parent POM</h3></div></div></div><p>Not everyone likes inheriting from the <code class="literal">spring-boot-starter-parent</code> POM. You may have your own corporate standard parent that you need to use, or you may just prefer to explicitly declare all your Maven configuration.</p><p>If you don’t want to use the <code class="literal">spring-boot-starter-parent</code>, you can still keep the benefit of the dependency management (but not the plugin management) by using a <code class="literal">scope=import</code> dependency:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependencyManagement></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependencies></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"><!-- Import dependency management from Spring Boot --></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.boot<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-boot-dependencies<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><version></span>1.2.2.RELEASE<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></version></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><type></span>pom<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></type></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><scope></span>import<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></scope></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependencies></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependencyManagement></span></pre></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="using-boot-maven-java-version" href="#using-boot-maven-java-version"></a>13.1.3 Changing the Java version</h3></div></div></div><p>The <code class="literal">spring-boot-starter-parent</code> chooses fairly conservative Java compatibility. If you want to follow our recommendation and use a later Java version you can add a <code class="literal">java.version</code> property:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><properties></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><java.version></span>1.8<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></java.version></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></properties></span></pre></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="using-boot-maven-plugin" href="#using-boot-maven-plugin"></a>13.1.4 Using the Spring Boot Maven plugin</h3></div></div></div><p>Spring Boot includes a <a class="link" href="#build-tool-plugins-maven-plugin" title="58. Spring Boot Maven plugin">Maven plugin</a> that can package the project as an executable jar. Add the plugin to your <code class="literal"><plugins></code> section if you want to use it:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><build></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><plugins></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><plugin></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.boot<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-boot-maven-plugin<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></plugin></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></plugins></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></build></span></pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>If you use the Spring Boot starter parent pom, you only need to add the plugin, there is no need for to configure it unless you want to change the settings defined in the parent.</p></td></tr></tbody></table></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="using-boot-gradle" href="#using-boot-gradle"></a>13.2 Gradle</h2></div></div></div><p>Gradle users can directly import “starter POMs” in their <code class="literal">dependencies</code> section. Unlike Maven, there is no “super parent” to import to share some configuration.</p><pre class="programlisting">apply plugin: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'java'</span> repositories { jcenter() } dependencies { compile(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"org.springframework.boot:spring-boot-starter-web:1.2.2.RELEASE"</span>) }</pre><p>The <a class="link" href="#build-tool-plugins-gradle-plugin" title="59. Spring Boot Gradle plugin"><code class="literal">spring-boot-gradle-plugin</code></a> is also available and provides tasks to create executable jars and run projects from source. It also adds a <code class="literal">ResolutionStrategy</code> that enables you to <a class="link" href="#build-tool-plugins-gradle-dependencies-without-versions" title="59.2 Declaring dependencies without versions">omit the version number for “blessed” dependencies</a>:</p><pre class="programlisting">buildscript { repositories { jcenter() } dependencies { classpath(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"org.springframework.boot:spring-boot-gradle-plugin:1.2.2.RELEASE"</span>) } } apply plugin: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'java'</span> apply plugin: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'spring-boot'</span> repositories { jcenter() } dependencies { compile(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"org.springframework.boot:spring-boot-starter-web"</span>) testCompile(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"org.springframework.boot:spring-boot-starter-test"</span>) }</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="using-boot-ant" href="#using-boot-ant"></a>13.3 Ant</h2></div></div></div><p>It is possible to build a Spring Boot project using Apache Ant, however, no special support or plugins are provided. Ant scripts can use the Ivy dependency system to import starter POMs.</p><p>See the <span class="emphasis"><em><a class="xref" href="#howto-build-an-executable-archive-with-ant" title="73.8 Build an executable archive with Ant">Section 73.8, “Build an executable archive with Ant”</a></em></span> “How-to” for more complete instructions.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="using-boot-starter-poms" href="#using-boot-starter-poms"></a>13.4 Starter POMs</h2></div></div></div><p>Starter POMs are a set of convenient dependency descriptors that you can include in your application. You get a one-stop-shop for all the Spring and related technology that you need, without having to hunt through sample code and copy paste loads of dependency descriptors. For example, if you want to get started using Spring and JPA for database access, just include the <code class="literal">spring-boot-starter-data-jpa</code> dependency in your project, and you are good to go.</p><p>The starters contain a lot of the dependencies that you need to get a project up and running quickly and with a consistent, supported set of managed transitive dependencies.</p><div class="sidebar"><div class="titlepage"><div><div><p class="title"><b>What’s in a name</b></p></div></div></div><p>All starters follow a similar naming pattern; <code class="literal">spring-boot-starter-*</code>, where <code class="literal">*</code> is a particular type of application. This naming structure is intended to help when you need to find a starter. The Maven integration in many IDEs allow you to search dependencies by name. For example, with the appropriate Eclipse or STS plugin installed, you can simply hit <code class="literal">ctrl-space</code> in the POM editor and type ''spring-boot-starter'' for a complete list.</p></div><p>The following application starters are provided by Spring Boot under the <code class="literal">org.springframework.boot</code> group:</p><div class="table"><a name="d0e1414" href="#d0e1414"></a><p class="title"><b>Table 13.1. Spring Boot application starters</b></p><div class="table-contents"><table summary="Spring Boot application starters" style="border-collapse: collapse;border-top: 0.5pt solid ; border-bottom: 0.5pt solid ; border-left: 0.5pt solid ; border-right: 0.5pt solid ; "><colgroup><col class="col_1"><col class="col_2"></colgroup><thead><tr><th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top">Name</th><th style="border-bottom: 0.5pt solid ; " align="left" valign="top">Description</th></tr></thead><tbody><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>The core Spring Boot starter, including auto-configuration support, logging and YAML.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-actuator</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Production ready features to help you monitor and manage your application.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-amqp</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Support for the “Advanced Message Queuing Protocol” via <code class="literal">spring-rabbit</code>.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-aop</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Support for aspect-oriented programming including <code class="literal">spring-aop</code> and AspectJ.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-batch</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Support for “Spring Batch” including HSQLDB database.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-cloud-connectors</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Support for “Spring Cloud Connectors” which simplifies connecting to services in cloud platforms like Cloud Foundry and Heroku.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-data-elasticsearch</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Support for the Elasticsearch search and analytics engine including <code class="literal">spring-data-elasticsearch</code>.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-data-gemfire</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Support for the GemFire distributed data store including <code class="literal">spring-data-gemfire</code>.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-data-jpa</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Support for the “Java Persistence API” including <code class="literal">spring-data-jpa</code>, <code class="literal">spring-orm</code> and Hibernate.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-data-mongodb</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Support for the MongoDB NoSQL Database, including <code class="literal">spring-data-mongodb</code>.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-data-rest</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Support for exposing Spring Data repositories over REST via <code class="literal">spring-data-rest-webmvc</code>.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-data-solr</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Support for the Apache Solr search platform, including <code class="literal">spring-data-solr</code>.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-freemarker</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Support for the FreeMarker templating engine.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-groovy-templates</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Support for the Groovy templating engine.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-hateoas</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Support for HATEOAS-based RESTful services via <code class="literal">spring-hateoas</code>.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-hornetq</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Support for “Java Message Service API” via HornetQ.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-integration</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Support for common <code class="literal">spring-integration</code> modules.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-jdbc</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Support for JDBC databases.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-jersey</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Support for the Jersey RESTful Web Services framework.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-jta-atomikos</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Support for JTA distributed transactions via Atomikos.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-jta-bitronix</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Support for JTA distributed transactions via Bitronix.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-mail</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Support for <code class="literal">javax.mail</code>.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-mobile</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Support for <code class="literal">spring-mobile</code>.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-mustache</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Support for the Mustache templating engine.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-redis</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Support for the REDIS key-value data store, including <code class="literal">spring-redis</code>.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-security</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Support for <code class="literal">spring-security</code>.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-social-facebook</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Support for <code class="literal">spring-social-facebook</code>.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-social-linkedin</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Support for <code class="literal">spring-social-linkedin</code>.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-social-twitter</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Support for <code class="literal">spring-social-twitter</code>.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-test</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Support for common test dependencies, including JUnit, Hamcrest and Mockito along with the <code class="literal">spring-test</code> module.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-thymeleaf</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Support for the Thymeleaf templating engine, including integration with Spring.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-velocity</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Support for the Velocity templating engine.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-web</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Support for full-stack web development, including Tomcat and <code class="literal">spring-webmvc</code>.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-websocket</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Support for WebSocket development.</p></td></tr><tr><td style="border-right: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-ws</code></p></td><td style="" align="left" valign="top"><p>Support for Spring Web Services.</p></td></tr></tbody></table></div></div><br class="table-break"><p>In addition to the application starters, the following starters can be used to add <span class="emphasis"><em><a class="link" href="#production-ready" title="Part V. Spring Boot Actuator: Production-ready features">production ready</a></em></span> features.</p><div class="table"><a name="d0e1773" href="#d0e1773"></a><p class="title"><b>Table 13.2. Spring Boot production ready starters</b></p><div class="table-contents"><table summary="Spring Boot production ready starters" style="border-collapse: collapse;border-top: 0.5pt solid ; border-bottom: 0.5pt solid ; border-left: 0.5pt solid ; border-right: 0.5pt solid ; "><colgroup><col class="col_1"><col class="col_2"></colgroup><thead><tr><th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top">Name</th><th style="border-bottom: 0.5pt solid ; " align="left" valign="top">Description</th></tr></thead><tbody><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-actuator</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Adds production ready features such as metrics and monitoring.</p></td></tr><tr><td style="border-right: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-remote-shell</code></p></td><td style="" align="left" valign="top"><p>Adds remote <code class="literal">ssh</code> shell support.</p></td></tr></tbody></table></div></div><br class="table-break"><p>Finally, Spring Boot includes some starters that can be used if you want to exclude or swap specific technical facets.</p><div class="table"><a name="d0e1807" href="#d0e1807"></a><p class="title"><b>Table 13.3. Spring Boot technical starters</b></p><div class="table-contents"><table summary="Spring Boot technical starters" style="border-collapse: collapse;border-top: 0.5pt solid ; border-bottom: 0.5pt solid ; border-left: 0.5pt solid ; border-right: 0.5pt solid ; "><colgroup><col class="col_1"><col class="col_2"></colgroup><thead><tr><th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top">Name</th><th style="border-bottom: 0.5pt solid ; " align="left" valign="top">Description</th></tr></thead><tbody><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-jetty</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Imports the Jetty HTTP engine (to be used as an alternative to Tomcat).</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-log4j</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Support the Log4J logging framework.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-logging</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Import Spring Boot’s default logging framework (Logback).</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-tomcat</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Import Spring Boot’s default HTTP engine (Tomcat).</p></td></tr><tr><td style="border-right: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-undertow</code></p></td><td style="" align="left" valign="top"><p>Imports the Undertow HTTP engine (to be used as an alternative to Tomcat).</p></td></tr></tbody></table></div></div><br class="table-break"><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>For a list of additional community contributed starter POMs, see the <a class="link" href="http://github.com/spring-projects/spring-boot/tree/master/spring-boot-starters/README.adoc" target="_top">README file</a> in the <code class="literal">spring-boot-starters</code> module on GitHub.</p></td></tr></tbody></table></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="using-boot-structuring-your-code" href="#using-boot-structuring-your-code"></a>14. Structuring your code</h2></div></div></div><p>Spring Boot does not require any specific code layout to work, however, there are some best practices that help.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="using-boot-using-the-default-package" href="#using-boot-using-the-default-package"></a>14.1 Using the “default” package</h2></div></div></div><p>When a class doesn’t include a <code class="literal">package</code> declaration it is considered to be in the “default package”. The use of the “default package” is generally discouraged, and should be avoided. It can cause particular problems for Spring Boot applications that use <code class="literal">@ComponentScan</code>, <code class="literal">@EntityScan</code> or <code class="literal">@SpringBootApplication</code> annotations, since every class from every jar, will be read.</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>We recommend that you follow Java’s recommended package naming conventions and use a reversed domain name (for example, <code class="literal">com.example.project</code>).</p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="using-boot-locating-the-main-class" href="#using-boot-locating-the-main-class"></a>14.2 Locating the main application class</h2></div></div></div><p>We generally recommend that you locate your main application class in a root package above other classes. The <code class="literal">@EnableAutoConfiguration</code> annotation is often placed on your main class, and it implicitly defines a base “search package” for certain items. For example, if you are writing a JPA application, the package of the <code class="literal">@EnableAutoConfiguration</code> annotated class will be used to search for <code class="literal">@Entity</code> items.</p><p>Using a root package also allows the <code class="literal">@ComponentScan</code> annotation to be used without needing to specify a <code class="literal">basePackage</code> attribute. You can also use the <code class="literal">@SpringBootApplication</code> annotation if your main class is in the root package.</p><p>Here is a typical layout:</p><pre class="screen">com +- example +- myproject +- Application.java | +- domain | +- Customer.java | +- CustomerRepository.java | +- service | +- CustomerService.java | +- web +- CustomerController.java</pre><p>The <code class="literal">Application.java</code> file would declare the <code class="literal">main</code> method, along with the basic <code class="literal">@Configuration</code>.</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">package</span> com.example.myproject; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.boot.SpringApplication; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.boot.autoconfigure.EnableAutoConfiguration; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.context.annotation.ComponentScan; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.context.annotation.Configuration; <em><span class="hl-annotation" style="color: gray">@Configuration</span></em> <em><span class="hl-annotation" style="color: gray">@EnableAutoConfiguration</span></em> <em><span class="hl-annotation" style="color: gray">@ComponentScan</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> Application { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">static</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">void</span> main(String[] args) { SpringApplication.run(Application.<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span>, args); } }</pre></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="using-boot-configuration-classes" href="#using-boot-configuration-classes"></a>15. Configuration classes</h2></div></div></div><p>Spring Boot favors Java-based configuration. Although it is possible to call <code class="literal">SpringApplication.run()</code> with an XML source, we generally recommend that your primary source is a <code class="literal">@Configuration</code> class. Usually the class that defines the <code class="literal">main</code> method is also a good candidate as the primary <code class="literal">@Configuration</code>.</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>Many Spring configuration examples have been published on the Internet that use XML configuration. Always try to use the equivalent Java-base configuration if possible. Searching for <code class="literal">enable*</code> annotations can be a good starting point.</p></td></tr></tbody></table></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="using-boot-importing-configuration" href="#using-boot-importing-configuration"></a>15.1 Importing additional configuration classes</h2></div></div></div><p>You don’t need to put all your <code class="literal">@Configuration</code> into a single class. The <code class="literal">@Import</code> annotation can be used to import additional configuration classes. Alternatively, you can use <code class="literal">@ComponentScan</code> to automatically pickup all Spring components, including <code class="literal">@Configuration</code> classes.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="using-boot-importing-xml-configuration" href="#using-boot-importing-xml-configuration"></a>15.2 Importing XML configuration</h2></div></div></div><p>If you absolutely must use XML based configuration, we recommend that you still start with a <code class="literal">@Configuration</code> class. You can then use an additional <code class="literal">@ImportResource</code> annotation to load XML configuration files.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="using-boot-auto-configuration" href="#using-boot-auto-configuration"></a>16. Auto-configuration</h2></div></div></div><p>Spring Boot auto-configuration attempts to automatically configure your Spring application based on the jar dependencies that you have added. For example, If <code class="literal">HSQLDB</code> is on your classpath, and you have not manually configured any database connection beans, then we will auto-configure an in-memory database.</p><p>You need to opt-in to auto-configuration by adding the <code class="literal">@EnableAutoConfiguration</code> or <code class="literal">@SpringBootApplication</code> annotations to one of your <code class="literal">@Configuration</code> classes.</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>You should only ever add one <code class="literal">@EnableAutoConfiguration</code> annotation. We generally recommend that you add it to your primary <code class="literal">@Configuration</code> class.</p></td></tr></tbody></table></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="using-boot-replacing-auto-configuration" href="#using-boot-replacing-auto-configuration"></a>16.1 Gradually replacing auto-configuration</h2></div></div></div><p>Auto-configuration is noninvasive, at any point you can start to define your own configuration to replace specific parts of the auto-configuration. For example, if you add your own <code class="literal">DataSource</code> bean, the default embedded database support will back away.</p><p>If you need to find out what auto-configuration is currently being applied, and why, starting your application with the <code class="literal">--debug</code> switch. This will log an auto-configuration report to the console.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="using-boot-disabling-specific-auto-configutation" href="#using-boot-disabling-specific-auto-configutation"></a>16.2 Disabling specific auto-configuration</h2></div></div></div><p>If you find that specific auto-configure classes are being applied that you don’t want, you can use the exclude attribute of <code class="literal">@EnableAutoConfiguration</code> to disable them.</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.boot.autoconfigure.*; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.boot.autoconfigure.jdbc.*; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.context.annotation.*; <em><span class="hl-annotation" style="color: gray">@Configuration</span></em> <em><span class="hl-annotation" style="color: gray">@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> MyConfiguration { }</pre></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="using-boot-spring-beans-and-dependency-injection" href="#using-boot-spring-beans-and-dependency-injection"></a>17. Spring Beans and dependency injection</h2></div></div></div><p>You are free to use any of the standard Spring Framework techniques to define your beans and their injected dependencies. For simplicity, we often find that using <code class="literal">@ComponentScan</code> to find your beans, in combination with <code class="literal">@Autowired</code> constructor injection works well.</p><p>If you structure your code as suggested above (locating your application class in a root package), you can add <code class="literal">@ComponentScan</code> without any arguments. All of your application components (<code class="literal">@Component</code>, <code class="literal">@Service</code>, <code class="literal">@Repository</code>, <code class="literal">@Controller</code> etc.) will be automatically registered as Spring Beans.</p><p>Here is an example <code class="literal">@Service</code> Bean that uses constructor injection to obtain a required <code class="literal">RiskAssessor</code> bean.</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">package</span> com.example.service; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.beans.factory.annotation.Autowired; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.stereotype.Service; <em><span class="hl-annotation" style="color: gray">@Service</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> DatabaseAccountService <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">implements</span> AccountService { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">private</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">final</span> RiskAssessor riskAssessor; <em><span class="hl-annotation" style="color: gray">@Autowired</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> DatabaseAccountService(RiskAssessor riskAssessor) { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">this</span>.riskAssessor = riskAssessor; } <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// ...</span> }</pre><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>Notice how using constructor injection allows the <code class="literal">riskAssessor</code> field to be marked as <code class="literal">final</code>, indicating that it cannot be subsequently changed.</p></td></tr></tbody></table></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="using-boot-using-springbootapplication-annotation" href="#using-boot-using-springbootapplication-annotation"></a>18. Using the @SpringBootApplication annotation</h2></div></div></div><p>Many Spring Boot developers always have their main class annotated with <code class="literal">@Configuration</code>, <code class="literal">@EnableAutoConfiguration</code> and <code class="literal">@ComponentScan</code>. Since these annotations are so frequently used together (especially if you follow the <a class="link" href="#using-boot-structuring-your-code" title="14. Structuring your code">best practices</a> above), Spring Boot provides a convenient <code class="literal">@SpringBootApplication</code> alternative.</p><p>The <code class="literal">@SpringBootApplication</code> annotation is equivalent to using <code class="literal">@Configuration</code>, <code class="literal">@EnableAutoConfiguration</code> and <code class="literal">@ComponentScan</code> with their default attributes:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">package</span> com.example.myproject; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.boot.SpringApplication; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.boot.autoconfigure.SpringBootApplication; <em><span class="hl-annotation" style="color: gray">@SpringBootApplication</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// same as @Configuration @EnableAutoConfiguration @ComponentScan</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> Application { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">static</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">void</span> main(String[] args) { SpringApplication.run(Application.<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span>, args); } }</pre></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="using-boot-running-your-application" href="#using-boot-running-your-application"></a>19. Running your application</h2></div></div></div><p>One of the biggest advantages of packaging your application as jar and using an embedded HTTP server is that you can run your application as you would any other. Debugging Spring Boot applications is also easy; you don’t need any special IDE plugins or extensions.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>This section only covers jar based packaging, If you choose to package your application as a war file you should refer to your server and IDE documentation.</p></td></tr></tbody></table></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="using-boot-running-from-an-ide" href="#using-boot-running-from-an-ide"></a>19.1 Running from an IDE</h2></div></div></div><p>You can run a Spring Boot application from your IDE as a simple Java application, however, first you will need to import your project. Import steps will vary depending on your IDE and build system. Most IDEs can import Maven projects directly, for example Eclipse users can select <code class="literal">Import…</code> → <code class="literal">Existing Maven Projects</code> from the <code class="literal">File</code> menu.</p><p>If you can’t directly import your project into your IDE, you may be able to generate IDE metadata using a build plugin. Maven includes plugins for <a class="link" href="http://maven.apache.org/plugins/maven-eclipse-plugin/" target="_top">Eclipse</a> and <a class="link" href="http://maven.apache.org/plugins/maven-idea-plugin/" target="_top">IDEA</a>; Gradle offers plugins for <a class="link" href="http://www.gradle.org/docs/current/userguide/ide_support.html" target="_top">various IDEs</a>.</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>If you accidentally run a web application twice you will see a “Port already in use” error. STS users can use the <code class="literal">Relaunch</code> button rather than <code class="literal">Run</code> to ensure that any existing instance is closed.</p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="using-boot-running-as-a-packaged-application" href="#using-boot-running-as-a-packaged-application"></a>19.2 Running as a packaged application</h2></div></div></div><p>If you use the Spring Boot Maven or Gradle plugins to create an executable jar you can run your application using <code class="literal">java -jar</code>. For example:</p><pre class="screen">$ java -jar target/myproject-0.0.1-SNAPSHOT.jar</pre><p>It is also possible to run a packaged application with remote debugging support enabled. This allows you to attach a debugger to your packaged application:</p><pre class="screen">$ java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=8000,suspend=n \ -jar target/myproject-0.0.1-SNAPSHOT.jar</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="using-boot-running-with-the-maven-plugin" href="#using-boot-running-with-the-maven-plugin"></a>19.3 Using the Maven plugin</h2></div></div></div><p>The Spring Boot Maven plugin includes a <code class="literal">run</code> goal which can be used to quickly compile and run your application. Applications run in an exploded form, and you can edit resources for instant “hot” reload.</p><pre class="screen">$ mvn spring-boot:run</pre><p>You might also want to use the useful operating system environment variable:</p><pre class="screen">$ export MAVEN_OPTS=-Xmx1024m -XX:MaxPermSize=128M -Djava.security.egd=file:/dev/./urandom</pre><p>(The “egd” setting is to speed up Tomcat startup by giving it a faster source of entropy for session keys.)</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="using-boot-running-with-the-gradle-plugin" href="#using-boot-running-with-the-gradle-plugin"></a>19.4 Using the Gradle plugin</h2></div></div></div><p>The Spring Boot Gradle plugin also includes a <code class="literal">run</code> goal which can be used to run your application in an exploded form. The <code class="literal">bootRun</code> task is added whenever you import the <code class="literal">spring-boot-plugin</code></p><pre class="screen">$ gradle bootRun</pre><p>You might also want to use this useful operating system environment variable:</p><pre class="screen">$ export JAVA_OPTS=-Xmx1024m -XX:MaxPermSize=128M -Djava.security.egd=file:/dev/./urandom</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="using-boot-hot-swapping" href="#using-boot-hot-swapping"></a>19.5 Hot swapping</h2></div></div></div><p>Since Spring Boot applications are just plain Java applications, JVM hot-swapping should work out of the box. JVM hot swapping is somewhat limited with the bytecode that it can replace, for a more complete solution the <a class="link" href="https://github.com/spring-projects/spring-loaded" target="_top">Spring Loaded</a> project, or <a class="link" href="http://zeroturnaround.com/software/jrebel/" target="_top">JRebel</a> can be used.</p><p>See the <a class="link" href="#howto-hotswapping" title="72. Hot swapping">Hot swapping “How-to”</a> section for details.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="using-boot-packaging-for-production" href="#using-boot-packaging-for-production"></a>20. Packaging your application for production</h2></div></div></div><p>Executable jars can be used for production deployment. As they are self-contained, they are also ideally suited for cloud-based deployment.</p><p>For additional “production ready” features, such as health, auditing and metric REST or JMX end-points; consider adding <code class="literal">spring-boot-actuator</code>. See <span class="emphasis"><em><a class="xref" href="#production-ready" title="Part V. Spring Boot Actuator: Production-ready features">Part V, “Spring Boot Actuator: Production-ready features”</a></em></span> for details.</p></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="using-boot-whats-next" href="#using-boot-whats-next"></a>21. What to read next</h2></div></div></div><p>You should now have good understanding of how you can use Spring Boot along with some best practices that you should follow. You can now go on to learn about specific <span class="emphasis"><em><a class="link" href="#boot-features" title="Part IV. Spring Boot features">Spring Boot features</a></em></span> in depth, or you could skip ahead and read about the “<a class="link" href="#production-ready" title="Part V. Spring Boot Actuator: Production-ready features">production ready</a>” aspects of Spring Boot.</p></div></div><div class="part"><div class="titlepage"><div><div><h1 class="title"><a name="boot-features" href="#boot-features"></a>Part IV. Spring Boot features</h1></div></div></div><div class="partintro"><div></div><p>This section dives into the details of Spring Boot. Here you can learn about the key features that you will want to use and customize. If you haven’t already, you might want to read the <span class="emphasis"><em><a class="xref" href="#getting-started" title="Part II. Getting started">Part II, “Getting started”</a></em></span> and <span class="emphasis"><em><a class="xref" href="#using-boot" title="Part III. Using Spring Boot">Part III, “Using Spring Boot”</a></em></span> sections so that you have a good grounding of the basics.</p></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="boot-features-spring-application" href="#boot-features-spring-application"></a>22. SpringApplication</h2></div></div></div><p>The <code class="literal">SpringApplication</code> class provides a convenient way to bootstrap a Spring application that will be started from a <code class="literal">main()</code> method. In many situations you can just delegate to the static <code class="literal">SpringApplication.run</code> method:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">static</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">void</span> main(String[] args) { SpringApplication.run(MySpringConfiguration.<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span>, args); }</pre><p>When your application starts you should see something similar to the following:</p><pre class="screen"> . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: v1.2.2.RELEASE 2013-07-31 00:08:16.117 INFO 56603 --- [ main] o.s.b.s.app.SampleApplication : Starting SampleApplication v0.1.0 on mycomputer with PID 56603 (/apps/myapp.jar started by pwebb) 2013-07-31 00:08:16.166 INFO 56603 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@6e5a8246: startup date [Wed Jul 31 00:08:16 PDT 2013]; root of context hierarchy 2014-03-04 13:09:54.912 INFO 41370 --- [ main] .t.TomcatEmbeddedServletContainerFactory : Server initialized with port: 8080 2014-03-04 13:09:56.501 INFO 41370 --- [ main] o.s.b.s.app.SampleApplication : Started SampleApplication in 2.992 seconds (JVM running for 3.658)</pre><p>By default <code class="literal">INFO</code> logging messages will be shown, including some relevant startup details such as the user that launched the application.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boot-features-banner" href="#boot-features-banner"></a>22.1 Customizing the Banner</h2></div></div></div><p>The banner that is printed on start up can be changed by adding a <code class="literal">banner.txt</code> file to your classpath, or by setting <code class="literal">banner.location</code> to the location of such a file. If the file has an unusual encoding you can set <code class="literal">banner.encoding</code> (default is <code class="literal">UTF-8</code>).</p><p>You can use the following variables inside your <code class="literal">banner.txt</code> file:</p><div class="table"><a name="d0e2315" href="#d0e2315"></a><p class="title"><b>Table 22.1. Banner variables</b></p><div class="table-contents"><table summary="Banner variables" style="border-collapse: collapse;border-top: 0.5pt solid ; border-bottom: 0.5pt solid ; border-left: 0.5pt solid ; border-right: 0.5pt solid ; "><colgroup><col class="col_1"><col class="col_2"></colgroup><thead><tr><th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top">Variable</th><th style="border-bottom: 0.5pt solid ; " align="left" valign="top">Description</th></tr></thead><tbody><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">${application.version}</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>The version number of your application as declared in <code class="literal">MANIFEST.MF</code>. For example <code class="literal">1.0</code>.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">${application.formatted-version}</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>The version number of your application as declared in <code class="literal">MANIFEST.MF</code> formatted for display (surrounded with brackets and prefixed with <code class="literal">v</code>). For example <code class="literal">(v1.0)</code>.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">${spring-boot.version}</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>The Spring Boot version that you are using. For example <code class="literal">1.2.2.RELEASE</code>.</p></td></tr><tr><td style="border-right: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">${spring-boot.formatted-version}</code></p></td><td style="" align="left" valign="top"><p>The Spring Boot version that you are using formatted for display (surrounded with brackets and prefixed with <code class="literal">v</code>). For example <code class="literal">(v1.2.2.RELEASE)</code>.</p></td></tr></tbody></table></div></div><br class="table-break"><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>The <code class="literal">SpringBootApplication.setBanner(…)</code> method can be used if you want to generate a banner programmatically. Use the <code class="literal">org.springframework.boot.Banner</code> interface and implement your own <code class="literal">printBanner()</code> method.</p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boot-features-customizing-spring-application" href="#boot-features-customizing-spring-application"></a>22.2 Customizing SpringApplication</h2></div></div></div><p>If the <code class="literal">SpringApplication</code> defaults aren’t to your taste you can instead create a local instance and customize it. For example, to turn off the banner you would write:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">static</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">void</span> main(String[] args) { SpringApplication app = <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">new</span> SpringApplication(MySpringConfiguration.<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span>); app.setShowBanner(false); app.run(args); }</pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>The constructor arguments passed to <code class="literal">SpringApplication</code> are configuration sources for spring beans. In most cases these will be references to <code class="literal">@Configuration</code> classes, but they could also be references to XML configuration or to packages that should be scanned.</p></td></tr></tbody></table></div><p>It is also possible to configure the <code class="literal">SpringApplication</code> using an <code class="literal">application.properties</code> file. See <span class="emphasis"><em><a class="xref" href="#boot-features-external-config" title="23. Externalized Configuration">Chapter 23, <i>Externalized Configuration</i></a></em></span> for details.</p><p>For a complete list of the configuration options, see the <a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/SpringApplication.html" target="_top"><code class="literal">SpringApplication</code> Javadoc</a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boot-features-fluent-builder-api" href="#boot-features-fluent-builder-api"></a>22.3 Fluent builder API</h2></div></div></div><p>If you need to build an <code class="literal">ApplicationContext</code> hierarchy (multiple contexts with a parent/child relationship), or if you just prefer using a ‘fluent’ builder API, you can use the <code class="literal">SpringApplicationBuilder</code>.</p><p>The <code class="literal">SpringApplicationBuilder</code> allows you to chain together multiple method calls, and includes <code class="literal">parent</code> and <code class="literal">child</code> methods that allow you to create a hierarchy.</p><p>For example:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">new</span> SpringApplicationBuilder() .showBanner(false) .sources(Parent.<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span>) .child(Application.<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span>) .run(args);</pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>There are some restrictions when creating an <code class="literal">ApplicationContext</code> hierarchy, e.g. Web components <span class="strong"><strong>must</strong></span> be contained within the child context, and the same <code class="literal">Environment</code> will be used for both parent and child contexts. See the <a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/builder/SpringApplicationBuilder.html" target="_top"><code class="literal">SpringApplicationBuilder</code> javadoc</a> for full details.</p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boot-features-application-events-and-listeners" href="#boot-features-application-events-and-listeners"></a>22.4 Application events and listeners</h2></div></div></div><p>In addition to the usual Spring Framework events, such as <a class="link" href="http://docs.spring.io/spring/docs/4.1.5.RELEASE/javadoc-api/org/springframework/context/event/ContextRefreshedEvent.html" target="_top"><code class="literal">ContextRefreshedEvent</code></a>, a <code class="literal">SpringApplication</code> sends some additional application events. Some events are actually triggered before the <code class="literal">ApplicationContext</code> is created.</p><p>You can register event listeners in a number of ways, the most common being <code class="literal">SpringApplication.addListeners(…)</code> method.</p><p>Application events are sent in the following order, as your application runs:</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">An <code class="literal">ApplicationStartedEvent</code> is sent at the start of a run, but before any processing except the registration of listeners and initializers.</li><li class="listitem">An <code class="literal">ApplicationEnvironmentPreparedEvent</code> is sent when the <code class="literal">Environment</code> to be used in the context is known, but before the context is created.</li><li class="listitem">An <code class="literal">ApplicationPreparedEvent</code> is sent just before the refresh is started, but after bean definitions have been loaded.</li><li class="listitem">An <code class="literal">ApplicationFailedEvent</code> is sent if there is an exception on startup.</li></ol></div><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>You often won’t need to use application events, but it can be handy to know that they exist. Internally, Spring Boot uses events to handle a variety of tasks.</p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boot-features-web-environment" href="#boot-features-web-environment"></a>22.5 Web environment</h2></div></div></div><p>A <code class="literal">SpringApplication</code> will attempt to create the right type of <code class="literal">ApplicationContext</code> on your behalf. By default, an <code class="literal">AnnotationConfigApplicationContext</code> or <code class="literal">AnnotationConfigEmbeddedWebApplicationContext</code> will be used, depending on whether you are developing a web application or not.</p><p>The algorithm used to determine a ‘web environment’ is fairly simplistic (based on the presence of a few classes). You can use <code class="literal">setWebEnvironment(boolean webEnvironment)</code> if you need to override the default.</p><p>It is also possible to take complete control of the <code class="literal">ApplicationContext</code> type that will be used by calling <code class="literal">setApplicationContextClass(…)</code>.</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>It is often desirable to call <code class="literal">setWebEnvironment(false)</code> when using <code class="literal">SpringApplication</code> within a JUnit test.</p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boot-features-command-line-runner" href="#boot-features-command-line-runner"></a>22.6 Using the CommandLineRunner</h2></div></div></div><p>If you want access to the raw command line arguments, or you need to run some specific code once the <code class="literal">SpringApplication</code> has started you can implement the <code class="literal">CommandLineRunner</code> interface. The <code class="literal">run(String… args)</code> method will be called on all Spring beans implementing this interface.</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.boot.* <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.stereotype.* <em><span class="hl-annotation" style="color: gray">@Component</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> MyBean <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">implements</span> CommandLineRunner { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">void</span> run(String... args) { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// Do something...</span> } }</pre><p>You can additionally implement the <code class="literal">org.springframework.core.Ordered</code> interface or use the <code class="literal">org.springframework.core.annotation.Order</code> annotation if several <code class="literal">CommandLineRunner</code> beans are defined that must be called in a specific order.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boot-features-application-exit" href="#boot-features-application-exit"></a>22.7 Application exit</h2></div></div></div><p>Each <code class="literal">SpringApplication</code> will register a shutdown hook with the JVM to ensure that the <code class="literal">ApplicationContext</code> is closed gracefully on exit. All the standard Spring lifecycle callbacks (such as the <code class="literal">DisposableBean</code> interface, or the <code class="literal">@PreDestroy</code> annotation) can be used.</p><p>In addition, beans may implement the <code class="literal">org.springframework.boot.ExitCodeGenerator</code> interface if they wish to return a specific exit code when the application ends.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="boot-features-external-config" href="#boot-features-external-config"></a>23. Externalized Configuration</h2></div></div></div><p>Spring Boot allows you to externalize your configuration so you can work with the same application code in different environments. You can use properties files, YAML files, environment variables and command-line arguments to externalize configuration. Property values can be injected directly into your beans using the <code class="literal">@Value</code> annotation, accessed via Spring’s <code class="literal">Environment</code> abstraction or bound to structured objects.</p><p>Spring Boot uses a very particular <code class="literal">PropertySource</code> order that is designed to allow sensible overriding of values, properties are considered in the the following order:</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">Command line arguments.</li><li class="listitem">JNDI attributes from <code class="literal">java:comp/env</code>.</li><li class="listitem">Java System properties (<code class="literal">System.getProperties()</code>).</li><li class="listitem">OS environment variables.</li><li class="listitem">A <code class="literal">RandomValuePropertySource</code> that only has properties in <code class="literal">random.*</code>.</li><li class="listitem"><a class="link" href="#boot-features-external-config-profile-specific-properties" title="23.4 Profile-specific properties">Profile-specific application properties</a> outside of your packaged jar (<code class="literal">application-{profile}.properties</code> and YAML variants)</li><li class="listitem"><a class="link" href="#boot-features-external-config-profile-specific-properties" title="23.4 Profile-specific properties">Profile-specific application properties</a> packaged inside your jar (<code class="literal">application-{profile}.properties</code> and YAML variants)</li><li class="listitem">Application properties outside of your packaged jar (<code class="literal">application.properties</code> and YAML variants).</li><li class="listitem">Application properties packaged inside your jar (<code class="literal">application.properties</code> and YAML variants).</li><li class="listitem"><code class="literal">@PropertySource</code> annotations on your <code class="literal">@Configuration</code> classes.</li><li class="listitem">Default properties (specified using <code class="literal">SpringApplication.setDefaultProperties</code>).</li></ol></div><p>To provide a concrete example, suppose you develop a <code class="literal">@Component</code> that uses a <code class="literal">name</code> property:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.stereotype.* <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.beans.factory.annotation.* <em><span class="hl-annotation" style="color: gray">@Component</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> MyBean { <em><span class="hl-annotation" style="color: gray">@Value("${name}")</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">private</span> String name; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// ...</span> }</pre><p>You can bundle an <code class="literal">application.properties</code> inside your jar that provides a sensible default <code class="literal">name</code>. When running in production, an <code class="literal">application.properties</code> can be provided outside of your jar that overrides <code class="literal">name</code>; and for one-off testing, you can launch with a specific command line switch (e.g. <code class="literal">java -jar app.jar --name="Spring"</code>).</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boot-features-external-config-random-values" href="#boot-features-external-config-random-values"></a>23.1 Configuring random values</h2></div></div></div><p>The <code class="literal">RandomValuePropertySource</code> is useful for injecting random values (e.g. into secrets or test cases). It can produce integers, longs or strings, e.g.</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">my.secret</span>=${random.value} <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">my.number</span>=${random.int} <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">my.bignumber</span>=${random.long} <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">my.number.less.than.ten</span>=${random.int(10)} <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">my.number.in.range</span>=${random.int[1024,65536]}</pre><p>The <code class="literal">random.int*</code> syntax is <code class="literal">OPEN value (,max) CLOSE</code> where the <code class="literal">OPEN,CLOSE</code> are any character and <code class="literal">value,max</code> are integers. If <code class="literal">max</code> is provided then <code class="literal">value</code> is the minimum value and <code class="literal">max</code> is the maximum (exclusive).</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boot-features-external-config-command-line-args" href="#boot-features-external-config-command-line-args"></a>23.2 Accessing command line properties</h2></div></div></div><p>By default <code class="literal">SpringApplication</code> will convert any command line option arguments (starting with ‘--’, e.g. <code class="literal">--server.port=9000</code>) to a <code class="literal">property</code> and add it to the Spring <code class="literal">Environment</code>. As mentioned above, command line properties always take precedence over other property sources.</p><p>If you don’t want command line properties to be added to the <code class="literal">Environment</code> you can disable them using <code class="literal">SpringApplication.setAddCommandLineProperties(false)</code>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boot-features-external-config-application-property-files" href="#boot-features-external-config-application-property-files"></a>23.3 Application property files</h2></div></div></div><p><code class="literal">SpringApplication</code> will load properties from <code class="literal">application.properties</code> files in the following locations and add them to the Spring <code class="literal">Environment</code>:</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">A <code class="literal">/config</code> subdir of the current directory.</li><li class="listitem">The current directory</li><li class="listitem">A classpath <code class="literal">/config</code> package</li><li class="listitem">The classpath root</li></ol></div><p>The list is ordered by precedence (locations higher in the list override lower items).</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>You can also <a class="link" href="#boot-features-external-config-yaml" title="23.6 Using YAML instead of Properties">use YAML ('.yml') files</a> as an alternative to '.properties'.</p></td></tr></tbody></table></div><p>If you don’t like <code class="literal">application.properties</code> as the configuration file name you can switch to another by specifying a <code class="literal">spring.config.name</code> environment property. You can also refer to an explicit location using the <code class="literal">spring.config.location</code> environment property (comma-separated list of directory locations, or file paths).</p><pre class="screen">$ java -jar myproject.jar --spring.config.name=myproject</pre><p>or</p><pre class="screen">$ java -jar myproject.jar --spring.config.location=classpath:/default.properties,classpath:/override.properties</pre><p>If <code class="literal">spring.config.location</code> contains directories (as opposed to files) they should end in <code class="literal">/</code> (and will be appended with the names generated from <code class="literal">spring.config.name</code> before being loaded). The default search path <code class="literal">classpath:,classpath:/config,file:,file:config/</code> is always used, irrespective of the value of <code class="literal">spring.config.location</code>. In that way you can set up default values for your application in <code class="literal">application.properties</code> (or whatever other basename you choose with <code class="literal">spring.config.name</code>) and override it at runtime with a different file, keeping the defaults.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>If you use environment variables rather than system properties, most operating systems disallow period-separated key names, but you can use underscores instead (e.g. <code class="literal">SPRING_CONFIG_NAME</code> instead of <code class="literal">spring.config.name</code>).</p></td></tr></tbody></table></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>If you are running in a container then JNDI properties (in <code class="literal">java:comp/env</code>) or servlet context initialization parameters can be used instead of, or as well as, environment variables or system properties.</p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boot-features-external-config-profile-specific-properties" href="#boot-features-external-config-profile-specific-properties"></a>23.4 Profile-specific properties</h2></div></div></div><p>In addition to <code class="literal">application.properties</code> files, profile-specific properties can also be defined using the naming convention <code class="literal">application-{profile}.properties</code>.</p><p>Profile specific properties are loaded from the same locations as standard <code class="literal">application.properties</code>, with profile-specific files always overriding the default ones irrespective of whether the profile-specific files are inside or outside your packaged jar.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boot-features-external-config-placeholders-in-properties" href="#boot-features-external-config-placeholders-in-properties"></a>23.5 Placeholders in properties</h2></div></div></div><p>The values in <code class="literal">application.properties</code> are filtered through the existing <code class="literal">Environment</code> when they are used so you can refer back to previously defined values (e.g. from System properties).</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">app.name</span>=MyApp <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">app.description</span>=${app.name} is a Spring Boot application</pre><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>You can also use this technique to create ‘short’ variants of existing Spring Boot properties. See the <span class="emphasis"><em><a class="xref" href="#howto-use-short-command-line-arguments" title="63.3 Use ‘short’ command line arguments">Section 63.3, “Use ‘short’ command line arguments”</a></em></span> how-to for details.</p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boot-features-external-config-yaml" href="#boot-features-external-config-yaml"></a>23.6 Using YAML instead of Properties</h2></div></div></div><p><a class="link" href="http://yaml.org/" target="_top">YAML</a> is a superset of JSON, and as such is a very convenient format for specifying hierarchical configuration data. The <code class="literal">SpringApplication</code> class will automatically support YAML as an alternative to properties whenever you have the <a class="link" href="http://code.google.com/p/snakeyaml/" target="_top">SnakeYAML</a> library on your classpath.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>If you use ‘starter POMs’ SnakeYAML will be automatically provided via <code class="literal">spring-boot-starter</code>.</p></td></tr></tbody></table></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-external-config-loading-yaml" href="#boot-features-external-config-loading-yaml"></a>23.6.1 Loading YAML</h3></div></div></div><p>Spring Framework provides two convenient classes that can be used to load YAML documents. The <code class="literal">YamlPropertiesFactoryBean</code> will load YAML as <code class="literal">Properties</code> and the <code class="literal">YamlMapFactoryBean</code> will load YAML as a <code class="literal">Map</code>.</p><p>For example, the following YAML document:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">environments</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> dev</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> url</span>: http://dev.bar.com <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> name</span>: Developer Setup <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> prod</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> url</span>: http://foo.bar.com <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> name</span>: My Cool App</pre><p>Would be transformed into these properties:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">environments.dev.url</span>=http://dev.bar.com <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">environments.dev.name</span>=Developer Setup <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">environments.prod.url</span>=http://foo.bar.com <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">environments.prod.name</span>=My Cool App</pre><p>YAML lists are represented as property keys with <code class="literal">[index]</code> dereferencers, for example this YAML:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">my</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> servers</span>: - dev.bar.com - foo.bar.com</pre><p>Would be transformed into these properties:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">my.servers[0]</span>=dev.bar.com <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">my.servers[1]</span>=foo.bar.com</pre><p>To bind to properties like that using the Spring <code class="literal">DataBinder</code> utilities (which is what <code class="literal">@ConfigurationProperties</code> does) you need to have a property in the target bean of type <code class="literal">java.util.List</code> (or <code class="literal">Set</code>) and you either need to provide a setter, or initialize it with a mutable value, e.g. this will bind to the properties above</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@ConfigurationProperties(prefix="my")</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> Config { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">private</span> List<String> servers = <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">new</span> ArrayList<String>(); <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> List<String> getServers() { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">return</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">this</span>.servers; } }</pre></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-external-config-exposing-yaml-to-spring" href="#boot-features-external-config-exposing-yaml-to-spring"></a>23.6.2 Exposing YAML as properties in the Spring Environment</h3></div></div></div><p>The <code class="literal">YamlPropertySourceLoader</code> class can be used to expose YAML as a <code class="literal">PropertySource</code> in the Spring <code class="literal">Environment</code>. This allows you to use the familiar <code class="literal">@Value</code> annotation with placeholders syntax to access YAML properties.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-external-config-multi-profile-yaml" href="#boot-features-external-config-multi-profile-yaml"></a>23.6.3 Multi-profile YAML documents</h3></div></div></div><p>You can specify multiple profile-specific YAML documents in a single file by using a <code class="literal">spring.profiles</code> key to indicate when the document applies. For example:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> address</span>: <span class="hl-number">192.168</span>.<span class="hl-number">1.100</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">---</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> profiles</span>: development <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> address</span>: <span class="hl-number">127.0</span>.<span class="hl-number">0.1</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">---</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> profiles</span>: production <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> address</span>: <span class="hl-number">192.168</span>.<span class="hl-number">1.120</span></pre><p>In the example above, the <code class="literal">server.address</code> property will be <code class="literal">127.0.0.1</code> if the <code class="literal">development</code> profile is active. If the <code class="literal">development</code> and <code class="literal">production</code> profiles are <span class="strong"><strong>not</strong></span> enabled, then the value for the property will be <code class="literal">192.168.1.100</code></p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-external-config-yaml-shortcomings" href="#boot-features-external-config-yaml-shortcomings"></a>23.6.4 YAML shortcomings</h3></div></div></div><p>YAML files can’t be loaded via the <code class="literal">@PropertySource</code> annotation. So in the case that you need to load values that way, you need to use a properties file.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boot-features-external-config-typesafe-configuration-properties" href="#boot-features-external-config-typesafe-configuration-properties"></a>23.7 Typesafe Configuration Properties</h2></div></div></div><p>Using the <code class="literal">@Value("${property}")</code> annotation to inject configuration properties can sometimes be cumbersome, especially if you are working with multiple properties or your data is hierarchical in nature. Spring Boot provides an alternative method of working with properties that allows strongly typed beans to govern and validate the configuration of your application. For example:</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@Component</span></em> <em><span class="hl-annotation" style="color: gray">@ConfigurationProperties(prefix="connection")</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> ConnectionSettings { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">private</span> String username; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">private</span> InetAddress remoteAddress; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// ... getters and setters</span> }</pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>The getters and setters are advisable, since binding is via standard Java Beans property descriptors, just like in Spring MVC. They are mandatory for immutable types or those that are directly coercible from <code class="literal">String</code>. As long as they are initialized, maps, collections, and arrays need a getter but not necessarily a setter since they can be mutated by the binder. If there is a setter, Maps, collections, and arrays can be created. Maps and collections can be expanded with only a getter, whereas arrays require a setter. Nested POJO properties can also be created (so a setter is not mandatory) if they have a default constructor, or a constructor accepting a single value that can be coerced from String. Some people use Project Lombok to add getters and setters automatically.</p></td></tr></tbody></table></div><p>When the <code class="literal">@EnableConfigurationProperties</code> annotation is applied to your <code class="literal">@Configuration</code>, any beans annotated with <code class="literal">@ConfigurationProperties</code> will be automatically configured from the <code class="literal">Environment</code> properties. This style of configuration works particularly well with the <code class="literal">SpringApplication</code> external YAML configuration:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># application.yml</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">connection</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> username</span>: admin <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> remoteAddress</span>: <span class="hl-number">192.168</span>.<span class="hl-number">1.1</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># additional configuration as required</span></pre><p>To work with <code class="literal">@ConfigurationProperties</code> beans you can just inject them in the same way as any other bean.</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@Service</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> MyService { <em><span class="hl-annotation" style="color: gray">@Autowired</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">private</span> ConnectionSettings connection; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">//...</span> <em><span class="hl-annotation" style="color: gray">@PostConstruct</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">void</span> openConnection() { Server server = <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">new</span> Server(); <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">this</span>.connection.configure(server); } }</pre><p>It is also possible to shortcut the registration of <code class="literal">@ConfigurationProperties</code> bean definitions by simply listing the properties classes directly in the <code class="literal">@EnableConfigurationProperties</code> annotation:</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@Configuration</span></em> <em><span class="hl-annotation" style="color: gray">@EnableConfigurationProperties(ConnectionSettings.class)</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> MyConfiguration { }</pre><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>Using <code class="literal">@ConfigurationProperties</code> also allows you to generate meta-data files that can be used by IDEs. See the <a class="xref" href="#configuration-metadata" title="Appendix B. Configuration meta-data">Appendix B, <i>Configuration meta-data</i></a> appendix for details.</p></td></tr></tbody></table></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-external-config-3rd-party-configuration" href="#boot-features-external-config-3rd-party-configuration"></a>23.7.1 Third-party configuration</h3></div></div></div><p>As well as using <code class="literal">@ConfigurationProperties</code> to annotate a class, you can also use it on <code class="literal">@Bean</code> methods. This can be particularly useful when you want to bind properties to third-party components that are outside of your control.</p><p>To configure a bean from the <code class="literal">Environment</code> properties, add <code class="literal">@ConfigurationProperties</code> to its bean registration:</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@ConfigurationProperties(prefix = "foo")</span></em> <em><span class="hl-annotation" style="color: gray">@Bean</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> FooComponent fooComponent() { ... }</pre><p>Any property defined with the <code class="literal">foo</code> prefix will be mapped onto that <code class="literal">FooComponent</code> bean in a similar manner as the <code class="literal">ConnectionSettings</code> example above.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-external-config-relaxed-binding" href="#boot-features-external-config-relaxed-binding"></a>23.7.2 Relaxed binding</h3></div></div></div><p>Spring Boot uses some relaxed rules for binding <code class="literal">Environment</code> properties to <code class="literal">@ConfigurationProperties</code> beans, so there doesn’t need to be an exact match between the <code class="literal">Environment</code> property name and the bean property name. Common examples where this is useful include dashed separated (e.g. <code class="literal">context-path</code> binds to <code class="literal">contextPath</code>), and capitalized (e.g. <code class="literal">PORT</code> binds to <code class="literal">port</code>) environment properties.</p><p>For example, given the following <code class="literal">@ConfigurationProperties</code> class:</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@Component</span></em> <em><span class="hl-annotation" style="color: gray">@ConfigurationProperties(prefix="person")</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> ConnectionSettings { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">private</span> String firstName; }</pre><p>The following properties names can all be used:</p><div class="table"><a name="d0e3173" href="#d0e3173"></a><p class="title"><b>Table 23.1. relaxed binding</b></p><div class="table-contents"><table summary="relaxed binding" style="border-collapse: collapse;border-top: 0.5pt solid ; border-bottom: 0.5pt solid ; border-left: 0.5pt solid ; border-right: 0.5pt solid ; "><colgroup><col class="col_1"><col class="col_2"></colgroup><thead><tr><th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top">Property</th><th style="border-bottom: 0.5pt solid ; " align="left" valign="top">Note</th></tr></thead><tbody><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">person.firstName</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Standard camel case syntax.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">person.first-name</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Dashed notation, recommended for use in <code class="literal">.properties</code> and <code class="literal">.yml</code> files.</p></td></tr><tr><td style="border-right: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">PERSON_FIRST_NAME</code></p></td><td style="" align="left" valign="top"><p>Upper case format. Recommended when using a system environment variables.</p></td></tr></tbody></table></div></div><br class="table-break"><p>Spring will attempt to coerce the external application properties to the right type when it binds to the <code class="literal">@ConfigurationProperties</code> beans. If you need custom type conversion you can provide a <code class="literal">ConversionService</code> bean (with bean id <code class="literal">conversionService</code>) or custom property editors (via a <code class="literal">CustomEditorConfigurer</code> bean).</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-external-config-validation" href="#boot-features-external-config-validation"></a>23.7.3 @ConfigurationProperties Validation</h3></div></div></div><p>Spring Boot will attempt to validate external configuration, by default using JSR-303 (if it is on the classpath). You can simply add JSR-303 <code class="literal">javax.validation</code> constraint annotations to your <code class="literal">@ConfigurationProperties</code> class:</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@Component</span></em> <em><span class="hl-annotation" style="color: gray">@ConfigurationProperties(prefix="connection")</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> ConnectionSettings { <em><span class="hl-annotation" style="color: gray">@NotNull</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">private</span> InetAddress remoteAddress; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// ... getters and setters</span> }</pre><p>You can also add a custom Spring <code class="literal">Validator</code> by creating a bean definition called <code class="literal">configurationPropertiesValidator</code>.</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>The <code class="literal">spring-boot-actuator</code> module includes an endpoint that exposes all <code class="literal">@ConfigurationProperties</code> beans. Simply point your web browser to <code class="literal">/configprops</code> or use the equivalent JMX endpoint. See the <span class="emphasis"><em><a class="link" href="#production-ready-endpoints" title="40. Endpoints">Production ready features</a></em></span>. section for details.</p></td></tr></tbody></table></div></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="boot-features-profiles" href="#boot-features-profiles"></a>24. Profiles</h2></div></div></div><p>Spring Profiles provide a way to segregate parts of your application configuration and make it only available in certain environments. Any <code class="literal">@Component</code> or <code class="literal">@Configuration</code> can be marked with <code class="literal">@Profile</code> to limit when it is loaded:</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@Configuration</span></em> <em><span class="hl-annotation" style="color: gray">@Profile("production")</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> ProductionConfiguration { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// ...</span> }</pre><p>In the normal Spring way, you can use a <code class="literal">spring.profiles.active</code> <code class="literal">Environment</code> property to specify which profiles are active. You can specify the property in any of the usual ways, for example you could include it in your <code class="literal">application.properties</code>:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.profiles.active</span>=dev,hsqldb</pre><p>or specify on the command line using the switch <code class="literal">--spring.profiles.active=dev,hsqldb</code>.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boot-features-adding-active-profiles" href="#boot-features-adding-active-profiles"></a>24.1 Adding active profiles</h2></div></div></div><p>The <code class="literal">spring.profiles.active</code> property follows the same ordering rules as other properties, the highest <code class="literal">PropertySource</code> will win. This means that you can specify active profiles in <code class="literal">application.properties</code> then <span class="strong"><strong>replace</strong></span> them using the command line switch.</p><p>Sometimes it is useful to have profile specific properties that <span class="strong"><strong>add</strong></span> to the active profiles rather than replace them. The <code class="literal">spring.profiles.include</code> property can be used to unconditionally add active profiles. The <code class="literal">SpringApplication</code> entry point also has a Java API for setting additional profiles (i.e. on top of those activated by the <code class="literal">spring.profiles.active</code> property): see the <code class="literal">setAdditionalProfiles()</code> method.</p><p>For example, when an application with following properties is run using the switch <code class="literal">--spring.profiles.active=prod</code> the <code class="literal">proddb</code> and <code class="literal">prodmq</code> profiles will also be activated:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">---</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">my.property</span>: fromyamlfile <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">---</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.profiles</span>: prod <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.profiles.include</span>: proddb,prodmq</pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>Remember that the <code class="literal">spring.profiles</code> property can be defined in a YAML document to determine when this particular document is included in the configuration. See <a class="xref" href="#howto-change-configuration-depending-on-the-environment" title="63.6 Change configuration depending on the environment">Section 63.6, “Change configuration depending on the environment”</a> for more details.</p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boot-features-programmatically-setting-profiles" href="#boot-features-programmatically-setting-profiles"></a>24.2 Programmatically setting profiles</h2></div></div></div><p>You can programmatically set active profiles by calling <code class="literal">SpringApplication.setAdditionalProfiles(…)</code> before your application runs. It is also possible to activate profiles using Spring’s <code class="literal">ConfigurableEnvironment</code> interface.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boot-features-profile-specific-configuration" href="#boot-features-profile-specific-configuration"></a>24.3 Profile specific configuration files</h2></div></div></div><p>Profile specific variants of both <code class="literal">application.properties</code> (or <code class="literal">application.yml</code>) and files referenced via <code class="literal">@ConfigurationProperties</code> are considered as files are loaded. See <span class="emphasis"><em><a class="xref" href="#boot-features-external-config-profile-specific-properties" title="23.4 Profile-specific properties">Section 23.4, “Profile-specific properties”</a></em></span> for details.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="boot-features-logging" href="#boot-features-logging"></a>25. Logging</h2></div></div></div><p>Spring Boot uses <a class="link" href="http://commons.apache.org/logging" target="_top">Commons Logging</a> for all internal logging, but leaves the underlying log implementation open. Default configurations are provided for <a class="link" href="http://docs.oracle.com/javase/7/docs/api/java/util/logging/package-summary.html" target="_top">Java Util Logging</a>, <a class="link" href="http://logging.apache.org/log4j/" target="_top">Log4J</a>, <a class="link" href="http://logging.apache.org/log4j/2.x/" target="_top">Log4J2</a> and <a class="link" href="http://logback.qos.ch/" target="_top">Logback</a>. In each case loggers are pre-configured to use console output with optional file output also available.</p><p>By default, If you use the ‘Starter POMs’, Logback will be used for logging. Appropriate Logback routing is also included to ensure that dependent libraries that use Java Util Logging, Commons Logging, Log4J or SLF4J will all work correctly.</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>There are a lot of logging frameworks available for Java. Don’t worry if the above list seems confusing. Generally you won’t need to change your logging dependencies and the Spring Boot defaults will work just fine.</p></td></tr></tbody></table></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boot-features-logging-format" href="#boot-features-logging-format"></a>25.1 Log format</h2></div></div></div><p>The default log output from Spring Boot looks like this:</p><pre class="screen">2014-03-05 10:57:51.112 INFO 45469 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/7.0.52 2014-03-05 10:57:51.253 INFO 45469 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2014-03-05 10:57:51.253 INFO 45469 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1358 ms 2014-03-05 10:57:51.698 INFO 45469 --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/] 2014-03-05 10:57:51.702 INFO 45469 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]</pre><p>The following items are output:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Date and Time — Millisecond precision and easily sortable.</li><li class="listitem">Log Level — <code class="literal">ERROR</code>, <code class="literal">WARN</code>, <code class="literal">INFO</code>, <code class="literal">DEBUG</code> or <code class="literal">TRACE</code>.</li><li class="listitem">Process ID.</li><li class="listitem">A <code class="literal">---</code> separator to distinguish the start of actual log messages.</li><li class="listitem">Thread name — Enclosed in square brackets (may be truncated for console output).</li><li class="listitem">Logger name — This is usually the source class name (often abbreviated).</li><li class="listitem">The log message.</li></ul></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boot-features-logging-console-output" href="#boot-features-logging-console-output"></a>25.2 Console output</h2></div></div></div><p>The default log configuration will echo messages to the console as they are written. By default <code class="literal">ERROR</code>, <code class="literal">WARN</code> and <code class="literal">INFO</code> level messages are logged. To also log <code class="literal">DEBUG</code> level messages to the console you can start your application with a <code class="literal">--debug</code> flag.</p><pre class="screen">$ java -jar myapp.jar --debug</pre><p>If your terminal supports ANSI, color output will be used to aid readability. You can set <code class="literal">spring.output.ansi.enabled</code> to a <a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/ansi/AnsiOutput.Enabled.html" target="_top">supported value</a> to override the auto detection.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boot-features-logging-file-output" href="#boot-features-logging-file-output"></a>25.3 File output</h2></div></div></div><p>By default, Spring Boot will only log to the console and will not write log files. If you want to write log files in addition to the console output you need to set a <code class="literal">logging.file</code> or <code class="literal">logging.path</code> property (for example in your <code class="literal">application.properties</code>).</p><p>The following table shows how the <code class="literal">logging.*</code> properties can be used together:</p><div class="table"><a name="d0e3507" href="#d0e3507"></a><p class="title"><b>Table 25.1. Logging properties</b></p><div class="table-contents"><table summary="Logging properties" style="border-collapse: collapse;border-top: 0.5pt solid ; border-bottom: 0.5pt solid ; border-left: 0.5pt solid ; border-right: 0.5pt solid ; "><colgroup><col class="col_1"><col class="col_2"><col class="col_3"><col class="col_4"></colgroup><tbody><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">logging.file</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">logging.path</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Example</p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Description</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><span class="emphasis"><em>(none)</em></span></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><span class="emphasis"><em>(none)</em></span></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"> </td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Console only logging.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Specific file</p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><span class="emphasis"><em>(none)</em></span></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">my.log</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Writes to the specified log file. Names can be an exact location or relative to the current directory.</p></td></tr><tr><td style="border-right: 0.5pt solid ; " align="left" valign="top"><p><span class="emphasis"><em>(none)</em></span></p></td><td style="border-right: 0.5pt solid ; " align="left" valign="top"><p>Specific folder</p></td><td style="border-right: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">/var/log</code></p></td><td style="" align="left" valign="top"><p>Writes <code class="literal">spring.log</code> the specified folder. Names can be an exact location or relative to the current directory.</p></td></tr></tbody></table></div></div><br class="table-break"><p>Log files will rotate when they reach 10 Mb and as with console output, <code class="literal">ERROR</code>, <code class="literal">WARN</code> and <code class="literal">INFO</code> level messages are logged by default.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boot-features-custom-log-levels" href="#boot-features-custom-log-levels"></a>25.4 Log Levels</h2></div></div></div><p>All the supported logging systems can have the logger levels set in the Spring <code class="literal">Environment</code> (so for example in <code class="literal">application.properties</code>) using ‘logging.level.*=LEVEL’ where ‘LEVEL’ is one of TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF. Example <code class="literal">application.properties</code>:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">logging.level.org.springframework.web</span>: DEBUG <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">logging.level.org.hibernate</span>: ERROR</pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>By default Spring Boot remaps Thymeleaf <code class="literal">INFO</code> messages so that they are logged at <code class="literal">DEBUG</code> level. This helps to reduce noise in the standard log output. See <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot/src/main/java/org/springframework/boot/logging/logback/LevelRemappingAppender.java" target="_top"><code class="literal">LevelRemappingAppender</code></a> for details of how you can apply remapping in your own configuration.</p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boot-features-custom-log-configuration" href="#boot-features-custom-log-configuration"></a>25.5 Custom log configuration</h2></div></div></div><p>The various logging systems can be activated by including the appropriate libraries on the classpath, and further customized by providing a suitable configuration file in the root of the classpath, or in a location specified by the Spring <code class="literal">Environment</code> property <code class="literal">logging.config</code>. (Note however that since logging is initialized <span class="strong"><strong>before</strong></span> the <code class="literal">ApplicationContext</code> is created, it isn’t possible to control logging from <code class="literal">@PropertySources</code> in Spring <code class="literal">@Configuration</code> files. System properties and the conventional Spring Boot external configuration files work just fine.)</p><p>Depending on your logging system, the following files will be loaded:</p><div class="informaltable"><table style="border-collapse: collapse;border-top: 0.5pt solid ; border-bottom: 0.5pt solid ; border-left: 0.5pt solid ; border-right: 0.5pt solid ; "><colgroup><col class="col_1"><col class="col_2"></colgroup><thead><tr><th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top">Logging System</th><th style="border-bottom: 0.5pt solid ; " align="left" valign="top">Customization</th></tr></thead><tbody><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Logback</p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">logback.xml</code> or <code class="literal">logback.groovy</code></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Log4j</p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">log4j.properties</code> or <code class="literal">log4j.xml</code></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Log4j2</p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">log4j2.xml</code></p></td></tr><tr><td style="border-right: 0.5pt solid ; " align="left" valign="top"><p>JDK (Java Util Logging)</p></td><td style="" align="left" valign="top"><p><code class="literal">logging.properties</code></p></td></tr></tbody></table></div><p>To help with the customization some other properties are transferred from the Spring <code class="literal">Environment</code> to System properties:</p><div class="informaltable"><table style="border-collapse: collapse;border-top: 0.5pt solid ; border-bottom: 0.5pt solid ; border-left: 0.5pt solid ; border-right: 0.5pt solid ; "><colgroup><col class="col_1"><col class="col_2"><col class="col_3"></colgroup><thead><tr><th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top">Spring Environment</th><th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top">System Property</th><th style="border-bottom: 0.5pt solid ; " align="left" valign="top">Comments</th></tr></thead><tbody><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">logging.file</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">LOG_FILE</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Used in default log configuration if defined.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">logging.path</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">LOG_PATH</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Used in default log configuration if defined.</p></td></tr><tr><td style="border-right: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">PID</code></p></td><td style="border-right: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">PID</code></p></td><td style="" align="left" valign="top"><p>The current process ID (discovered if possible and when not already defined as an OS environment variable).</p></td></tr></tbody></table></div><p>All the logging systems supported can consult System properties when parsing their configuration files. See the default configurations in <code class="literal">spring-boot.jar</code> for examples.</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Warning" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="Spring%20Boot%20Reference%20Guide_files/warning.png"></td><th align="left">Warning</th></tr><tr><td align="left" valign="top"><p>There are known classloading issues with Java Util Logging that cause problems when running from an ‘executable jar’. We recommend that you avoid it if at all possible.</p></td></tr></tbody></table></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="boot-features-developing-web-applications" href="#boot-features-developing-web-applications"></a>26. Developing web applications</h2></div></div></div><p>Spring Boot is well suited for web application development. You can easily create a self-contained HTTP server using embedded Tomcat, Jetty, or Undertow. Most web applications will use the <code class="literal">spring-boot-starter-web</code> module to get up and running quickly.</p><p>If you haven’t yet developed a Spring Boot web application you can follow the "Hello World!" example in the <span class="emphasis"><em><a class="link" href="#getting-started-first-application" title="11. Developing your first Spring Boot application">Getting started</a></em></span> section.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boot-features-spring-mvc" href="#boot-features-spring-mvc"></a>26.1 The ‘Spring Web MVC framework’</h2></div></div></div><p>The Spring Web MVC framework (often referred to as simply ‘Spring MVC’) is a rich ‘model view controller’ web framework. Spring MVC lets you create special <code class="literal">@Controller</code> or <code class="literal">@RestController</code> beans to handle incoming HTTP requests. Methods in your controller are mapped to HTTP using <code class="literal">@RequestMapping</code> annotations.</p><p>Here is a typical example <code class="literal">@RestController</code> to serve JSON data:</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@RestController</span></em> <em><span class="hl-annotation" style="color: gray">@RequestMapping(value="/users")</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> MyRestController { <em><span class="hl-annotation" style="color: gray">@RequestMapping(value="/{user}", method=RequestMethod.GET)</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> User getUser(<em><span class="hl-annotation" style="color: gray">@PathVariable</span></em> Long user) { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// ...</span> } <em><span class="hl-annotation" style="color: gray">@RequestMapping(value="/{user}/customers", method=RequestMethod.GET)</span></em> List<Customer> getUserCustomers(<em><span class="hl-annotation" style="color: gray">@PathVariable</span></em> Long user) { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// ...</span> } <em><span class="hl-annotation" style="color: gray">@RequestMapping(value="/{user}", method=RequestMethod.DELETE)</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> User deleteUser(<em><span class="hl-annotation" style="color: gray">@PathVariable</span></em> Long user) { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// ...</span> } }</pre><p>Spring MVC is part of the core Spring Framework and detailed information is available in the <a class="link" href="http://docs.spring.io/spring/docs/4.1.5.RELEASE/spring-framework-reference/htmlsingle#mvc" target="_top">reference documentation</a>. There are also several guides available at <a class="link" href="http://spring.io/guides" target="_top">spring.io/guides</a> that cover Spring MVC.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-spring-mvc-auto-configuration" href="#boot-features-spring-mvc-auto-configuration"></a>26.1.1 Spring MVC auto-configuration</h3></div></div></div><p>Spring Boot provides auto-configuration for Spring MVC that works well with most applications.</p><p>The auto-configuration adds the following features on top of Spring’s defaults:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Inclusion of <code class="literal">ContentNegotiatingViewResolver</code> and <code class="literal">BeanNameViewResolver</code> beans.</li><li class="listitem">Support for serving static resources, including support for WebJars (see below).</li><li class="listitem">Automatic registration of <code class="literal">Converter</code>, <code class="literal">GenericConverter</code>, <code class="literal">Formatter</code> beans.</li><li class="listitem">Support for <code class="literal">HttpMessageConverters</code> (see below).</li><li class="listitem">Automatic registration of <code class="literal">MessageCodesResolver</code> (see below).</li><li class="listitem">Static <code class="literal">index.html</code> support.</li><li class="listitem">Custom <code class="literal">Favicon</code> support.</li></ul></div><p>If you want to take complete control of Spring MVC, you can add your own <code class="literal">@Configuration</code> annotated with <code class="literal">@EnableWebMvc</code>. If you want to keep Spring Boot MVC features, and you just want to add additional <a class="link" href="http://docs.spring.io/spring/docs/4.1.5.RELEASE/spring-framework-reference/htmlsingle#mvc" target="_top">MVC configuration</a> (interceptors, formatters, view controllers etc.) you can add your own <code class="literal">@Bean</code> of type <code class="literal">WebMvcConfigurerAdapter</code>, but <span class="strong"><strong>without</strong></span> <code class="literal">@EnableWebMvc</code>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-spring-mvc-message-converters" href="#boot-features-spring-mvc-message-converters"></a>26.1.2 HttpMessageConverters</h3></div></div></div><p>Spring MVC uses the <code class="literal">HttpMessageConverter</code> interface to convert HTTP requests and responses. Sensible defaults are included out of the box, for example Objects can be automatically converted to JSON (using the Jackson library) or XML (using the Jackson XML extension if available, else using JAXB). Strings are encoded using <code class="literal">UTF-8</code> by default.</p><p>If you need to add or customize converters you can use Spring Boot’s <code class="literal">HttpMessageConverters</code> class:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.boot.autoconfigure.web.HttpMessageConverters; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.context.annotation.*; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.http.converter.*; <em><span class="hl-annotation" style="color: gray">@Configuration</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> MyConfiguration { <em><span class="hl-annotation" style="color: gray">@Bean</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> HttpMessageConverters customConverters() { HttpMessageConverter<?> additional = ... HttpMessageConverter<?> another = ... <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">return</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">new</span> HttpMessageConverters(additional, another); } }</pre><p>Any <code class="literal">HttpMessageConverter</code> bean that is present in the context will be added to the list of converters. You can also override default converters that way.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-spring-message-codes" href="#boot-features-spring-message-codes"></a>26.1.3 MessageCodesResolver</h3></div></div></div><p>Spring MVC has a strategy for generating error codes for rendering error messages from binding errors: <code class="literal">MessageCodesResolver</code>. Spring Boot will create one for you if you set the <code class="literal">spring.mvc.message-codes-resolver.format</code> property <code class="literal">PREFIX_ERROR_CODE</code> or <code class="literal">POSTFIX_ERROR_CODE</code> (see the enumeration in <code class="literal">DefaultMessageCodesResolver.Format</code>).</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-spring-mvc-static-content" href="#boot-features-spring-mvc-static-content"></a>26.1.4 Static Content</h3></div></div></div><p>By default Spring Boot will serve static content from a folder called <code class="literal">/static</code> (or <code class="literal">/public</code> or <code class="literal">/resources</code> or <code class="literal">/META-INF/resources</code>) in the classpath or from the root of the <code class="literal">ServletContext</code>. It uses the <code class="literal">ResourceHttpRequestHandler</code> from Spring MVC so you can modify that behavior by adding your own <code class="literal">WebMvcConfigurerAdapter</code> and overriding the <code class="literal">addResourceHandlers</code> method.</p><p>In a stand-alone web application the default servlet from the container is also enabled, and acts as a fallback, serving content from the root of the <code class="literal">ServletContext</code> if Spring decides not to handle it. Most of the time this will not happen (unless you modify the default MVC configuration) because Spring will always be able to handle requests through the <code class="literal">DispatcherServlet</code>.</p><p>In addition to the ‘standard’ static resource locations above, a special case is made for <a class="link" href="http://www.webjars.org/" target="_top">Webjars content</a>. Any resources with a path in <code class="literal">/webjars/**</code> will be served from jar files if they are packaged in the Webjars format.</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>Do not use the <code class="literal">src/main/webapp</code> folder if your application will be packaged as a jar. Although this folder is a common standard, it will <span class="strong"><strong>only</strong></span> work with war packaging and it will be silently ignored by most build tools if you generate a jar.</p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-spring-mvc-template-engines" href="#boot-features-spring-mvc-template-engines"></a>26.1.5 Template engines</h3></div></div></div><p>As well as REST web services, you can also use Spring MVC to serve dynamic HTML content. Spring MVC supports a variety of templating technologies including Velocity, FreeMarker and JSPs. Many other templating engines also ship their own Spring MVC integrations.</p><p>Spring Boot includes auto-configuration support for the following templating engines:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="link" href="http://freemarker.org/docs/" target="_top">FreeMarker</a></li><li class="listitem"><a class="link" href="http://beta.groovy-lang.org/docs/groovy-2.3.0/html/documentation/markup-template-engine.html" target="_top">Groovy</a></li><li class="listitem"><a class="link" href="http://www.thymeleaf.org/" target="_top">Thymeleaf</a></li><li class="listitem"><a class="link" href="http://velocity.apache.org/" target="_top">Velocity</a></li></ul></div><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>JSPs should be avoided if possible, there are several <a class="link" href="#boot-features-jsp-limitations" title="26.3.4 JSP limitations">known limitations</a> when using them with embedded servlet containers.</p></td></tr></tbody></table></div><p>When you’re using one of these templating engines with the default configuration, your templates will be picked up automatically from <code class="literal">src/main/resources/templates</code>.</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>IntelliJ IDEA orders the classpath differently depending on how you run your application. Running your application in the IDE via its main method will result in a different ordering to when you run your application using Maven or Gradle or from its pacakaged jar. This can cause Spring Boot to fail to find the templates on the classpath. If you’re affected by this problem you can reorder the classpath in the IDE to place the module’s classes and resources first. Alternatively, you can configure the template prefix to search every templates directory on the classpath: <code class="literal">classpath*:/templates/</code>.</p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-error-handling" href="#boot-features-error-handling"></a>26.1.6 Error Handling</h3></div></div></div><p>Spring Boot provides an <code class="literal">/error</code> mapping by default that handles all errors in a sensible way, and it is registered as a ‘global’ error page in the servlet container. For machine clients it will produce a JSON response with details of the error, the HTTP status and the exception message. For browser clients there is a ‘whitelabel’ error view that renders the same data in HTML format (to customize it just add a <code class="literal">View</code> that resolves to ‘error’). To replace the default behaviour completely you can implement <code class="literal">ErrorController</code> and register a bean definition of that type, or simply add a bean of type <code class="literal">ErrorAttributes</code> to use the existing mechanism but replace the contents.</p><p>If you want more specific error pages for some conditions, the embedded servlet containers support a uniform Java DSL for customizing the error handling. For example:</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@Bean</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> EmbeddedServletContainerCustomizer containerCustomizer(){ <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">return</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">new</span> MyCustomizer(); } <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// ...</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">private</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">static</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> MyCustomizer <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">implements</span> EmbeddedServletContainerCustomizer { <em><span class="hl-annotation" style="color: gray">@Override</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">void</span> customize(ConfigurableEmbeddedServletContainer container) { container.addErrorPages(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">new</span> ErrorPage(HttpStatus.BAD_REQUEST, <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"/400"</span>)); } }</pre><p>You can also use regular Spring MVC features like <a class="link" href="http://docs.spring.io/spring/docs/4.1.5.RELEASE/spring-framework-reference/htmlsingle/#mvc-exceptionhandlers" target="_top"><code class="literal">@ExceptionHandler</code> methods</a> and <a class="link" href="http://docs.spring.io/spring/docs/4.1.5.RELEASE/spring-framework-reference/htmlsingle/#mvc-ann-controller-advice" target="_top"><code class="literal">@ControllerAdvice</code></a>. The <code class="literal">ErrorController</code> will then pick up any unhandled exceptions.</p><p>N.B. if you register an <code class="literal">ErrorPage</code> with a path that will end up being handled by a <code class="literal">Filter</code> (e.g. as is common with some non-Spring web frameworks, like Jersey and Wicket), then the <code class="literal">Filter</code> has to be explicitly registered as an <code class="literal">ERROR</code> dispatcher, e.g.</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@Bean</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> FilterRegistrationBean myFilter() { FilterRegistrationBean registration = <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">new</span> FilterRegistrationBean(); registration.setFilter(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">new</span> MyFilter()); ... registration.setDispatcherTypes(EnumSet.allOf(DispatcherType.<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span>)); <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">return</span> registration; }</pre><p>(the default <code class="literal">FilterRegistrationBean</code> does not include the <code class="literal">ERROR</code> dispatcher type).</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="boot-features-error-handling-websphere" href="#boot-features-error-handling-websphere"></a>Error Handling on WebSphere Application Server</h4></div></div></div><p>When deployed to a servlet container, a Spring Boot uses its error page filter to forward a request with an error status to the appropriate error page. The request can only be forwarded to the correct error page if the response has not already been committed. By default, WebSphere Application Server 8.0 and later commits the response upon successful completion of a servlet’s service method. You should disable this behaviour by setting <code class="literal">com.ibm.ws.webcontainer.invokeFlushAfterService</code> to <code class="literal">false</code></p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-spring-hateoas" href="#boot-features-spring-hateoas"></a>26.1.7 Spring HATEOAS</h3></div></div></div><p>If you’re developing a RESTful API that makes use of hypermedia, Spring Boot provides auto-configuration for Spring HATEOAS that works well with most applications. The auto-configuration replaces the need to use <code class="literal">@EnableHypermediaSupport</code> and registers a number of beans to ease building hypermedia-based applications including a <code class="literal">LinkDiscoverer</code> and an <code class="literal">ObjectMapper</code> configured to correctly marshal responses into the desired representation. The <code class="literal">ObjectMapper</code> will be customized based on the <code class="literal">spring.jackson.*</code> properties or a <code class="literal">Jackson2ObjectMapperBuilder</code> bean if one exists.</p><p>You can take control of Spring HATEOAS’s configuration by using <code class="literal">@EnableHypermediaSupport</code>. Note that this will disable the <code class="literal">ObjectMapper</code> customization described above.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boot-features-jersey" href="#boot-features-jersey"></a>26.2 JAX-RS and Jersey</h2></div></div></div><p>If you prefer the JAX-RS programming model for REST endpoints you can use one of the available implementations instead of Spring MVC. Jersey 1.x and Apache Celtix work quite well out of the box if you just register their <code class="literal">Servlet</code> or <code class="literal">Filter</code> as a <code class="literal">@Bean</code> in your application context. Jersey 2.x has some native Spring support so we also provide auto-configuration support for it in Spring Boot together with a starter.</p><p>To get started with Jersey 2.x just include the <code class="literal">spring-boot-starter-jersey</code> as a dependency and then you need one <code class="literal">@Bean</code> of type <code class="literal">ResourceConfig</code> in which you register all the endpoints:</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@Component</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> JerseyConfig <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">extends</span> ResourceConfig { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> JerseyConfig() { register(Endpoint.<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span>); } }</pre><p>All the registered endpoints should be <code class="literal">@Components</code> with HTTP resource annotations (<code class="literal">@GET</code> etc.), e.g.</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@Component</span></em> <em><span class="hl-annotation" style="color: gray">@Path("/hello")</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> Endpoint { <em><span class="hl-annotation" style="color: gray">@GET</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> String message() { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">return</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"Hello"</span>; } }</pre><p>Since the <code class="literal">Endpoint</code> is a Spring <code class="literal">@Component</code> its lifecycle is managed by Spring and you can <code class="literal">@Autowired</code> dependencies and inject external configuration with <code class="literal">@Value</code>. The Jersey servlet will be registered and mapped to <code class="literal">/*</code> by default. You can change the mapping by adding <code class="literal">@ApplicationPath</code> to your <code class="literal">ResourceConfig</code>.</p><p>By default Jersey will be set up as a Servlet in a <code class="literal">@Bean</code> of type <code class="literal">ServletRegistrationBean</code> named <code class="literal">jerseyServletRegistration</code>. You can disable or override that bean by creating one of your own with the same name. You can also use a Filter instead of a Servlet by setting <code class="literal">spring.jersey.type=filter</code> (in which case the <code class="literal">@Bean</code> to replace or override is <code class="literal">jerseyFilterRegistration</code>). The servlet has an <code class="literal">@Order</code> which you can set with <code class="literal">spring.jersey.filter.order</code>. Both the Servlet and the Filter registrations can be given init parameters using <code class="literal">spring.jersey.init.*</code> to specify a map of properties.</p><p>There is a <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-samples/spring-boot-sample-jersey" target="_top">Jersey sample</a> so you can see how to set things up. There is also a <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-samples/spring-boot-sample-jersey1" target="_top">Jersey 1.x sample</a>. Note that in the Jersey 1.x sample that the spring-boot maven plugin has been configured to unpack some Jersey jars so they can be scanned by the JAX-RS implementation (because the sample asks for them to be scanned in its <code class="literal">Filter</code> registration). You may need to do the same if any of your JAX-RS resources are packages as nested jars.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boot-features-embedded-container" href="#boot-features-embedded-container"></a>26.3 Embedded servlet container support</h2></div></div></div><p>Spring Boot includes support for embedded Tomcat, Jetty, and Undertow servers. Most developers will simply use the appropriate ‘Starter POM’ to obtain a fully configured instance. By default the embedded server will listen for HTTP requests on port <code class="literal">8080</code>.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-embedded-container-servlets-and-filters" href="#boot-features-embedded-container-servlets-and-filters"></a>26.3.1 Servlets and Filters</h3></div></div></div><p>When using an embedded servlet container you can register Servlets, Filters and all the listeners from the Servlet spec (e.g. <code class="literal">HttpSessionListener</code>) directly as Spring beans. This can be particularly convenient if you want to refer to a value from your <code class="literal">application.properties</code> during configuration.</p><p>By default, if the context contains only a single Servlet it will be mapped to <code class="literal">/</code>. In the case of multiple Servlet beans the bean name will be used as a path prefix. Filters will map to <code class="literal">/*</code>.</p><p>If convention-based mapping is not flexible enough you can use the <code class="literal">ServletRegistrationBean</code>, <code class="literal">FilterRegistrationBean</code> and <code class="literal">ServletListenerRegistrationBean</code> classes for complete control. You can also register items directly if your bean implements the <code class="literal">ServletContextInitializer</code> interface.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-embedded-container-application-context" href="#boot-features-embedded-container-application-context"></a>26.3.2 The EmbeddedWebApplicationContext</h3></div></div></div><p>Under the hood Spring Boot uses a new type of <code class="literal">ApplicationContext</code> for embedded servlet container support. The <code class="literal">EmbeddedWebApplicationContext</code> is a special type of <code class="literal">WebApplicationContext</code> that bootstraps itself by searching for a single <code class="literal">EmbeddedServletContainerFactory</code> bean. Usually a <code class="literal">TomcatEmbeddedServletContainerFactory</code>, <code class="literal">JettyEmbeddedServletContainerFactory</code>, or <code class="literal">UndertowEmbeddedServletContainerFactory</code> will have been auto-configured.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>You usually won’t need to be aware of these implementation classes. Most applications will be auto-configured and the appropriate <code class="literal">ApplicationContext</code> and <code class="literal">EmbeddedServletContainerFactory</code> will be created on your behalf.</p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-customizing-embedded-containers" href="#boot-features-customizing-embedded-containers"></a>26.3.3 Customizing embedded servlet containers</h3></div></div></div><p>Common servlet container settings can be configured using Spring <code class="literal">Environment</code> properties. Usually you would define the properties in your <code class="literal">application.properties</code> file.</p><p>Common server settings include:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><code class="literal">server.port</code> — The listen port for incoming HTTP requests.</li><li class="listitem"><code class="literal">server.address</code> — The interface address to bind to.</li><li class="listitem"><code class="literal">server.sessionTimeout</code> — A session timeout.</li></ul></div><p>See the <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java" target="_top"><code class="literal">ServerProperties</code></a> class for a complete list.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="boot-features-programmatic-embedded-container-customization" href="#boot-features-programmatic-embedded-container-customization"></a>Programmatic customization</h4></div></div></div><p>If you need to configure your embdedded servlet container programmatically you can register a Spring bean that implements the <code class="literal">EmbeddedServletContainerCustomizer</code> interface. <code class="literal">EmbeddedServletContainerCustomizer</code> provides access to the <code class="literal">ConfigurableEmbeddedServletContainer</code> which includes numerous customization setter methods.</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.boot.context.embedded.*; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.stereotype.Component; <em><span class="hl-annotation" style="color: gray">@Component</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> CustomizationBean <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">implements</span> EmbeddedServletContainerCustomizer { <em><span class="hl-annotation" style="color: gray">@Override</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">void</span> customize(ConfigurableEmbeddedServletContainer container) { container.setPort(<span class="hl-number">9000</span>); } }</pre></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="boot-features-customizing-configurableembeddedservletcontainerfactory-directly" href="#boot-features-customizing-configurableembeddedservletcontainerfactory-directly"></a>Customizing ConfigurableEmbeddedServletContainer directly</h4></div></div></div><p>If the above customization techniques are too limited, you can register the <code class="literal">TomcatEmbeddedServletContainerFactory</code>, <code class="literal">JettyEmbeddedServletContainerFactory</code> or <code class="literal">UndertowEmbeddedServletContainerFactory</code> bean yourself.</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@Bean</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> EmbeddedServletContainerFactory servletContainer() { TomcatEmbeddedServletContainerFactory factory = <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">new</span> TomcatEmbeddedServletContainerFactory(); factory.setPort(<span class="hl-number">9000</span>); factory.setSessionTimeout(<span class="hl-number">10</span>, TimeUnit.MINUTES); factory.addErrorPages(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">new</span> ErrorPage(HttpStatus.NOT_FOUND, <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"/notfound.html"</span>)); <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">return</span> factory; }</pre><p>Setters are provided for many configuration options. Several protected method ‘hooks’ are also provided should you need to do something more exotic. See the source code documentation for details.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-jsp-limitations" href="#boot-features-jsp-limitations"></a>26.3.4 JSP limitations</h3></div></div></div><p>When running a Spring Boot application that uses an embedded servlet container (and is packaged as an executable archive), there are some limitations in the JSP support.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">With Tomcat it should work if you use war packaging, i.e. an executable war will work, and will also be deployable to a standard container (not limited to, but including Tomcat). An executable jar will not work because of a hard coded file pattern in Tomcat.</li><li class="listitem">Jetty does not currently work as an embedded container with JSPs.</li><li class="listitem">Undertow does not support JSPs.</li></ul></div><p>There is a <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-samples/spring-boot-sample-web-jsp" target="_top">JSP sample</a> so you can see how to set things up.</p></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="boot-features-security" href="#boot-features-security"></a>27. Security</h2></div></div></div><p>If Spring Security is on the classpath then web applications will be secure by default with ‘basic’ authentication on all HTTP endpoints. To add method-level security to a web application you can also add <code class="literal">@EnableGlobalMethodSecurity</code> with your desired settings. Additional information can be found in the <a class="link" href="http://docs.spring.io/spring-security/site/docs/3.2.6.RELEASE/reference/htmlsingle#jc-method" target="_top">Spring Security Reference</a>.</p><p>The default <code class="literal">AuthenticationManager</code> has a single user (‘user’ username and random password, printed at INFO level when the application starts up)</p><pre class="screen">Using default security password: 78fa095d-3f4c-48b1-ad50-e24c31d5cf35</pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>If you fine tune your logging configuration, ensure that the <code class="literal">org.springframework.boot.autoconfigure.security</code> category is set to log <code class="literal">INFO</code> messages, otherwise the default password will not be printed.</p></td></tr></tbody></table></div><p>You can change the password by providing a <code class="literal">security.user.password</code>. This and other useful properties are externalized via <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityProperties.java" target="_top"><code class="literal">SecurityProperties</code></a> (properties prefix "security").</p><p>The default security configuration is implemented in <code class="literal">SecurityAutoConfiguration</code> and in the classes imported from there (<code class="literal">SpringBootWebSecurityConfiguration</code> for web security and <code class="literal">AuthenticationManagerConfiguration</code> for authentication configuration which is also relevant in non-web applications). To switch off the Boot default configuration completely in a web application you can add a bean with <code class="literal">@EnableWebSecurity</code>. To customize it you normally use external properties and beans of type <code class="literal">WebSecurityConfigurerAdapter</code> (e.g. to add form-based login). There are several secure applications in the <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-samples/" target="_top">Spring Boot samples</a> to get you started with common use cases.</p><p>The basic features you get out of the box in a web application are:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">An <code class="literal">AuthenticationManager</code> bean with in-memory store and a single user (see <code class="literal">SecurityProperties.User</code> for the properties of the user).</li><li class="listitem">Ignored (unsecure) paths for common static resource locations (<code class="literal">/css/**</code>, <code class="literal">/js/**</code>, <code class="literal">/images/**</code> and <code class="literal">**/favicon.ico</code>).</li><li class="listitem">HTTP Basic security for all other endpoints.</li><li class="listitem">Security events published to Spring’s <code class="literal">ApplicationEventPublisher</code> (successful and unsuccessful authentication and access denied).</li><li class="listitem">Common low-level features (HSTS, XSS, CSRF, caching) provided by Spring Security are on by default.</li></ul></div><p>All of the above can be switched on and off or modified using external properties (<code class="literal">security.*</code>). To override the access rules without changing any other autoconfigured features add a <code class="literal">@Bean</code> of type <code class="literal">WebSecurityConfigurerAdapter</code> with <code class="literal">@Order(SecurityProperties.ACCESS_OVERRIDE_ORDER)</code>.</p><p>If the Actuator is also in use, you will find:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">The management endpoints are secure even if the application endpoints are unsecure.</li><li class="listitem">Security events are transformed into <code class="literal">AuditEvents</code> and published to the <code class="literal">AuditService</code>.</li><li class="listitem">The default user will have the <code class="literal">ADMIN</code> role as well as the <code class="literal">USER</code> role.</li></ul></div><p>The Actuator security features can be modified using external properties (<code class="literal">management.security.*</code>). To override the application access rules add a <code class="literal">@Bean</code> of type <code class="literal">WebSecurityConfigurerAdapter</code> and use <code class="literal">@Order(SecurityProperties.ACCESS_OVERRIDE_ORDER)</code> if you <span class="emphasis"><em>don’t</em></span> want to override the actuator access rules, or <code class="literal">@Order(ManagementServerProperties.ACCESS_OVERRIDE_ORDER)</code> if you <span class="emphasis"><em>do</em></span> want to override the actuator access rules.</p></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="boot-features-sql" href="#boot-features-sql"></a>28. Working with SQL databases</h2></div></div></div><p>The Spring Framework provides extensive support for working with SQL databases. From direct JDBC access using <code class="literal">JdbcTemplate</code> to complete ‘object relational mapping’ technologies such as Hibernate. Spring Data provides an additional level of functionality, creating <code class="literal">Repository</code> implementations directly from interfaces and using conventions to generate queries from your method names.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boot-features-configure-datasource" href="#boot-features-configure-datasource"></a>28.1 Configure a DataSource</h2></div></div></div><p>Java’s <code class="literal">javax.sql.DataSource</code> interface provides a standard method of working with database connections. Traditionally a DataSource uses a <code class="literal">URL</code> along with some credentials to establish a database connection.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-embedded-database-support" href="#boot-features-embedded-database-support"></a>28.1.1 Embedded Database Support</h3></div></div></div><p>It’s often convenient to develop applications using an in-memory embedded database. Obviously, in-memory databases do not provide persistent storage; you will need to populate your database when your application starts and be prepared to throw away data when your application ends.</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>The ‘How-to’ section includes a <span class="emphasis"><em><a class="link" href="#howto-database-initialization" title="68. Database initialization">section on how to initialize a database</a></em></span></p></td></tr></tbody></table></div><p>Spring Boot can auto-configure embedded <a class="link" href="http://www.h2database.com/" target="_top">H2</a>, <a class="link" href="http://hsqldb.org/" target="_top">HSQL</a> and <a class="link" href="http://db.apache.org/derby/" target="_top">Derby</a> databases. You don’t need to provide any connection URLs, simply include a build dependency to the embedded database that you want to use.</p><p>For example, typical POM dependencies would be:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.boot<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-boot-starter-data-jpa<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.hsqldb<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>hsqldb<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><scope></span>runtime<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></scope></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependency></span></pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>You need a dependency on <code class="literal">spring-jdbc</code> for an embedded database to be auto-configured. In this example it’s pulled in transitively via <code class="literal">spring-boot-starter-data-jpa</code>.</p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-connect-to-production-database" href="#boot-features-connect-to-production-database"></a>28.1.2 Connection to a production database</h3></div></div></div><p>Production database connections can also be auto-configured using a pooling <code class="literal">DataSource</code>. Here’s the algorithm for choosing a specific implementation:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">We prefer the Tomcat pooling <code class="literal">DataSource</code> for its performance and concurrency, so if that is available we always choose it.</li><li class="listitem">If HikariCP is available we will use it.</li><li class="listitem">If Commons DBCP is available we will use it, but we don’t recommend it in production.</li><li class="listitem">Lastly, if Commons DBCP2 is available we will use it.</li></ul></div><p>If you use the <code class="literal">spring-boot-starter-jdbc</code> or <code class="literal">spring-boot-starter-data-jpa</code> ‘starter POMs’ you will automatically get a dependency to <code class="literal">tomcat-jdbc</code>.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>Additional connection pools can always be configured manually. If you define your own <code class="literal">DataSource</code> bean, auto-configuration will not occur.</p></td></tr></tbody></table></div><p>DataSource configuration is controlled by external configuration properties in <code class="literal">spring.datasource.*</code>. For example, you might declare the following section in <code class="literal">application.properties</code>:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.datasource.url</span>=jdbc:mysql://localhost/test <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.datasource.username</span>=dbuser <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.datasource.password</span>=dbpass <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.datasource.driver-class-name</span>=com.mysql.jdbc.Driver</pre><p>See <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceProperties.java" target="_top"><code class="literal">DataSourceProperties</code></a> for more of the supported options. Note also that you can configure any of the <code class="literal">DataSource</code> implementation specific properties via <code class="literal">spring.datasource.*</code>: refer to the documentation of the connection pool implementation you are using for more details.</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>You often won’t need to specify the <code class="literal">driver-class-name</code> since Spring boot can deduce it for most databases from the <code class="literal">url</code>.</p></td></tr></tbody></table></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>For a pooling <code class="literal">DataSource</code> to be created we need to be able to verify that a valid <code class="literal">Driver</code> class is available, so we check for that before doing anything. I.e. if you set <code class="literal">spring.datasource.driverClassName=com.mysql.jdbc.Driver</code> then that class has to be loadable.</p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-connecting-to-a-jndi-datasource" href="#boot-features-connecting-to-a-jndi-datasource"></a>28.1.3 Connection to a JNDI DataSource</h3></div></div></div><p>If you are deploying your Spring Boot application to an Application Server you might want to configure and manage your DataSource using your Application Servers built-in features and access it using JNDI.</p><p>The <code class="literal">spring.datasource.jndi-name</code> property can be used as an alternative to the <code class="literal">spring.datasource.url</code>, <code class="literal">spring.datasource.username</code> and <code class="literal">spring.datasource.password</code> properties to access the <code class="literal">DataSource</code> from a specific JNDI location. For example, the following section in <code class="literal">application.properties</code> shows how you can access a JBoss AS defined <code class="literal">DataSource</code>:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.datasource.jndi-name</span>=java:jboss/datasources/customers</pre></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boot-features-using-jdbc-template" href="#boot-features-using-jdbc-template"></a>28.2 Using JdbcTemplate</h2></div></div></div><p>Spring’s <code class="literal">JdbcTemplate</code> and <code class="literal">NamedParameterJdbcTemplate</code> classes are auto-configured and you can <code class="literal">@Autowire</code> them directly into your own beans:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.beans.factory.annotation.Autowired; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.jdbc.core.JdbcTemplate; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.stereotype.Component; <em><span class="hl-annotation" style="color: gray">@Component</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> MyBean { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">private</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">final</span> JdbcTemplate jdbcTemplate; <em><span class="hl-annotation" style="color: gray">@Autowired</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> MyBean(JdbcTemplate jdbcTemplate) { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">this</span>.jdbcTemplate = jdbcTemplate; } <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// ...</span> }</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boot-features-jpa-and-spring-data" href="#boot-features-jpa-and-spring-data"></a>28.3 JPA and ‘Spring Data’</h2></div></div></div><p>The Java Persistence API is a standard technology that allows you to ‘map’ objects to relational databases. The <code class="literal">spring-boot-starter-data-jpa</code> POM provides a quick way to get started. It provides the following key dependencies:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Hibernate — One of the most popular JPA implementations.</li><li class="listitem">Spring Data JPA — Makes it easy to implement JPA-based repositories.</li><li class="listitem">Spring ORMs — Core ORM support from the Spring Framework.</li></ul></div><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>We won’t go into too many details of JPA or Spring Data here. You can follow the <a class="link" href="http://spring.io/guides/gs/accessing-data-jpa/" target="_top">‘Accessing Data with JPA’</a> guide from <a class="link" href="http://spring.io/" target="_top">spring.io</a> and read the <a class="link" href="http://projects.spring.io/spring-data-jpa/" target="_top">Spring Data JPA</a> and <a class="link" href="http://hibernate.org/orm/documentation/" target="_top">Hibernate</a> reference documentation.</p></td></tr></tbody></table></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-entity-classes" href="#boot-features-entity-classes"></a>28.3.1 Entity Classes</h3></div></div></div><p>Traditionally, JPA ‘Entity’ classes are specified in a <code class="literal">persistence.xml</code> file. With Spring Boot this file is not necessary and instead ‘Entity Scanning’ is used. By default all packages below your main configuration class (the one annotated with <code class="literal">@EnableAutoConfiguration</code> or <code class="literal">@SpringBootApplication</code>) will be searched.</p><p>Any classes annotated with <code class="literal">@Entity</code>, <code class="literal">@Embeddable</code> or <code class="literal">@MappedSuperclass</code> will be considered. A typical entity class would look something like this:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">package</span> com.example.myapp.domain; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> java.io.Serializable; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> javax.persistence.*; <em><span class="hl-annotation" style="color: gray">@Entity</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> City <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">implements</span> Serializable { <em><span class="hl-annotation" style="color: gray">@Id</span></em> <em><span class="hl-annotation" style="color: gray">@GeneratedValue</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">private</span> Long id; <em><span class="hl-annotation" style="color: gray">@Column(nullable = false)</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">private</span> String name; <em><span class="hl-annotation" style="color: gray">@Column(nullable = false)</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">private</span> String state; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// ... additional members, often include @OneToMany mappings</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">protected</span> City() { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// no-args constructor required by JPA spec</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// this one is protected since it shouldn't be used directly</span> } <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> City(String name, String state) { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">this</span>.name = name; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">this</span>.country = country; } <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> String getName() { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">return</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">this</span>.name; } <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> String getState() { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">return</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">this</span>.state; } <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// ... etc</span> }</pre><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>You can customize entity scanning locations using the <code class="literal">@EntityScan</code> annotation. See the <span class="emphasis"><em><a class="xref" href="#howto-separate-entity-definitions-from-spring-configuration" title="67.4 Separate @Entity definitions from Spring configuration">Section 67.4, “Separate @Entity definitions from Spring configuration”</a></em></span> how-to.</p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-spring-data-jpa-repositories" href="#boot-features-spring-data-jpa-repositories"></a>28.3.2 Spring Data JPA Repositories</h3></div></div></div><p>Spring Data JPA repositories are interfaces that you can define to access data. JPA queries are created automatically from your method names. For example, a <code class="literal">CityRepository</code> interface might declare a <code class="literal">findAllByState(String state)</code> method to find all cities in a given state.</p><p>For more complex queries you can annotate your method using Spring Data’s <a class="link" href="http://docs.spring.io/spring-data/jpa/docs/current/api/org/springframework/data/jpa/repository/Query.html" target="_top"><code class="literal">Query</code></a> annotation.</p><p>Spring Data repositories usually extend from the <a class="link" href="http://docs.spring.io/spring-data/commons/docs/current/api/org/springframework/data/repository/Repository.html" target="_top"><code class="literal">Repository</code></a> or <a class="link" href="http://docs.spring.io/spring-data/commons/docs/current/api/org/springframework/data/repository/CrudRepository.html" target="_top"><code class="literal">CrudRepository</code></a> interfaces. If you are using auto-configuration, repositories will be searched from the package containing your main configuration class (the one annotated with <code class="literal">@EnableAutoConfiguration</code> or <code class="literal">@SpringBootApplication</code>) down.</p><p>Here is a typical Spring Data repository:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">package</span> com.example.myapp.domain; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.data.domain.*; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.data.repository.*; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">interface</span> CityRepository <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">extends</span> Repository<City, Long> { Page<City> findAll(Pageable pageable); City findByNameAndCountryAllIgnoringCase(String name, String country); }</pre><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>We have barely scratched the surface of Spring Data JPA. For complete details check their <a class="link" href="http://projects.spring.io/spring-data-jpa/" target="_top">reference documentation</a>.</p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-creating-and-dropping-jpa-databases" href="#boot-features-creating-and-dropping-jpa-databases"></a>28.3.3 Creating and dropping JPA databases</h3></div></div></div><p>By default, JPA databases will be automatically created <span class="strong"><strong>only</strong></span> if you use an embedded database (H2, HSQL or Derby). You can explicitly configure JPA settings using <code class="literal">spring.jpa.*</code> properties. For example, to create and drop tables you can add the following to your <code class="literal">application.properties</code>.</p><pre class="screen">spring.jpa.hibernate.ddl-auto=create-drop</pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>Hibernate’s own internal property name for this (if you happen to remember it better) is <code class="literal">hibernate.hbm2ddl.auto</code>. You can set it, along with other Hibernate native properties, using <code class="literal">spring.jpa.properties.*</code> (the prefix is stripped before adding them to the entity manager). Example:</p></td></tr></tbody></table></div><pre class="screen">spring.jpa.properties.hibernate.globally_quoted_identifiers=true</pre><p>passes <code class="literal">hibernate.globally_quoted_identifiers</code> to the Hibernate entity manager.</p><p>By default the DDL execution (or validation) is deferred until the <code class="literal">ApplicationContext</code> has started. There is also a <code class="literal">spring.jpa.generate-ddl</code> flag, but it is not used if Hibernate autoconfig is active because the <code class="literal">ddl-auto</code> settings are more fine-grained.</p></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="boot-features-nosql" href="#boot-features-nosql"></a>29. Working with NoSQL technologies</h2></div></div></div><p>Spring Data provides additional projects that help you access a variety of NoSQL technologies including <a class="link" href="http://projects.spring.io/spring-data-mongodb/" target="_top">MongoDB</a>, <a class="link" href="http://projects.spring.io/spring-data-neo4j/" target="_top">Neo4J</a>, <a class="link" href="https://github.com/spring-projects/spring-data-elasticsearch/" target="_top">Elasticsearch</a>, <a class="link" href="http://projects.spring.io/spring-data-solr/" target="_top">Solr</a>, <a class="link" href="http://projects.spring.io/spring-data-redis/" target="_top">Redis</a>, <a class="link" href="http://projects.spring.io/spring-data-gemfire/" target="_top">Gemfire</a>, <a class="link" href="http://projects.spring.io/spring-data-couchbase/" target="_top">Couchbase</a> and <a class="link" href="http://projects.spring.io/spring-data-cassandra/" target="_top">Cassandra</a>. Spring Boot provides auto-configuration for Redis, MongoDB, Elasticsearch, Solr and Gemfire; you can make use of the other projects, but you will need to configure them yourself. Refer to the appropriate reference documentation at <a class="link" href="http://projects.spring.io/spring-data" target="_top">projects.spring.io/spring-data</a>.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boot-features-redis" href="#boot-features-redis"></a>29.1 Redis</h2></div></div></div><p><a class="link" href="http://redis.io/" target="_top">Redis</a> is a cache, message broker and richly-featured key-value store. Spring Boot offers basic auto-configuration for the <a class="link" href="https://github.com/xetorthio/jedis/" target="_top">Jedis</a> client library and abstractions on top of it provided by <a class="link" href="https://github.com/spring-projects/spring-data-redis" target="_top">Spring Data Redis</a>. There is a <code class="literal">spring-boot-starter-redis</code> ‘Starter POM’ for collecting the dependencies in a convenient way.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-connecting-to-redis" href="#boot-features-connecting-to-redis"></a>29.1.1 Connecting to Redis</h3></div></div></div><p>You can inject an auto-configured <code class="literal">RedisConnectionFactory</code>, <code class="literal">StringRedisTemplate</code> or vanilla <code class="literal">RedisTemplate</code> instance as you would any other Spring Bean. By default the instance will attempt to connect to a Redis server using <code class="literal">localhost:6379</code>:</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@Component</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> MyBean { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">private</span> StringRedisTemplate template; <em><span class="hl-annotation" style="color: gray">@Autowired</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> MyBean(StringRedisTemplate template) { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">this</span>.template = template; } <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// ...</span> }</pre><p>If you add a <code class="literal">@Bean</code> of your own of any of the auto-configured types it will replace the default (except in the case of <code class="literal">RedisTemplate</code> the exclusion is based on the bean name ‘redisTemplate’ not its type). If <code class="literal">commons-pool2</code> is on the classpath you will get a pooled connection factory by default.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boot-features-mongodb" href="#boot-features-mongodb"></a>29.2 MongoDB</h2></div></div></div><p><a class="link" href="http://www.mongodb.com/" target="_top">MongoDB</a> is an open-source NoSQL document database that uses a JSON-like schema instead of traditional table-based relational data. Spring Boot offers several conveniences for working with MongoDB, including the <code class="literal">spring-boot-starter-data-mongodb</code> ‘Starter POM’.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-connecting-to-mongodb" href="#boot-features-connecting-to-mongodb"></a>29.2.1 Connecting to a MongoDB database</h3></div></div></div><p>You can inject an auto-configured <code class="literal">org.springframework.data.mongodb.MongoDbFactory</code> to access Mongo databases. By default the instance will attempt to connect to a MongoDB server using the URL <code class="literal">mongodb://localhost/test</code>:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.data.mongodb.MongoDbFactory; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> com.mongodb.DB; <em><span class="hl-annotation" style="color: gray">@Component</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> MyBean { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">private</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">final</span> MongoDbFactory mongo; <em><span class="hl-annotation" style="color: gray">@Autowired</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> MyBean(MongoDbFactory mongo) { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">this</span>.mongo = mongo; } <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// ...</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">void</span> example() { DB db = mongo.getDb(); <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// ...</span> } }</pre><p>You can set <code class="literal">spring.data.mongodb.uri</code> property to change the <code class="literal">url</code>, or alternatively specify a <code class="literal">host</code>/<code class="literal">port</code>. For example, you might declare the following in your <code class="literal">application.properties</code>:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.data.mongodb.host</span>=mongoserver <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.data.mongodb.port</span>=27017</pre><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>If <code class="literal">spring.data.mongodb.port</code> is not specified the default of <code class="literal">27017</code> is used. You could simply delete this line from the sample above.</p></td></tr></tbody></table></div><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>If you aren’t using Spring Data Mongo you can inject <code class="literal">com.mongodb.Mongo</code> beans instead of using <code class="literal">MongoDbFactory</code>.</p></td></tr></tbody></table></div><p>You can also declare your own <code class="literal">MongoDbFactory</code> or <code class="literal">Mongo</code> bean if you want to take complete control of establishing the MongoDB connection.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-mongo-template" href="#boot-features-mongo-template"></a>29.2.2 MongoTemplate</h3></div></div></div><p>Spring Data Mongo provides a <a class="link" href="http://docs.spring.io/spring-data/mongodb/docs/current/api/org/springframework/data/mongodb/core/MongoTemplate.html" target="_top"><code class="literal">MongoTemplate</code></a> class that is very similar in its design to Spring’s <code class="literal">JdbcTemplate</code>. As with <code class="literal">JdbcTemplate</code> Spring Boot auto-configures a bean for you to simply inject:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.beans.factory.annotation.Autowired; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.data.mongodb.core.MongoTemplate; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.stereotype.Component; <em><span class="hl-annotation" style="color: gray">@Component</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> MyBean { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">private</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">final</span> MongoTemplate mongoTemplate; <em><span class="hl-annotation" style="color: gray">@Autowired</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> MyBean(MongoTemplate mongoTemplate) { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">this</span>.mongoTemplate = mongoTemplate; } <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// ...</span> }</pre><p>See the <code class="literal">MongoOperations</code> Javadoc for complete details.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-spring-data-mongo-repositories" href="#boot-features-spring-data-mongo-repositories"></a>29.2.3 Spring Data MongoDB repositories</h3></div></div></div><p>Spring Data includes repository support for MongoDB. As with the JPA repositories discussed earlier, the basic principle is that queries are constructed for you automatically based on method names.</p><p>In fact, both Spring Data JPA and Spring Data MongoDB share the same common infrastructure; so you could take the JPA example from earlier and, assuming that <code class="literal">City</code> is now a Mongo data class rather than a JPA <code class="literal">@Entity</code>, it will work in the same way.</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">package</span> com.example.myapp.domain; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.data.domain.*; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.data.repository.*; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">interface</span> CityRepository <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">extends</span> Repository<City, Long> { Page<City> findAll(Pageable pageable); City findByNameAndCountryAllIgnoringCase(String name, String country); }</pre><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>For complete details of Spring Data MongoDB, including its rich object mapping technologies, refer to their <a class="link" href="http://projects.spring.io/spring-data-mongodb/" target="_top">reference documentation</a>.</p></td></tr></tbody></table></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boot-features-gemfire" href="#boot-features-gemfire"></a>29.3 Gemfire</h2></div></div></div><p><a class="link" href="https://github.com/spring-projects/spring-data-gemfire" target="_top">Spring Data Gemfire</a> provides convenient Spring-friendly tools for accessing the <a class="link" href="http://www.gopivotal.com/big-data/pivotal-gemfire#details" target="_top">Pivotal Gemfire</a> data management platform. There is a <code class="literal">spring-boot-starter-data-gemfire</code> ‘Starter POM’ for collecting the dependencies in a convenient way. There is currently no auto=config support for Gemfire, but you can enable Spring Data Repositories with a <a class="link" href="https://github.com/spring-projects/spring-data-gemfire/blob/master/src/main/java/org/springframework/data/gemfire/repository/config/EnableGemfireRepositories.java" target="_top">single annotation</a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boot-features-solr" href="#boot-features-solr"></a>29.4 Solr</h2></div></div></div><p><a class="link" href="http://lucene.apache.org/solr/" target="_top">Apache Solr</a> is a search engine. Spring Boot offers basic auto-configuration for the solr client library and abstractions on top of it provided by <a class="link" href="https://github.com/spring-projects/spring-data-solr" target="_top">Spring Data Solr</a>. There is a <code class="literal">spring-boot-starter-data-solr</code> ‘Starter POM’ for collecting the dependencies in a convenient way.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-connecting-to-solr" href="#boot-features-connecting-to-solr"></a>29.4.1 Connecting to Solr</h3></div></div></div><p>You can inject an auto-configured <code class="literal">SolrServer</code> instance as you would any other Spring Bean. By default the instance will attempt to connect to a server using <code class="literal"><a class="link" href="http://localhost:8983/solr" target="_top">localhost:8983/solr</a></code>:</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@Component</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> MyBean { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">private</span> SolrServer solr; <em><span class="hl-annotation" style="color: gray">@Autowired</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> MyBean(SolrServer solr) { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">this</span>.solr = solr; } <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// ...</span> }</pre><p>If you add a <code class="literal">@Bean</code> of your own of type <code class="literal">SolrServer</code> it will replace the default.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-spring-data-solr-repositories" href="#boot-features-spring-data-solr-repositories"></a>29.4.2 Spring Data Solr repositories</h3></div></div></div><p>Spring Data includes repository support for Apache Solr. As with the JPA repositories discussed earlier, the basic principle is that queries are constructed for you automatically based on method names.</p><p>In fact, both Spring Data JPA and Spring Data Solr share the same common infrastructure; so you could take the JPA example from earlier and, assuming that <code class="literal">City</code> is now a <code class="literal">@SolrDocument</code> class rather than a JPA <code class="literal">@Entity</code>, it will work in the same way.</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>For complete details of Spring Data Solr, refer to their <a class="link" href="http://projects.spring.io/spring-data-solr/" target="_top">reference documentation</a>.</p></td></tr></tbody></table></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boot-features-elasticsearch" href="#boot-features-elasticsearch"></a>29.5 Elasticsearch</h2></div></div></div><p><a class="link" href="http://www.elasticsearch.org/" target="_top">Elastic Search</a> is an open source, distributed, real-time search and analytics engine. Spring Boot offers basic auto-configuration for the Elasticsearch and abstractions on top of it provided by <a class="link" href="https://github.com/spring-projects/spring-data-elasticsearch" target="_top">Spring Data Elasticsearch</a>. There is a <code class="literal">spring-boot-starter-data-elasticsearch</code> ‘Starter POM’ for collecting the dependencies in a convenient way.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-connecting-to-elasticsearch" href="#boot-features-connecting-to-elasticsearch"></a>29.5.1 Connecting to Elasticsearch</h3></div></div></div><p>You can inject an auto-configured <code class="literal">ElasticsearchTemplate</code> or Elasticsearch <code class="literal">Client</code> instance as you would any other Spring Bean. By default the instance will attempt to connect to a local in-memory server (a <code class="literal">NodeClient</code> in Elasticsearch terms), but you can switch to a remote server (i.e. a <code class="literal">TransportClient</code>) by setting <code class="literal">spring.data.elasticsearch.clusterNodes</code> to a comma-separated ‘host:port’ list.</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@Component</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> MyBean { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">private</span> ElasticsearchTemplate template; <em><span class="hl-annotation" style="color: gray">@Autowired</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> MyBean(ElasticsearchTemplate template) { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">this</span>.template = template; } <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// ...</span> }</pre><p>If you add a <code class="literal">@Bean</code> of your own of type <code class="literal">ElasticsearchTemplate</code> it will replace the default.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-spring-data-elasticsearch-repositories" href="#boot-features-spring-data-elasticsearch-repositories"></a>29.5.2 Spring Data Elasticsearch repositories</h3></div></div></div><p>Spring Data includes repository support for Elasticsearch. As with the JPA repositories discussed earlier, the basic principle is that queries are constructed for you automatically based on method names.</p><p>In fact, both Spring Data JPA and Spring Data Elasticsearch share the same common infrastructure; so you could take the JPA example from earlier and, assuming that <code class="literal">City</code> is now an Elasticsearch <code class="literal">@Document</code> class rather than a JPA <code class="literal">@Entity</code>, it will work in the same way.</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>For complete details of Spring Data Elasticsearch, refer to their <a class="link" href="http://docs.spring.io/spring-data/elasticsearch/docs/" target="_top">reference documentation</a>.</p></td></tr></tbody></table></div></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="boot-features-messaging" href="#boot-features-messaging"></a>30. Messaging</h2></div></div></div><p>The Spring Framework provides extensive support for integrating with messaging systems: from simplified use of the JMS API using <code class="literal">JmsTemplate</code> to a complete infrastructure to receive messages asynchronously. Spring AMQP provides a similar feature set for the ‘Advanced Message Queuing Protocol’ and Boot also provides auto-configuration options for <code class="literal">RabbitTemplate</code> and RabbitMQ. There is also support for STOMP messaging natively in Spring Websocket and Spring Boot has support for that through starters and a small amount of auto-configuration.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boot-features-jms" href="#boot-features-jms"></a>30.1 JMS</h2></div></div></div><p>The <code class="literal">javax.jms.ConnectionFactory</code> interface provides a standard method of creating a <code class="literal">javax.jms.Connection</code> for interacting with a JMS broker. Although Spring needs a <code class="literal">ConnectionFactory</code> to work with JMS, you generally won’t need to use it directly yourself and you can instead rely on higher level messaging abstractions (see the <a class="link" href="http://docs.spring.io/spring/docs/4.1.5.RELEASE/spring-framework-reference/htmlsingle/#jms" target="_top">relevant section</a> of the Spring Framework reference documentation for details). Spring Boot also auto configures the necessary infrastructure to send and receive messages.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-hornetq" href="#boot-features-hornetq"></a>30.1.1 HornetQ support</h3></div></div></div><p>Spring Boot can auto-configure a <code class="literal">ConnectionFactory</code> when it detects that HornetQ is available on the classpath. If the broker is present, an embedded broker is started and configured automatically (unless the mode property has been explicitly set). The supported modes are: <code class="literal">embedded</code> (to make explicit that an embedded broker is required and should lead to an error if the broker is not available in the classpath), and <code class="literal">native</code> to connect to a broker using the <code class="literal">netty</code> transport protocol. When the latter is configured, Spring Boot configures a <code class="literal">ConnectionFactory</code> connecting to a broker running on the local machine with the default settings.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>If you are using <code class="literal">spring-boot-starter-hornetq</code> the necessary dependencies to connect to an existing HornetQ instance are provided, as well as the Spring infrastructure to integrate with JMS. Adding <code class="literal">org.hornetq:hornetq-jms-server</code> to your application allows you to use the embedded mode.</p></td></tr></tbody></table></div><p>HornetQ configuration is controlled by external configuration properties in <code class="literal">spring.hornetq.*</code>. For example, you might declare the following section in <code class="literal">application.properties</code>:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.hornetq.mode</span>=native <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.hornetq.host</span>=192.168.1.210 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.hornetq.port</span>=9876</pre><p>When embedding the broker, you can chose if you want to enable persistence, and the list of destinations that should be made available. These can be specified as a comma-separated list to create them with the default options; or you can define bean(s) of type <code class="literal">org.hornetq.jms.server.config.JMSQueueConfiguration</code> or <code class="literal">org.hornetq.jms.server.config.TopicConfiguration</code>, for advanced queue and topic configurations respectively.</p><p>See <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/hornetq/HornetQProperties.java" target="_top"><code class="literal">HornetQProperties</code></a> for more of the supported options.</p><p>No JNDI lookup is involved at all and destinations are resolved against their names, either using the ‘name’ attribute in the HornetQ configuration or the names provided through configuration.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-activemq" href="#boot-features-activemq"></a>30.1.2 ActiveMQ support</h3></div></div></div><p>Spring Boot can also configure a <code class="literal">ConnectionFactory</code> when it detects that ActiveMQ is available on the classpath. If the broker is present, an embedded broker is started and configured automatically (as long as no broker URL is specified through configuration).</p><p>ActiveMQ configuration is controlled by external configuration properties in <code class="literal">spring.activemq.*</code>. For example, you might declare the following section in <code class="literal">application.properties</code>:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.activemq.broker-url</span>=tcp://192.168.1.210:9876 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.activemq.user</span>=admin <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.activemq.password</span>=secret</pre><p>See <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQProperties.java" target="_top"><code class="literal">ActiveMQProperties</code></a> for more of the supported options.</p><p>By default, ActiveMQ creates a destination if it does not exist yet, so destinations are resolved against their provided names.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-jms-jndi" href="#boot-features-jms-jndi"></a>30.1.3 Using a JNDI ConnectionFactory</h3></div></div></div><p>If you are running your application in an Application Server Spring Boot will attempt to locate a JMS <code class="literal">ConnectionFactory</code> using JNDI. By default the locations <code class="literal">java:/JmsXA</code> and <code class="literal">java:/XAConnectionFactory</code> will be checked. You can use the <code class="literal">spring.jms.jndi-name</code> property if you need to specify an alternative location:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jms.jndi-name</span>=java:/MyConnectionFactory</pre></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-using-jms-sending" href="#boot-features-using-jms-sending"></a>30.1.4 Sending a message</h3></div></div></div><p>Spring’s <code class="literal">JmsTemplate</code> is auto-configured and you can autowire it directly into your own beans:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.beans.factory.annotation.Autowired; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.jms.core.JmsTemplate; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.stereotype.Component; <em><span class="hl-annotation" style="color: gray">@Component</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> MyBean { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">private</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">final</span> JmsTemplate jmsTemplate; <em><span class="hl-annotation" style="color: gray">@Autowired</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> MyBean(JmsTemplate jmsTemplate) { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">this</span>.jmsTemplate = jmsTemplate; } <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// ...</span> }</pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring/docs/4.1.5.RELEASE/javadoc-api/org/springframework/jms/core/JmsMessagingTemplate.html" target="_top"><code class="literal">JmsMessagingTemplate</code></a> (new in Spring 4.1) can be injected in a similar manner.</p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-using-jms-receiving" href="#boot-features-using-jms-receiving"></a>30.1.5 Receiving a message</h3></div></div></div><p>When the JMS infrastructure is present, any bean can be annotated with <code class="literal">@JmsListener</code> to create a listener endpoint. If no <code class="literal">JmsListenerContainerFactory</code> has been defined, a default one is configured automatically.</p><p>The following component creates a listener endpoint on the <code class="literal">someQueue</code> destination:</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@Component</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> MyBean { <em><span class="hl-annotation" style="color: gray">@JmsListener(destination = "someQueue")</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">void</span> processMessage(String content) { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// ...</span> } }</pre><p>Check <a class="link" href="http://docs.spring.io/spring/docs/4.1.5.RELEASE/javadoc-api/org/springframework/jms/annotation/EnableJms.html" target="_top">the javadoc of <code class="literal">@EnableJms</code></a> for more details.</p></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="boot-features-email" href="#boot-features-email"></a>31. Sending email</h2></div></div></div><p>The Spring Framework provides an easy abstraction for sending email using the <code class="literal">JavaMailSender</code> interface and Spring Boot provides auto-configuration for it as well as a starter module.</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>Check the <a class="link" href="http://docs.spring.io/spring/docs/4.1.5.RELEASE/spring-framework-reference/htmlsingle/#mail" target="_top">reference documentation</a> for a detailed explanation of how you can use <code class="literal">JavaMailSender</code>.</p></td></tr></tbody></table></div><p>If <code class="literal">spring.mail.host</code> and the relevant libraries (as defined by <code class="literal">spring-boot-starter-mail</code>) are available, a default <code class="literal">JavaMailSender</code> is created if none exists. The sender can be further customized by configuration items from the <code class="literal">spring.mail</code> namespace, see the <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mail/MailProperties.java" target="_top"><code class="literal">MailProperties</code></a> for more details.</p></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="boot-features-jta" href="#boot-features-jta"></a>32. Distributed Transactions with JTA</h2></div></div></div><p>Spring Boot supports distributed JTA transactions across multiple XA resources using either an <a class="link" href="http://www.atomikos.com/" target="_top">Atomkos</a> or <a class="link" href="http://docs.codehaus.org/display/BTM/Home" target="_top">Bitronix</a> embedded transaction manager. JTA transactions are also supported when deploying to a suitable Java EE Application Server.</p><p>When a JTA environment is detected, Spring’s <code class="literal">JtaTransactionManager</code> will be used to manage transactions. Auto-configured JMS, DataSource and JPA beans will be upgraded to support XA transactions. You can use standard Spring idioms such as <code class="literal">@Transactional</code> to participate in a distributed transaction. If you are within a JTA environment and still want to use local transactions you can set the <code class="literal">spring.jta.enabled</code> property to <code class="literal">false</code> to disable the JTA auto-configuration.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_using_an_atomikos_transaction_manager" href="#_using_an_atomikos_transaction_manager"></a>32.1 Using an Atomikos transaction manager</h2></div></div></div><p>Atomikos is a popular open source transaction manager which can be embedded into your Spring Boot application. You can use the <code class="literal">spring-boot-starter-jta-atomikos</code> Starter POM to pull in the appropriate Atomikos libraries. Spring Boot will auto-configure Atomikos and ensure that appropriate <code class="literal">depends-on</code> settings are applied to your Spring Beans for correct startup and shutdown ordering.</p><p>By default Atomikos transaction logs will be written to a <code class="literal">transaction-logs</code> folder in your application home directory (the directory in which your application jar file resides). You can customize this directory by setting a <code class="literal">spring.jta.log-dir</code> property in your <code class="literal">application.properties</code> file. Properties starting <code class="literal">spring.jta.</code> can also be used to customize the Atomikos <code class="literal">UserTransactionServiceIml</code>. See the <a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/jta/atomikos/AtomikosProperties.html" target="_top"><code class="literal">AtomikosProperties</code> javadoc</a> for complete details.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>To ensure that multiple transaction managers can safely coordinate the same resource managers, each Atomikos instance must be configured with a unique ID. By default this ID is the IP address of the machine on which Atomikos is running. To ensure uniqueness in production, you should configure the <code class="literal">spring.jta.transaction-manager-id</code> property with a different value for each instance of your application.</p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_using_a_bitronix_transaction_manager" href="#_using_a_bitronix_transaction_manager"></a>32.2 Using a Bitronix transaction manager</h2></div></div></div><p>Bitronix is another popular open source JTA transaction manager implementation. You can use the <code class="literal">spring-boot-starter-jta-bitronix</code> starter POM to add the appropriate Birtronix dependencies to your project. As with Atomikos, Spring Boot will automatically configure Bitronix and post-process your beans to ensure that startup and shutdown ordering is correct.</p><p>By default Bitronix transaction log files (<code class="literal">part1.btm</code> and <code class="literal">part2.btm</code>) will be written to a <code class="literal">transaction-logs</code> folder in your application home directory. You can customize this directory by using the <code class="literal">spring.jta.log-dir</code> property. Properties starting <code class="literal">spring.jta.</code> are also bound to the <code class="literal">bitronix.tm.Configuration</code> bean, allowing for complete customization. See the <a class="link" href="http://btm.codehaus.org/api/2.0.1/bitronix/tm/Configuration.html" target="_top">Bitronix documentation</a> for details.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>To ensure that multiple transaction managers can safely coordinate the same resource managers, each Bitronix instance must be configured with a unique ID. By default this ID is the IP address of the machine on which Bitronix is running. To ensure uniqueness in production, you should configure the <code class="literal">spring.jta.transaction-manager-id</code> property with a different value for each instance of your application.</p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_using_a_java_ee_managed_transaction_manager" href="#_using_a_java_ee_managed_transaction_manager"></a>32.3 Using a Java EE managed transaction manager</h2></div></div></div><p>If you are packaging your Spring Boot application as a <code class="literal">war</code> or <code class="literal">ear</code> file and deploying it to a Java EE application server, you can use your application servers built-in transaction manager. Spring Boot will attempt to auto-configure a transaction manager by looking at common JNDI locations (<code class="literal">java:comp/UserTransaction</code>, <code class="literal">java:comp/TransactionManager</code> etc). If you are using a transaction service provided by your application server, you will generally also want to ensure that all resources are managed by the server and exposed over JNDI. Spring Boot will attempt to auto-configure JMS by looking for a <code class="literal">ConnectionFactory</code> at the JNDI path <code class="literal">java:/JmsXA</code> or <code class="literal">java:/XAConnectionFactory</code> and you can use the <a class="link" href="#boot-features-connecting-to-a-jndi-datasource" title="28.1.3 Connection to a JNDI DataSource"><code class="literal">spring.datasource.jndi-name</code> property</a> to configure your <code class="literal">DataSource</code>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_mixing_xa_and_non_xa_jms_connections" href="#_mixing_xa_and_non_xa_jms_connections"></a>32.4 Mixing XA and non-XA JMS connections</h2></div></div></div><p>When using JTA, the primary JMS <code class="literal">ConnectionFactory</code> bean will be XA aware and participate in distributed transactions. In some situations you might want to process certain JMS messages using a non-XA <code class="literal">ConnectionFactory</code>. For example, your JMS processing logic might take longer than the XA timeout.</p><p>If you want to use a non-XA <code class="literal">ConnectionFactory</code> you can inject the <code class="literal">nonXaJmsConnectionFactory</code> bean rather than the <code class="literal">@Primary</code> <code class="literal">jmsConnectionFactory</code> bean. For consistency the <code class="literal">jmsConnectionFactory</code> bean is also provided using the bean alias <code class="literal">xaJmsConnectionFactory</code>.</p><p>For example:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// Inject the primary (XA aware) ConnectionFactory</span> <em><span class="hl-annotation" style="color: gray">@Autowired</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">private</span> ConnectionFactory defaultConnectionFactory; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// Inject the XA aware ConnectionFactory (uses the alias and injects the same as above)</span> <em><span class="hl-annotation" style="color: gray">@Autowired</span></em> <em><span class="hl-annotation" style="color: gray">@Qualifier("xaJmsConnectionFactory")</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">private</span> ConnectionFactory xaConnectionFactory; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// Inject the non-XA aware ConnectionFactory</span> <em><span class="hl-annotation" style="color: gray">@Autowired</span></em> <em><span class="hl-annotation" style="color: gray">@Qualifier("nonXaJmsConnectionFactory")</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">private</span> ConnectionFactory nonXaConnectionFactory;</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_supporting_an_alternative_embedded_transaction_manager" href="#_supporting_an_alternative_embedded_transaction_manager"></a>32.5 Supporting an alternative embedded transaction manager</h2></div></div></div><p>The <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot/src/main/java/org/springframework/boot/jta/XAConnectionFactoryWrapper.java" target="_top"><code class="literal">XAConnectionFactoryWrapper</code></a> and <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot/src/main/java/org/springframework/boot/jta/XADataSourceWrapper.java" target="_top"><code class="literal">XADataSourceWrapper</code></a> interfaces can be used to support alternative embedded transaction managers. The interfaces are responsible for wrapping <code class="literal">XAConnectionFactory</code> and <code class="literal">XADataSource</code> beans and exposing them as regular <code class="literal">ConnectionFactory</code> and <code class="literal">DataSource</code> beans which will transparently enroll in the distributed transaction. DataSource and JMS auto-configuration will use JTA variants as long as you have a <code class="literal">JtaTransactionManager</code> bean and appropriate XA wrapper beans registered within your <code class="literal">ApplicationContext</code></p><p>The <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot/src/main/java/org/springframework/boot/jta/BitronixXAConnectionFactoryWrapper.java" target="_top">BitronixXAConnectionFactoryWrapper</a> and <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot/src/main/java/org/springframework/boot/jta/BitronixXADataSourceWrapper.java" target="_top">BitronixXADataSourceWrapper</a> provide good examples of how to write XA wrappers.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="boot-features-integration" href="#boot-features-integration"></a>33. Spring Integration</h2></div></div></div><p>Spring Integration provides abstractions over messaging and also other transports such as HTTP, TCP etc. If Spring Integration is available on your classpath it will be initialized through the <code class="literal">@EnableIntegration</code> annotation. Message processing statistics will be published over JMX if <code class="literal">'spring-integration-jmx'</code> is also on the classpath. See the <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/integration/IntegrationAutoConfiguration.java" target="_top"><code class="literal">IntegrationAutoConfiguration</code></a> class for more details.</p></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="boot-features-jmx" href="#boot-features-jmx"></a>34. Monitoring and management over JMX</h2></div></div></div><p>Java Management Extensions (JMX) provide a standard mechanism to monitor and manage applications. By default Spring Boot will create an <code class="literal">MBeanServer</code> with bean id ‘mbeanServer’ and expose any of your beans that are annotated with Spring JMX annotations (<code class="literal">@ManagedResource</code>, <code class="literal">@ManagedAttribute</code>, <code class="literal">@ManagedOperation</code>).</p><p>See the <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jmx/JmxAutoConfiguration.java" target="_top"><code class="literal">JmxAutoConfiguration</code></a> class for more details.</p></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="boot-features-testing" href="#boot-features-testing"></a>35. Testing</h2></div></div></div><p>Spring Boot provides a number of useful tools for testing your application. The <code class="literal">spring-boot-starter-test</code> POM provides Spring Test, JUnit, Hamcrest and Mockito dependencies. There are also useful test utilities in the core <code class="literal">spring-boot</code> module under the <code class="literal">org.springframework.boot.test</code> package.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boot-features-test-scope-dependencies" href="#boot-features-test-scope-dependencies"></a>35.1 Test scope dependencies</h2></div></div></div><p>If you use the <code class="literal">spring-boot-starter-test</code> ‘Starter POM’ (in the <code class="literal">test</code> <code class="literal">scope</code>), you will find the following provided libraries:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Spring Test — integration test support for Spring applications.</li><li class="listitem">JUnit — The de-facto standard for unit testing Java applications.</li><li class="listitem">Hamcrest — A library of matcher objects (also known as constraints or predicates) allowing <code class="literal">assertThat</code> style JUnit assertions.</li><li class="listitem">Mockito — A Java mocking framework.</li></ul></div><p>These are common libraries that we generally find useful when writing tests. You are free to add additional test dependencies of your own if these don’t suit your needs.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boot-features-testing-spring-applications" href="#boot-features-testing-spring-applications"></a>35.2 Testing Spring applications</h2></div></div></div><p>One of the major advantages of dependency injection is that it should make your code easier to unit test. You can simply instantiate objects using the <code class="literal">new</code> operator without even involving Spring. You can also use <span class="emphasis"><em>mock objects</em></span> instead of real dependencies.</p><p>Often you need to move beyond ‘unit testing’ and start ‘integration testing’ (with a Spring <code class="literal">ApplicationContext</code> actually involved in the process). It’s useful to be able to perform integration testing without requiring deployment of your application or needing to connect to other infrastructure.</p><p>The Spring Framework includes a dedicated test module for just such integration testing. You can declare a dependency directly to <code class="literal">org.springframework:spring-test</code> or use the <code class="literal">spring-boot-starter-test</code> ‘Starter POM’ to pull it in transitively.</p><p>If you have not used the <code class="literal">spring-test</code> module before you should start by reading the <a class="link" href="http://docs.spring.io/spring/docs/4.1.5.RELEASE/spring-framework-reference/htmlsingle/#testing" target="_top">relevant section</a> of the Spring Framework reference documentation.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boot-features-testing-spring-boot-applications" href="#boot-features-testing-spring-boot-applications"></a>35.3 Testing Spring Boot applications</h2></div></div></div><p>A Spring Boot application is just a Spring <code class="literal">ApplicationContext</code> so nothing very special has to be done to test it beyond what you would normally do with a vanilla Spring context. One thing to watch out for though is that the external properties, logging and other features of Spring Boot are only installed in the context by default if you use <code class="literal">SpringApplication</code> to create it.</p><p>Spring Boot provides a <code class="literal">@SpringApplicationConfiguration</code> annotation as an alternative to the standard <code class="literal">spring-test</code> <code class="literal">@ContextConfiguration</code> annotation. If you use <code class="literal">@SpringApplicationConfiguration</code> to configure the <code class="literal">ApplicationContext</code> used in your tests, it will be created via <code class="literal">SpringApplication</code> and you will get the additional Spring Boot features.</p><p>For example:</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@RunWith(SpringJUnit4ClassRunner.class)</span></em> <em><span class="hl-annotation" style="color: gray">@SpringApplicationConfiguration(classes = SampleDataJpaApplication.class)</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> CityRepositoryIntegrationTests { <em><span class="hl-annotation" style="color: gray">@Autowired</span></em> CityRepository repository; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// ...</span> }</pre><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>The context loader guesses whether you want to test a web application or not (e.g. with <code class="literal">MockMVC</code>) by looking for the <code class="literal">@WebIntegrationTest</code> or <code class="literal">@WebAppConfiguration</code> annotations. (<code class="literal">MockMVC</code> and <code class="literal">@WebAppConfiguration</code> are part of <code class="literal">spring-test</code>).</p></td></tr></tbody></table></div><p>If you want a web application to start up and listen on its normal port, so you can test it with HTTP (e.g. using <code class="literal">RestTemplate</code>), annotate your test class (or one of its superclasses) with <code class="literal">@WebIntegrationTest</code>. This can be very useful because it means you can test the full stack of your application, but also inject its components into the test class and use them to assert the internal state of the application after an HTTP interaction. For example:</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@RunWith(SpringJUnit4ClassRunner.class)</span></em> <em><span class="hl-annotation" style="color: gray">@SpringApplicationConfiguration(classes = SampleDataJpaApplication.class)</span></em> <em><span class="hl-annotation" style="color: gray">@WebIntegrationTest</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> CityRepositoryIntegrationTests { <em><span class="hl-annotation" style="color: gray">@Autowired</span></em> CityRepository repository; RestTemplate restTemplate = <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">new</span> TestRestTemplate(); <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// ... interact with the running server</span> }</pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>Spring’s test framework will cache application contexts between tests. Therefore, as long as your tests share the same configuration, the time consuming process of starting and stopping the server will only happen once, regardless of the number of tests that actually run.</p></td></tr></tbody></table></div><p>To change the port you can add environment properties to <code class="literal">@WebIntegrationTest</code> as colon- or equals-separated name-value pairs, e.g. <code class="literal">@WebIntegrationTest("server.port:9000")</code>. Additionally you can set the <code class="literal">server.port</code> and <code class="literal">management.port</code> properties to <code class="literal">0</code> in order to run your integration tests using random ports. For example:</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@RunWith(SpringJUnit4ClassRunner.class)</span></em> <em><span class="hl-annotation" style="color: gray">@SpringApplicationConfiguration(classes = MyApplication.class)</span></em> <em><span class="hl-annotation" style="color: gray">@WebIntegrationTest({"server.port=0", "management.port=0"})</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> SomeIntegrationTests { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// ...</span> }</pre><p>See <a class="xref" href="#howto-discover-the-http-port-at-runtime" title="64.5 Discover the HTTP port at runtime">Section 64.5, “Discover the HTTP port at runtime”</a> for a description of how you can discover the actual port that was allocated for the duration of the tests.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-testing-spring-boot-applications-with-spock" href="#boot-features-testing-spring-boot-applications-with-spock"></a>35.3.1 Using Spock to test Spring Boot applications</h3></div></div></div><p>If you wish to use Spock to test a Spring Boot application you should add a dependency on Spock’s <code class="literal">spock-spring</code> module to your application’s build. <code class="literal">spock-spring</code> integrates Spring’s test framework into Spock.</p><p>Please note that you cannot use the <code class="literal">@SpringApplicationConfiguration</code> annotation that was <a class="link" href="#boot-features-testing-spring-boot-applications" title="35.3 Testing Spring Boot applications">described above</a> as Spock <a class="link" href="https://code.google.com/p/spock/issues/detail?id=349" target="_top">does not find the <code class="literal">@ContextConfiguration</code> meta-annotation</a>. To work around this limitation, you should use the <code class="literal">@ContextConfiguration</code> annotation directly and configure it to use the Spring Boot specific context loader:</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@ContextConfiguration(loader = SpringApplicationContextLoader.class)</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> ExampleSpec <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">extends</span> Specification { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// ...</span> }</pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>The annotations <a class="link" href="#boot-features-testing-spring-boot-applications" title="35.3 Testing Spring Boot applications">described above</a> can be used with Spock, i.e. you can annotate your <code class="literal">Specification</code> with <code class="literal">@WebIntegrationTest</code> to suit the needs of your tests.</p></td></tr></tbody></table></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boot-features-test-utilities" href="#boot-features-test-utilities"></a>35.4 Test utilities</h2></div></div></div><p>A few test utility classes are packaged as part of <code class="literal">spring-boot</code> that are generally useful when testing your application.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-configfileapplicationcontextinitializer-test-utility" href="#boot-features-configfileapplicationcontextinitializer-test-utility"></a>35.4.1 ConfigFileApplicationContextInitializer</h3></div></div></div><p><code class="literal">ConfigFileApplicationContextInitializer</code> is an <code class="literal">ApplicationContextInitializer</code> that can apply to your tests to load Spring Boot <code class="literal">application.properties</code> files. You can use this when you don’t need the full features provided by <code class="literal">@SpringApplicationConfiguration</code>.</p><pre class="programlisting">@ContextConfiguration(classes = Config.<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span>, initializers = ConfigFileApplicationContextInitializer.<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span>)</pre></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-environment-test-utilities" href="#boot-features-environment-test-utilities"></a>35.4.2 EnvironmentTestUtils</h3></div></div></div><p><code class="literal">EnvironmentTestUtils</code> allows you to quickly add properties to a <code class="literal">ConfigurableEnvironment</code> or <code class="literal">ConfigurableApplicationContext</code>. Simply call it with <code class="literal">key=value</code> strings:</p><pre class="programlisting">EnvironmentTestUtils.addEnvironment(env, <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"org=Spring"</span>, <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"name=Boot"</span>);</pre></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-output-capture-test-utility" href="#boot-features-output-capture-test-utility"></a>35.4.3 OutputCapture</h3></div></div></div><p><code class="literal">OutputCapture</code> is a JUnit <code class="literal">Rule</code> that you can use to capture <code class="literal">System.out</code> and <code class="literal">System.err</code> output. Simply declare the capture as a <code class="literal">@Rule</code> then use <code class="literal">toString()</code> for assertions:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.junit.Rule; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.junit.Test; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.boot.test.OutputCapture; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">static</span> org.hamcrest.Matchers.*; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">static</span> org.junit.Assert.*; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> MyTest { <em><span class="hl-annotation" style="color: gray">@Rule</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> OutputCapture capture = <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">new</span> OutputCapture(); <em><span class="hl-annotation" style="color: gray">@Test</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">void</span> testName() <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">throws</span> Exception { System.out.println(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"Hello World!"</span>); assertThat(capture.toString(), containsString(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"World"</span>)); } }</pre></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-rest-templates-test-utility" href="#boot-features-rest-templates-test-utility"></a>35.4.4 TestRestTemplate</h3></div></div></div><p><code class="literal">TestRestTemplate</code> is a convenience subclass of Spring’s <code class="literal">RestTemplate</code> that is useful in integration tests. You can get a vanilla template or one that sends Basic HTTP authentication (with a username and password). In either case the template will behave in a test-friendly way: not following redirects (so you can assert the response location), ignoring cookies (so the template is stateless), and not throwing exceptions on server-side errors. It is recommended, but not mandatory, to use Apache HTTP Client (version 4.3.2 or better), and if you have that on your classpath the <code class="literal">TestRestTemplate</code> will respond by configuring the client appropriately.</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> MyTest { RestTemplate template = <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">new</span> TestRestTemplate(); <em><span class="hl-annotation" style="color: gray">@Test</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">void</span> testRequest() <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">throws</span> Exception { HttpHeaders headers = template.getForEntity(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"http://myhost.com"</span>, String.<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span>).getHeaders(); assertThat(headers.getLocation().toString(), containsString(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"myotherhost"</span>)); } }</pre></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="boot-features-developing-auto-configuration" href="#boot-features-developing-auto-configuration"></a>36. Developing auto-configuration and using conditions</h2></div></div></div><p>If you work in a company that develops shared libraries, or if you work on an open-source or commercial library, you might want to develop your own auto-configuration. Auto-configuration classes can be bundled in external jars and still be picked-up by Spring Boot.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boot-features-understanding-auto-configured-beans" href="#boot-features-understanding-auto-configured-beans"></a>36.1 Understanding auto-configured beans</h2></div></div></div><p>Under the hood, auto-configuration is implemented with standard <code class="literal">@Configuration</code> classes. Additional <code class="literal">@Conditional</code> annotations are used to constrain when the auto-configuration should apply. Usually auto-configuration classes use <code class="literal">@ConditionalOnClass</code> and <code class="literal">@ConditionalOnMissingBean</code> annotations. This ensures that auto-configuration only applies when relevant classes are found and when you have not declared your own <code class="literal">@Configuration</code>.</p><p>You can browse the source code of <code class="literal">spring-boot-autoconfigure</code> to see the <code class="literal">@Configuration</code> classes that we provide (see the <code class="literal">META-INF/spring.factories</code> file).</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boot-features-locating-auto-configuration-candidates" href="#boot-features-locating-auto-configuration-candidates"></a>36.2 Locating auto-configuration candidates</h2></div></div></div><p>Spring Boot checks for the presence of a <code class="literal">META-INF/spring.factories</code> file within your published jar. The file should list your configuration classes under the <code class="literal">EnableAutoConfiguration</code> key.</p><pre class="screen">org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ com.mycorp.libx.autoconfigure.LibXAutoConfiguration,\ com.mycorp.libx.autoconfigure.LibXWebAutoConfiguration</pre><p>You can use the <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigureAfter.java" target="_top"><code class="literal">@AutoConfigureAfter</code></a> or <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/AutoConfigureBefore.java" target="_top"><code class="literal">@AutoConfigureBefore</code></a> annotations if your configuration needs to be applied in a specific order. For example, if you provide web-specific configuration, your class may need to be applied after <code class="literal">WebMvcAutoConfiguration</code>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="boot-features-condition-annotations" href="#boot-features-condition-annotations"></a>36.3 Condition annotations</h2></div></div></div><p>You almost always want to include one or more <code class="literal">@Condition</code> annotations on your auto-configuration class. The <code class="literal">@ConditionalOnMissingBean</code> is one common example that is used to allow developers to ‘override’ auto-configuration if they are not happy with your defaults.</p><p>Spring Boot includes a number of <code class="literal">@Conditional</code> annotations that you can reuse in your own code by annotating <code class="literal">@Configuration</code> classes or individual <code class="literal">@Bean</code> methods.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-class-conditions" href="#boot-features-class-conditions"></a>36.3.1 Class conditions</h3></div></div></div><p>The <code class="literal">@ConditionalOnClass</code> and <code class="literal">@ConditionalOnMissingClass</code> annotations allows configuration to be skipped based on the presence or absence of specific classes. Due to the fact that annotation metadata is parsed using <a class="link" href="http://asm.ow2.org/" target="_top">ASM</a> you can actually use the <code class="literal">value</code> attribute to refer to the real class, even though that class might not actually appear on the running application classpath. You can also use the <code class="literal">name</code> attribute if you prefer to specify the class name using a <code class="literal">String</code> value.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-bean-conditions" href="#boot-features-bean-conditions"></a>36.3.2 Bean conditions</h3></div></div></div><p>The <code class="literal">@ConditionalOnBean</code> and <code class="literal">@ConditionalOnMissingBean</code> annotations allow configurations to be skipped based on the presence or absence of specific beans. You can use the <code class="literal">value</code> attribute to specify beans by type, or <code class="literal">name</code> to specify beans by name. The <code class="literal">search</code> attribute allows you to limit the <code class="literal">ApplicationContext</code> hierarchy that should be considered when searching for beans.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p><code class="literal">@Conditional</code> annotations are processed when <code class="literal">@Configuration</code> classes are parsed. Auto-configure <code class="literal">@Configuration</code> is always parsed last (after any user defined beans), however, if you are using these annotations on regular <code class="literal">@Configuration</code> classes, care must be taken not to refer to bean definitions that have not yet been created.</p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-property-conditions" href="#boot-features-property-conditions"></a>36.3.3 Property conditions</h3></div></div></div><p>The <code class="literal">@ConditionalOnProperty</code> annotation allows configuration to be included based on a Spring Environment property. Use the <code class="literal">prefix</code> and <code class="literal">name</code> attributes to specify the property that should be checked. By default any property that exists and is not equal to <code class="literal">false</code> will be matched. You can also create more advanced checks using the <code class="literal">havingValue</code> and <code class="literal">matchIfMissing</code> attributes.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-resource-conditions" href="#boot-features-resource-conditions"></a>36.3.4 Resource conditions</h3></div></div></div><p>The <code class="literal">@ConditionalOnResource</code> annotation allows configuration to be included only when a specific resource is present. Resources can be specified using the usual Spring conventions, for example, <code class="literal">file:/home/user/test.dat</code>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-web-application-conditions" href="#boot-features-web-application-conditions"></a>36.3.5 Web Application Conditions</h3></div></div></div><p>The <code class="literal">@ConditionalOnWebApplication</code> and <code class="literal">@ConditionalOnNotWebApplication</code> annotations allow configuration to be skipped depending on whether the application is a 'web application'. A web application is any application that is using a Spring <code class="literal">WebApplicationContext</code>, defines a <code class="literal">session</code> scope or has a <code class="literal">StandardServletEnvironment</code>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="boot-features-spel-conditions" href="#boot-features-spel-conditions"></a>36.3.6 SpEL expression conditions</h3></div></div></div><p>The <code class="literal">@ConditionalOnExpression</code> annotation allows configuration to be skipped based on the result of a <a class="link" href="http://docs.spring.io/spring/docs/4.1.5.RELEASE/spring-framework-reference/htmlsingle/#expressions" target="_top">SpEL expression</a>.</p></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="boot-features-websockets" href="#boot-features-websockets"></a>37. WebSockets</h2></div></div></div><p>Spring Boot provides WebSockets auto-configuration for embedded Tomcat (8 and 7), Jetty 9 and Undertow. If you’re deploying a war file to a standalone container, Spring Boot assumes that the container will be responsible for the configuration of its WebSocket support.</p><p>Spring Framework provides <a class="link" href="http://docs.spring.io/spring/docs/4.1.5.RELEASE/spring-framework-reference/htmlsingle/#websocket" target="_top">rich WebSocket support</a> that can be easily accessed via the <code class="literal">spring-boot-starter-websocket</code> module.</p></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="boot-features-whats-next" href="#boot-features-whats-next"></a>38. What to read next</h2></div></div></div><p>If you want to learn more about any of the classes discussed in this section you can check out the <a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api" target="_top">Spring Boot API documentation</a> or you can browse the <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE" target="_top">source code directly</a>. If you have specific questions, take a look at the <a class="link" href="#howto" title="Part IX. ‘How-to’ guides">how-to</a> section.</p><p>If you are comfortable with Spring Boot’s core features, you can carry on and read about <a class="link" href="#production-ready" title="Part V. Spring Boot Actuator: Production-ready features">production-ready features</a>.</p></div></div><div class="part"><div class="titlepage"><div><div><h1 class="title"><a name="production-ready" href="#production-ready"></a>Part V. Spring Boot Actuator: Production-ready features</h1></div></div></div><div class="partintro"><div></div><p>Spring Boot includes a number of additional features to help you monitor and manage your application when it’s pushed to production. You can choose to manage and monitor your application using HTTP endpoints, with JMX or even by remote shell (SSH or Telnet). Auditing, health and metrics gathering can be automatically applied to your application.</p></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="production-ready-enabling" href="#production-ready-enabling"></a>39. Enabling production-ready features</h2></div></div></div><p>The <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-actuator" target="_top"><code class="literal">spring-boot-actuator</code></a> module provides all of Spring Boot’s production-ready features. The simplest way to enable the features is to add a dependency to the <code class="literal">spring-boot-starter-actuator</code> ‘Starter POM’.</p><div class="sidebar"><div class="titlepage"><div><div><p class="title"><b>Definition of Actuator</b></p></div></div></div><p>An actuator is a manufacturing term, referring to a mechanical device for moving or controlling something. Actuators can generate a large amount of motion from a small change.</p></div><p>To add the actuator to a Maven based project, add the following ‘starter’ dependency:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependencies></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.boot<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-boot-starter-actuator<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependencies></span></pre><p>For Gradle, use the declaration:</p><pre class="programlisting">dependencies { compile(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"org.springframework.boot:spring-boot-starter-actuator"</span>) }</pre></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="production-ready-endpoints" href="#production-ready-endpoints"></a>40. Endpoints</h2></div></div></div><p>Actuator endpoints allow you to monitor and interact with your application. Spring Boot includes a number of built-in endpoints and you can also add your own. For example the <code class="literal">health</code> endpoint provides basic application health information.</p><p>The way that endpoints are exposed will depend on the type of technology that you choose. Most applications choose HTTP monitoring, where the ID of the endpoint is mapped to a URL. For example, by default, the <code class="literal">health</code> endpoint will be mapped to <code class="literal">/health</code>.</p><p>The following endpoints are available:</p><div class="informaltable"><table style="border-collapse: collapse;border-top: 0.5pt solid ; border-bottom: 0.5pt solid ; border-left: 0.5pt solid ; border-right: 0.5pt solid ; "><colgroup><col class="col_1"><col class="col_2"><col class="col_3"></colgroup><thead><tr><th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top">ID</th><th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top">Description</th><th style="border-bottom: 0.5pt solid ; " align="left" valign="top">Sensitive</th></tr></thead><tbody><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">autoconfig</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Displays an auto-configuration report showing all auto-configuration candidates and the reason why they ‘were’ or ‘were not’ applied.</p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>true</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">beans</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Displays a complete list of all the Spring Beans in your application.</p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>true</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">configprops</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Displays a collated list of all <code class="literal">@ConfigurationProperties</code>.</p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>true</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">dump</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Performs a thread dump.</p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>true</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">env</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Exposes properties from Spring’s <code class="literal">ConfigurableEnvironment</code>.</p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>true</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">health</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Shows application health information (a simple ‘status’ when accessed over an unauthenticated connection or full message details when authenticated).</p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>false</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">info</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Displays arbitrary application info.</p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>false</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">metrics</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Shows ‘metrics’ information for the current application.</p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>true</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">mappings</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Displays a collated list of all <code class="literal">@RequestMapping</code> paths.</p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>true</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">shutdown</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Allows the application to be gracefully shutdown (not enabled by default).</p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>true</p></td></tr><tr><td style="border-right: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">trace</code></p></td><td style="border-right: 0.5pt solid ; " align="left" valign="top"><p>Displays trace information (by default the last few HTTP requests).</p></td><td style="" align="left" valign="top"><p>true</p></td></tr></tbody></table></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>Depending on how an endpoint is exposed, the <code class="literal">sensitive</code> parameter may be used as a security hint. For example, sensitive endpoints will require a username/password when they are accessed over HTTP (or simply disabled if web security is not enabled).</p></td></tr></tbody></table></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="production-ready-customizing-endpoints" href="#production-ready-customizing-endpoints"></a>40.1 Customizing endpoints</h2></div></div></div><p>Endpoints can be customized using Spring properties. You can change if an endpoint is <code class="literal">enabled</code>, if it is considered <code class="literal">sensitive</code> and even its <code class="literal">id</code>.</p><p>For example, here is an <code class="literal">application.properties</code> that changes the sensitivity and id of the <code class="literal">beans</code> endpoint and also enables <code class="literal">shutdown</code>.</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.beans.id</span>=springbeans <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.beans.sensitive</span>=false <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.shutdown.enabled</span>=true</pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>The prefix ‟<code class="literal">endpoints</code> + <code class="literal">.</code> + <code class="literal">name</code>” is used to uniquely identify the endpoint that is being configured.</p></td></tr></tbody></table></div><p>By default, all endpoints except for <code class="literal">shutdown</code> are enabled. If you prefer to specifically “opt-in” endpoint enablement you can use the <code class="literal">endpoints.enabled</code> property. For example, the following will disable <span class="emphasis"><em>all</em></span> endpoints except for <code class="literal">info</code>:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.enabled</span>=false <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.info.enabled</span>=true</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="production-ready-health" href="#production-ready-health"></a>40.2 Health information</h2></div></div></div><p>Health information can be used to check the status of your running application. It is often used by monitoring software to alert someone if a production system goes down. The default information exposed by the <code class="literal">health</code> endpoint depends on how it is accessed. For an insecure unauthenticated connection a simple ‘status’ message is returned, for a secure or authenticated connection additional details are also displayed (see <a class="xref" href="#production-ready-health-access-restrictions" title="41.6 HTTP Health endpoint access restrictions">Section 41.6, “HTTP Health endpoint access restrictions”</a> for HTTP details).</p><p>Health information is collected from all <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthIndicator.java" target="_top"><code class="literal">HealthIndicator</code></a> beans defined in your <code class="literal">ApplicationContext</code>. Spring Boot includes a number of auto-configured <code class="literal">HealthIndicators</code> and you can also write your own.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="_security_with_healthindicators" href="#_security_with_healthindicators"></a>40.3 Security with HealthIndicators</h2></div></div></div><p>Information returned by <code class="literal">HealthIndicators</code> is often somewhat sensitive in nature. For example, you probably don’t want to publish details of your database server to the world. For this reason, by default, only the health status is exposed over an unauthenticated HTTP connection. If you are happy for complete health information to always be exposed you can set <code class="literal">endpoints.health.sensitive</code> to <code class="literal">false</code>.</p><p>Health responses are also cached to prevent “denial of service” attacks. Use the <code class="literal">endpoints.health.time-to-live</code> property if you want to change the default cache period of 1000 milliseconds.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_auto_configured_healthindicators" href="#_auto_configured_healthindicators"></a>40.3.1 Auto-configured HealthIndicators</h3></div></div></div><p>The following <code class="literal">HealthIndicators</code> are auto-configured by Spring Boot when appropriate:</p><div class="informaltable"><table style="border-collapse: collapse;border-top: 0.5pt solid ; border-bottom: 0.5pt solid ; border-left: 0.5pt solid ; border-right: 0.5pt solid ; "><colgroup><col class="col_1"><col class="col_2"></colgroup><thead><tr><th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top">Name</th><th style="border-bottom: 0.5pt solid ; " align="left" valign="top">Description</th></tr></thead><tbody><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/DiskSpaceHealthIndicator.java" target="_top"><code class="literal">DiskSpaceHealthIndicator</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Checks for low disk space.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/DataSourceHealthIndicator.java" target="_top"><code class="literal">DataSourceHealthIndicator</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Checks that a connection to <code class="literal">DataSource</code> can be obtained.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/MongoHealthIndicator.java" target="_top"><code class="literal">MongoHealthIndicator</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Checks that a Mongo database is up.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/RabbitHealthIndicator.java" target="_top"><code class="literal">RabbitHealthIndicator</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Checks that a Rabbit server is up.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/RedisHealthIndicator.java" target="_top"><code class="literal">RedisHealthIndicator</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Checks that a Redis server is up.</p></td></tr><tr><td style="border-right: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/SolrHealthIndicator.java" target="_top"><code class="literal">SolrHealthIndicator</code></a></p></td><td style="" align="left" valign="top"><p>Checks that a Solr server is up.</p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_writing_custom_healthindicators" href="#_writing_custom_healthindicators"></a>40.3.2 Writing custom HealthIndicators</h3></div></div></div><p>To provide custom health information you can register Spring beans that implement the <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthIndicator.java" target="_top"><code class="literal">HealthIndicator</code></a> interface. You need to provide an implementation of the <code class="literal">health()</code> method and return a <code class="literal">Health</code> response. The <code class="literal">Health</code> response should include a status and can optionally include additional details to be displayed.</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.boot.actuate.health.HealthIndicator; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.stereotype.Component; <em><span class="hl-annotation" style="color: gray">@Component</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> MyHealth <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">implements</span> HealthIndicator { <em><span class="hl-annotation" style="color: gray">@Override</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> Health health() { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">int</span> errorCode = check(); <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// perform some specific health check</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">if</span> (errorCode != <span class="hl-number">0</span>) { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">return</span> Health.down().withDetail(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"Error Code"</span>, errorCode).build(); } <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">return</span> Health.up().build(); } }</pre><p>In addition to Spring Boot’s predefined <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/Status.java" target="_top"><code class="literal">Status</code></a> types, it is also possible for <code class="literal">Health</code> to return a custom <code class="literal">Status</code> that represents a new system state. In such cases a custom implementation of the <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthAggregator.java" target="_top"><code class="literal">HealthAggregator</code></a> interface also needs to be provided, or the default implementation has to be configured using the <code class="literal">management.health.status.order</code> configuration property.</p><p>For example, assuming a new <code class="literal">Status</code> with code <code class="literal">FATAL</code> is being used in one of your <code class="literal">HealthIndicator</code> implementations. To configure the severity order add the following to your application properties:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">management.health.status.order</span>: DOWN, OUT_OF_SERVICE, UNKNOWN, UP</pre><p>You might also want to register custom status mappings with the <code class="literal">HealthMvcEndpoint</code> if you access the health endpoint over HTTP. For example you could map <code class="literal">FATAL</code> to <code class="literal">HttpStatus.SERVICE_UNAVAILABLE</code>.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="production-ready-application-info" href="#production-ready-application-info"></a>40.4 Custom application info information</h2></div></div></div><p>You can customize the data exposed by the <code class="literal">info</code> endpoint by setting <code class="literal">info.*</code> Spring properties. All <code class="literal">Environment</code> properties under the info key will be automatically exposed. For example, you could add the following to your <code class="literal">application.properties</code>:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">info.app.name</span>=MyService <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">info.app.description</span>=My awesome service <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">info.app.version</span>=1.0.0</pre><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="production-ready-application-info-automatic-expansion" href="#production-ready-application-info-automatic-expansion"></a>40.4.1 Automatically expand info properties at build time</h3></div></div></div><p>Rather than hardcoding some properties that are also specified in your project’s build configuration, you can automatically expand info properties using the existing build configuration instead. This is possible in both Maven and Gradle.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="production-ready-application-info-automatic-expansion-maven" href="#production-ready-application-info-automatic-expansion-maven"></a>Automatic property expansion using Maven</h4></div></div></div><p>You can automatically expand info properties from the Maven project using resource filtering. If you use the <code class="literal">spring-boot-starter-parent</code> you can then refer to your Maven ‘project properties’ via <code class="literal">@..@</code> placeholders, e.g.</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">project.artifactId</span>=myproject <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">project.name</span>=Demo <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">project.version</span>=X.X.X.X <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">project.description</span>=Demo project for info endpoint <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">info.build.artifact</span>=@project.artifactId@ <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">info.build.name</span>=@project.name@ <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">info.build.description</span>=@project.description@ <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">info.build.version</span>=@project.version@</pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>In the above example we used <code class="literal">project.*</code> to set some values to be used as fallbacks if the Maven resource filtering has not been switched on for some reason.</p></td></tr></tbody></table></div><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>The <code class="literal">spring-boot:run</code> maven goal adds <code class="literal">src/main/resources</code> directly to the classpath (for hot reloading purposes). This circumvents the resource filtering and this feature. You can use the <code class="literal">exec:java</code> goal instead or customize the plugin’s configuration, see the <a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/maven-plugin/usage.html" target="_top">plugin usage page</a> for more details.</p></td></tr></tbody></table></div><p>If you don’t use the starter parent, in your <code class="literal">pom.xml</code> you need (inside the <code class="literal"><build/></code> element):</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><resources></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><resource></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><directory></span>src/main/resources<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></directory></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><filtering></span>true<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></filtering></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></resource></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></resources></span></pre><p>and (inside <code class="literal"><plugins/></code>):</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><plugin></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.apache.maven.plugins<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>maven-resources-plugin<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><version></span>2.6<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></version></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><configuration></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><delimiters></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><delimiter></span>@<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></delimiter></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></delimiters></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></configuration></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></plugin></span></pre></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="production-ready-application-info-automatic-expansion-gradle" href="#production-ready-application-info-automatic-expansion-gradle"></a>Automatic property expansion using Gradle</h4></div></div></div><p>You can automatically expand info properties from the Gradle project by configuring the Java plugin’s <code class="literal">processResources</code> task to do so:</p><pre class="programlisting">processResources { expand(project.properties) }</pre><p>You can then refer to your Gradle project’s properties via placeholders, e.g.</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">info.build.name</span>=${name} <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">info.build.description</span>=${description} <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">info.build.version</span>=${version}</pre></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="production-ready-git-commit-information" href="#production-ready-git-commit-information"></a>40.4.2 Git commit information</h3></div></div></div><p>Another useful feature of the <code class="literal">info</code> endpoint is its ability to publish information about the state of your <code class="literal">git</code> source code repository when the project was built. If a <code class="literal">git.properties</code> file is contained in your jar the <code class="literal">git.branch</code> and <code class="literal">git.commit</code> properties will be loaded.</p><p>For Maven users the <code class="literal">spring-boot-starter-parent</code> POM includes a pre-configured plugin to generate a <code class="literal">git.properties</code> file. Simply add the following declaration to your POM:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><build></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><plugins></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><plugin></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>pl.project13.maven<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>git-commit-id-plugin<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></plugin></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></plugins></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></build></span></pre><p>A similar <a class="link" href="https://github.com/ajoberstar/gradle-git" target="_top"><code class="literal">gradle-git</code></a> plugin is also available for Gradle users, although a little more work is required to generate the properties file.</p></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="production-ready-monitoring" href="#production-ready-monitoring"></a>41. Monitoring and management over HTTP</h2></div></div></div><p>If you are developing a Spring MVC application, Spring Boot Actuator will auto-configure all enabled endpoints to be exposed over HTTP. The default convention is to use the <code class="literal">id</code> of the endpoint as the URL path. For example, <code class="literal">health</code> is exposed as <code class="literal">/health</code>.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="production-ready-sensitive-endpoints" href="#production-ready-sensitive-endpoints"></a>41.1 Securing sensitive endpoints</h2></div></div></div><p>If you add ‘Spring Security’ to your project, all sensitive endpoints exposed over HTTP will be protected. By default ‘basic’ authentication will be used with the username <code class="literal">user</code> and a generated password (which is printed on the console when the application starts).</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>Generated passwords are logged as the application starts. Search for ‘Using default security password’.</p></td></tr></tbody></table></div><p>You can use Spring properties to change the username and password and to change the security role required to access the endpoints. For example, you might set the following in your <code class="literal">application.properties</code>:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">security.user.name</span>=admin <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">security.user.password</span>=secret <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">management.security.role</span>=SUPERUSER</pre><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>If you don’t use Spring Security and your HTTP endpoints are exposed publicly, you should carefully consider which endpoints you enable. See <a class="xref" href="#production-ready-customizing-endpoints" title="40.1 Customizing endpoints">Section 40.1, “Customizing endpoints”</a> for details of how you can set <code class="literal">endpoints.enabled</code> to <code class="literal">false</code> then “opt-in” only specific endpoints.</p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="production-ready-customizing-management-server-context-path" href="#production-ready-customizing-management-server-context-path"></a>41.2 Customizing the management server context path</h2></div></div></div><p>Sometimes it is useful to group all management endpoints under a single path. For example, your application might already use <code class="literal">/info</code> for another purpose. You can use the <code class="literal">management.contextPath</code> property to set a prefix for your management endpoint:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">management.context-path</span>=/manage</pre><p>The <code class="literal">application.properties</code> example above will change the endpoint from <code class="literal">/{id}</code> to <code class="literal">/manage/{id}</code> (e.g. <code class="literal">/manage/info</code>).</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="production-ready-customizing-management-server-port" href="#production-ready-customizing-management-server-port"></a>41.3 Customizing the management server port</h2></div></div></div><p>Exposing management endpoints using the default HTTP port is a sensible choice for cloud based deployments. If, however, your application runs inside your own data center you may prefer to expose endpoints using a different HTTP port.</p><p>The <code class="literal">management.port</code> property can be used to change the HTTP port.</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">management.port</span>=8081</pre><p>Since your management port is often protected by a firewall, and not exposed to the public you might not need security on the management endpoints, even if your main application is secure. In that case you will have Spring Security on the classpath, and you can disable management security like this:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">management.security.enabled</span>=false</pre><p>(If you don’t have Spring Security on the classpath then there is no need to explicitly disable the management security in this way, and it might even break the application.)</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="production-ready-customizing-management-server-address" href="#production-ready-customizing-management-server-address"></a>41.4 Customizing the management server address</h2></div></div></div><p>You can customize the address that the management endpoints are available on by setting the <code class="literal">management.address</code> property. This can be useful if you want to listen only on an internal or ops-facing network, or to only listen for connections from <code class="literal">localhost</code>.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>You can only listen on a different address if the port is different to the main server port.</p></td></tr></tbody></table></div><p>Here is an example <code class="literal">application.properties</code> that will not allow remote management connections:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">management.port</span>=8081 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">management.address</span>=127.0.0.1</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="production-ready-disabling-http-endpoints" href="#production-ready-disabling-http-endpoints"></a>41.5 Disabling HTTP endpoints</h2></div></div></div><p>If you don’t want to expose endpoints over HTTP you can set the management port to <code class="literal">-1</code>:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">management.port</span>=-1</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="production-ready-health-access-restrictions" href="#production-ready-health-access-restrictions"></a>41.6 HTTP Health endpoint access restrictions</h2></div></div></div><p>The information exposed by the health endpoint varies depending on whether or not it’s accessed anonymously. By default, when accessed anonymously, any details about the server’s health are hidden and the endpoint will simply indicate whether or not the server is up or down. Furthermore, when accessed anonymously, the response is cached for a configurable period to prevent the endpoint being used in a denial of service attack. The <code class="literal">endpoints.health.time-to-live</code> property is used to configure the caching period in milliseconds. It defaults to 1000, i.e. one second.</p><p>The above-described restrictions can be disabled, thereby allowing anonymous users full access to the health endpoint. To do so, set <code class="literal">endpoints.health.sensitive</code> to <code class="literal">false</code>.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="production-ready-jmx" href="#production-ready-jmx"></a>42. Monitoring and management over JMX</h2></div></div></div><p>Java Management Extensions (JMX) provide a standard mechanism to monitor and manage applications. By default Spring Boot will expose management endpoints as JMX MBeans under the <code class="literal">org.springframework.boot</code> domain.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="production-ready-custom-mbean-names" href="#production-ready-custom-mbean-names"></a>42.1 Customizing MBean names</h2></div></div></div><p>The name of the MBean is usually generated from the <code class="literal">id</code> of the endpoint. For example the <code class="literal">health</code> endpoint is exposed as <code class="literal">org.springframework.boot/Endpoint/HealthEndpoint</code>.</p><p>If your application contains more than one Spring <code class="literal">ApplicationContext</code> you may find that names clash. To solve this problem you can set the <code class="literal">endpoints.jmx.uniqueNames</code> property to <code class="literal">true</code> so that MBean names are always unique.</p><p>You can also customize the JMX domain under which endpoints are exposed. Here is an example <code class="literal">application.properties</code>:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.jmx.domain</span>=myapp <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.jmx.uniqueNames</span>=true</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="production-ready-disable-jmx-endpoints" href="#production-ready-disable-jmx-endpoints"></a>42.2 Disabling JMX endpoints</h2></div></div></div><p>If you don’t want to expose endpoints over JMX you can set the <code class="literal">spring.jmx.enabled</code> property to <code class="literal">false</code>:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jmx.enabled</span>=false</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="production-ready-jolokia" href="#production-ready-jolokia"></a>42.3 Using Jolokia for JMX over HTTP</h2></div></div></div><p>Jolokia is a JMX-HTTP bridge giving an alternative method of accessing JMX beans. To use Jolokia, simply include a dependency to <code class="literal">org.jolokia:jolokia-core</code>. For example, using Maven you would add the following:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.jolokia<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>jolokia-core<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependency></span></pre><p>Jolokia can then be accessed using <code class="literal">/jolokia</code> on your management HTTP server.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="production-ready-customizing-jolokia" href="#production-ready-customizing-jolokia"></a>42.3.1 Customizing Jolokia</h3></div></div></div><p>Jolokia has a number of settings that you would traditionally configure using servlet parameters. With Spring Boot you can use your <code class="literal">application.properties</code>, simply prefix the parameter with <code class="literal">jolokia.config.</code>:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">jolokia.config.debug</span>=true</pre></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="production-ready-disabling-jolokia" href="#production-ready-disabling-jolokia"></a>42.3.2 Disabling Jolokia</h3></div></div></div><p>If you are using Jolokia but you don’t want Spring Boot to configure it, simply set the <code class="literal">endpoints.jolokia.enabled</code> property to <code class="literal">false</code>:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.jolokia.enabled</span>=false</pre></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="production-ready-remote-shell" href="#production-ready-remote-shell"></a>43. Monitoring and management using a remote shell</h2></div></div></div><p>Spring Boot supports an integrated Java shell called ‘CRaSH’. You can use CRaSH to <code class="literal">ssh</code> or <code class="literal">telnet</code> into your running application. To enable remote shell support add a dependency to <code class="literal">spring-boot-starter-remote-shell</code>:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.boot<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-boot-starter-remote-shell<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependency></span></pre><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>If you want to also enable telnet access your will additionally need a dependency on <code class="literal">org.crsh:crsh.shell.telnet</code>.</p></td></tr></tbody></table></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="production-ready-connecting-to-the-remote-shell" href="#production-ready-connecting-to-the-remote-shell"></a>43.1 Connecting to the remote shell</h2></div></div></div><p>By default the remote shell will listen for connections on port <code class="literal">2000</code>. The default user is <code class="literal">user</code> and the default password will be randomly generated and displayed in the log output. If your application is using Spring Security, the shell will use <a class="link" href="#boot-features-security" title="27. Security">the same configuration</a> by default. If not, a simple authentication will be applied and you should see a message like this:</p><pre class="screen">Using default password for shell access: ec03e16c-4cf4-49ee-b745-7c8255c1dd7e</pre><p>Linux and OSX users can use <code class="literal">ssh</code> to connect to the remote shell, Windows users can download and install <a class="link" href="http://www.putty.org/" target="_top">PuTTY</a>.</p><pre class="screen">$ ssh -p 2000 user@localhost user@localhost's password: . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v1.2.2.RELEASE) on myhost</pre><p>Type <code class="literal">help</code> for a list of commands. Spring boot provides <code class="literal">metrics</code>, <code class="literal">beans</code>, <code class="literal">autoconfig</code> and <code class="literal">endpoint</code> commands.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="production-ready-remote-shell-credentials" href="#production-ready-remote-shell-credentials"></a>43.1.1 Remote shell credentials</h3></div></div></div><p>You can use the <code class="literal">shell.auth.simple.user.name</code> and <code class="literal">shell.auth.simple.user.password</code> properties to configure custom connection credentials. It is also possible to use a ‘Spring Security’ <code class="literal">AuthenticationManager</code> to handle login duties. See the <a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/actuate/autoconfigure/CrshAutoConfiguration.html" target="_top"><code class="literal">CrshAutoConfiguration</code></a> and <a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/actuate/autoconfigure/ShellProperties.html" target="_top"><code class="literal">ShellProperties</code></a> Javadoc for full details.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="production-ready-extending-the-remote-shell" href="#production-ready-extending-the-remote-shell"></a>43.2 Extending the remote shell</h2></div></div></div><p>The remote shell can be extended in a number of interesting ways.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="production-ready-remote-commands" href="#production-ready-remote-commands"></a>43.2.1 Remote shell commands</h3></div></div></div><p>You can write additional shell commands using Groovy or Java (see the CRaSH documentation for details). By default Spring Boot will search for commands in the following locations:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><code class="literal">classpath*:/commands/**</code></li><li class="listitem"><code class="literal">classpath*:/crash/commands/**</code></li></ul></div><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>You can change the search path by settings a <code class="literal">shell.commandPathPatterns</code> property.</p></td></tr></tbody></table></div><p>Here is a simple ‘hello world’ command that could be loaded from <code class="literal">src/main/resources/commands/hello.groovy</code></p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">package</span> commands <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.crsh.cli.Usage <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.crsh.cli.Command <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> hello { <em><span class="hl-annotation" style="color: gray">@Usage("Say Hello")</span></em> <em><span class="hl-annotation" style="color: gray">@Command</span></em> def main(InvocationContext context) { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">return</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"Hello"</span> } }</pre><p>Spring Boot adds some additional attributes to <code class="literal">InvocationContext</code> that you can access from your command:</p><div class="informaltable"><table style="border-collapse: collapse;border-top: 0.5pt solid ; border-bottom: 0.5pt solid ; border-left: 0.5pt solid ; border-right: 0.5pt solid ; "><colgroup><col class="col_1"><col class="col_2"></colgroup><thead><tr><th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top">Attribute Name</th><th style="border-bottom: 0.5pt solid ; " align="left" valign="top">Description</th></tr></thead><tbody><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring.boot.version</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>The version of Spring Boot</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring.version</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>The version of the core Spring Framework</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring.beanfactory</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Access to the Spring <code class="literal">BeanFactory</code></p></td></tr><tr><td style="border-right: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring.environment</code></p></td><td style="" align="left" valign="top"><p>Access to the Spring <code class="literal">Environment</code></p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="production-ready-remote-shell-plugins" href="#production-ready-remote-shell-plugins"></a>43.2.2 Remote shell plugins</h3></div></div></div><p>In addition to new commands, it is also possible to extend other CRaSH shell features. All Spring Beans that extend <code class="literal">org.crsh.plugin.CRaSHPlugin</code> will be automatically registered with the shell.</p><p>For more information please refer to the <a class="link" href="http://www.crashub.org/" target="_top">CRaSH reference documentation</a>.</p></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="production-ready-metrics" href="#production-ready-metrics"></a>44. Metrics</h2></div></div></div><p>Spring Boot Actuator includes a metrics service with ‘gauge’ and ‘counter’ support. A ‘gauge’ records a single value; and a ‘counter’ records a delta (an increment or decrement). Spring Boot Actuator also provides a <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/PublicMetrics.java" target="_top"><code class="literal">PublicMetrics</code></a> interface that you can implement to expose metrics that you cannot record via one of those two mechanisms. Look at <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/SystemPublicMetrics.java" target="_top"><code class="literal">SystemPublicMetrics</code></a> for an example.</p><p>Metrics for all HTTP requests are automatically recorded, so if you hit the <code class="literal">metrics</code> endpoint you should see a response similar to this:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">{</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"counter.status.200.root"</span>: <span class="hl-number">20</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"counter.status.200.metrics"</span>: <span class="hl-number">3</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"counter.status.200.star-star"</span>: <span class="hl-number">5</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"counter.status.401.root"</span>: <span class="hl-number">4</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"gauge.response.star-star"</span>: <span class="hl-number">6</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"gauge.response.root"</span>: <span class="hl-number">2</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"gauge.response.metrics"</span>: <span class="hl-number">3</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"classes"</span>: <span class="hl-number">5808</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"classes.loaded"</span>: <span class="hl-number">5808</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"classes.unloaded"</span>: <span class="hl-number">0</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"heap"</span>: <span class="hl-number">3728384</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"heap.committed"</span>: <span class="hl-number">986624</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"heap.init"</span>: <span class="hl-number">262144</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"heap.used"</span>: <span class="hl-number">52765</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"mem"</span>: <span class="hl-number">986624</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"mem.free"</span>: <span class="hl-number">933858</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"processors"</span>: <span class="hl-number">8</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"threads"</span>: <span class="hl-number">15</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"threads.daemon"</span>: <span class="hl-number">11</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"threads.peak"</span>: <span class="hl-number">15</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"uptime"</span>: <span class="hl-number">494836</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"instance.uptime"</span>: <span class="hl-number">489782</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"datasource.primary.active"</span>: <span class="hl-number">5</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"datasource.primary.usage"</span>: <span class="hl-number">0.25</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">}</span></pre><p>Here we can see basic <code class="literal">memory</code>, <code class="literal">heap</code>, <code class="literal">class loading</code>, <code class="literal">processor</code> and <code class="literal">thread pool</code> information along with some HTTP metrics. In this instance the <code class="literal">root</code> (‘/’) and <code class="literal">/metrics</code> URLs have returned <code class="literal">HTTP 200</code> responses <code class="literal">20</code> and <code class="literal">3</code> times respectively. It also appears that the <code class="literal">root</code> URL returned <code class="literal">HTTP 401</code> (unauthorized) <code class="literal">4</code> times. The double asterix (<code class="literal">star-star</code>) comes from a request matched by Spring MVC as <code class="literal">/**</code> (normally a static resource).</p><p>The <code class="literal">gauge</code> shows the last response time for a request. So the last request to <code class="literal">root</code> took <code class="literal">2ms</code> to respond and the last to <code class="literal">/metrics</code> took <code class="literal">3ms</code>.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>In this example we are actually accessing the endpoint over HTTP using the <code class="literal">/metrics</code> URL, this explains why <code class="literal">metrics</code> appears in the response.</p></td></tr></tbody></table></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="production-ready-system-metrics" href="#production-ready-system-metrics"></a>44.1 System metrics</h2></div></div></div><p>The following system metrics are exposed by Spring Boot:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">The total system memory in Kb (<code class="literal">mem</code>)</li><li class="listitem">The amount of free memory in Kb (<code class="literal">mem.free</code>)</li><li class="listitem">The number of processors (<code class="literal">processors</code>)</li><li class="listitem">The system uptime in milliseconds (<code class="literal">uptime</code>)</li><li class="listitem">The application context uptime in milliseconds (<code class="literal">instance.uptime</code>)</li><li class="listitem">The average system load (<code class="literal">systemload.average</code>)</li><li class="listitem">Heap information in Kb (<code class="literal">heap</code>, <code class="literal">heap.committed</code>, <code class="literal">heap.init</code>, <code class="literal">heap.used</code>)</li><li class="listitem">Thread information (<code class="literal">threads</code>, <code class="literal">thread.peak</code>, <code class="literal">thead.daemon</code>)</li><li class="listitem">Class load information (<code class="literal">classes</code>, <code class="literal">classes.loaded</code>, <code class="literal">classes.unloaded</code>)</li><li class="listitem">Garbage collection information (<code class="literal">gc.xxx.count</code>, <code class="literal">gc.xxx.time</code>)</li></ul></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="production-ready-datasource-metrics" href="#production-ready-datasource-metrics"></a>44.2 DataSource metrics</h2></div></div></div><p>The following metrics are exposed for each supported <code class="literal">DataSource</code> defined in your application:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">The maximum number connections (<code class="literal">datasource.xxx.max</code>).</li><li class="listitem">The minimum number of connections (<code class="literal">datasource.xxx.min</code>).</li><li class="listitem">The number of active connections (<code class="literal">datasource.xxx.active</code>)</li><li class="listitem">The current usage of the connection pool (<code class="literal">datasource.xxx.usage</code>).</li></ul></div><p>All data source metrics share the <code class="literal">datasource.</code> prefix. The prefix is further qualified for each data source:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">If the data source is the primary data source (that is either the only available data source or the one flagged <code class="literal">@Primary</code> amongst the existing ones), the prefix is <code class="literal">datasource.primary</code>.</li><li class="listitem">If the data source bean name ends with <code class="literal">dataSource</code>, the prefix is the name of the bean without <code class="literal">dataSource</code> (i.e. <code class="literal">datasource.batch</code> for <code class="literal">batchDataSource</code>).</li><li class="listitem">In all other cases, the name of the bean is used.</li></ul></div><p>It is possible to override part or all of those defaults by registering a bean with a customized version of <code class="literal">DataSourcePublicMetrics</code>. By default, Spring Boot provides metadata for all supported datasources; you can add additional <code class="literal">DataSourcePoolMetadataProvider</code> beans if your favorite data source isn’t supported out of the box. See <code class="literal">DataSourcePoolMetadataProvidersConfiguration</code> for examples.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="production-ready-session-metrics" href="#production-ready-session-metrics"></a>44.3 Tomcat session metrics</h2></div></div></div><p>If you are using Tomcat as your embedded servlet container, session metrics will automatically be exposed. The <code class="literal">httpsessions.active</code> and <code class="literal">httpsessions.max</code> keys provide the number of active and maximum sessions.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="production-ready-recording-metrics" href="#production-ready-recording-metrics"></a>44.4 Recording your own metrics</h2></div></div></div><p>To record your own metrics inject a <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/CounterService.java" target="_top"><code class="literal">CounterService</code></a> and/or <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/GaugeService.java" target="_top"><code class="literal">GaugeService</code></a> into your bean. The <code class="literal">CounterService</code> exposes <code class="literal">increment</code>, <code class="literal">decrement</code> and <code class="literal">reset</code> methods; the <code class="literal">GaugeService</code> provides a <code class="literal">submit</code> method.</p><p>Here is a simple example that counts the number of times that a method is invoked:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.beans.factory.annotation.Autowired; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.boot.actuate.metrics.CounterService; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.stereotype.Service; <em><span class="hl-annotation" style="color: gray">@Service</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> MyService { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">private</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">final</span> CounterService counterService; <em><span class="hl-annotation" style="color: gray">@Autowired</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> MyService(CounterService counterService) { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">this</span>.counterService = counterService; } <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">void</span> exampleMethod() { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">this</span>.counterService.increment(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"services.system.myservice.invoked"</span>); } }</pre><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>You can use any string as a metric name but you should follow guidelines of your chosen store/graphing technology. Some good guidelines for Graphite are available on <a class="link" href="http://matt.aimonetti.net/posts/2013/06/26/practical-guide-to-graphite-monitoring/" target="_top">Matt Aimonetti’s Blog</a>.</p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="production-ready-public-metrics" href="#production-ready-public-metrics"></a>44.5 Adding your own public metrics</h2></div></div></div><p>To add additional metrics that are computed every time the metrics endpoint is invoked, simply register additional <code class="literal">PublicMetrics</code> implementation bean(s). By default, all such beans are gathered by the endpoint. You can easily change that by defining your own <code class="literal">MetricsEndpoint</code>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="production-ready-metric-repositories" href="#production-ready-metric-repositories"></a>44.6 Metric repositories</h2></div></div></div><p>Metric service implementations are usually bound to a <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/repository/MetricRepository.java" target="_top"><code class="literal">MetricRepository</code></a>. A <code class="literal">MetricRepository</code> is responsible for storing and retrieving metric information. Spring Boot provides an <code class="literal">InMemoryMetricRepository</code> and a <code class="literal">RedisMetricRepository</code> out of the box (the in-memory repository is the default) but you can also write your own. The <code class="literal">MetricRepository</code> interface is actually composed of higher level <code class="literal">MetricReader</code> and <code class="literal">MetricWriter</code> interfaces. For full details refer to the <a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/actuate/metrics/repository/MetricRepository.html" target="_top">Javadoc</a>.</p><p>There’s nothing to stop you hooking a <code class="literal">MetricRepository</code> with back-end storage directly into your app, but we recommend using the default <code class="literal">InMemoryMetricRepository</code> (possibly with a custom <code class="literal">Map</code> instance if you are worried about heap usage) and populating a back-end repository through a scheduled export job. In that way you get some buffering in memory of the metric values and you can reduce the network chatter by exporting less frequently or in batches. Spring Boot provides an <code class="literal">Exporter</code> interface and a few basic implementations for you to get started with that.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="production-ready-code-hale-metrics" href="#production-ready-code-hale-metrics"></a>44.7 Dropwizard Metrics</h2></div></div></div><p>User of the <a class="link" href="https://dropwizard.github.io/metrics/" target="_top">Dropwizard ‘Metrics’ library</a> will automatically find that Spring Boot metrics are published to <code class="literal">com.codahale.metrics.MetricRegistry</code>. A default <code class="literal">com.codahale.metrics.MetricRegistry</code> Spring bean will be created when you declare a dependency to the <code class="literal">io.dropwizard.metrics:metrics-core</code> library; you can also register you own <code class="literal">@Bean</code> instance if you need customizations. Metrics from the <code class="literal">MetricRegistry</code> are also automatically exposed via the <code class="literal">/metrics</code> endpoint</p><p>Users can create Dropwizard metrics by prefixing their metric names with the appropriate type (e.g. <code class="literal">histogram.*</code>, <code class="literal">meter.*</code>).</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="production-ready-metrics-message-channel-integration" href="#production-ready-metrics-message-channel-integration"></a>44.8 Message channel integration</h2></div></div></div><p>If the ‘Spring Messaging’ jar is on your classpath a <code class="literal">MessageChannel</code> called <code class="literal">metricsChannel</code> is automatically created (unless one already exists). All metric update events are additionally published as ‘messages’ on that channel. Additional analysis or actions can be taken by clients subscribing to that channel.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="production-ready-auditing" href="#production-ready-auditing"></a>45. Auditing</h2></div></div></div><p>Spring Boot Actuator has a flexible audit framework that will publish events once Spring Security is in play (‘authentication success’, ‘failure’ and ‘access denied’ exceptions by default). This can be very useful for reporting, and also to implement a lock-out policy based on authentication failures.</p><p>You can also choose to use the audit services for your own business events. To do that you can either inject the existing <code class="literal">AuditEventRepository</code> into your own components and use that directly, or you can simply publish <code class="literal">AuditApplicationEvent</code> via the Spring <code class="literal">ApplicationEventPublisher</code> (using <code class="literal">ApplicationEventPublisherAware</code>).</p></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="production-ready-tracing" href="#production-ready-tracing"></a>46. Tracing</h2></div></div></div><p>Tracing is automatically enabled for all HTTP requests. You can view the <code class="literal">trace</code> endpoint and obtain basic information about the last few requests:</p><pre class="programlisting">[<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">{</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"timestamp"</span>: <span class="hl-number">1394343677415</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"info"</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">{</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"method"</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"GET"</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"path"</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"/trace"</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"headers"</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">{</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"request"</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">{</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"Accept"</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"Connection"</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"keep-alive"</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"Accept-Encoding"</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"gzip, deflate"</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"User-Agent"</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"Mozilla/5.0 Gecko/Firefox"</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"Accept-Language"</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"en-US,en;q=0.5"</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"Cookie"</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"_ga=GA1.1.827067509.1390890128; ..."</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"Authorization"</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"Basic ..."</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"Host"</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"localhost:8080"</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">},</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"response"</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">{</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"Strict-Transport-Security"</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"max-age=31536000 ; includeSubDomains"</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"X-Application-Context"</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"application:8080"</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"Content-Type"</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"application/json;charset=UTF-8"</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"status"</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"200"</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">}</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">}</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">}</span> },<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">{</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"timestamp"</span>: <span class="hl-number">1394343684465</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span> ... <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">}]</span></pre><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="production-ready-custom-tracing" href="#production-ready-custom-tracing"></a>46.1 Custom tracing</h2></div></div></div><p>If you need to trace additional events you can inject a <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/trace/TraceRepository.java" target="_top"><code class="literal">TraceRepository</code></a> into your Spring Beans. The <code class="literal">add</code> method accepts a single <code class="literal">Map</code> structure that will be converted to JSON and logged.</p><p>By default an <code class="literal">InMemoryTraceRepository</code> will be used that stores the last 100 events. You can define your own instance of the <code class="literal">InMemoryTraceRepository</code> bean if you need to expand the capacity. You can also create your own alternative <code class="literal">TraceRepository</code> implementation if needed.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="production-ready-process-monitoring" href="#production-ready-process-monitoring"></a>47. Process monitoring</h2></div></div></div><p>In Spring Boot Actuator you can find a couple of classes to create files that are useful for process monitoring:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><code class="literal">ApplicationPidFileWriter</code> creates a file containing the application PID (by default in the application directory with the file name <code class="literal">application.pid</code>).</li><li class="listitem"><code class="literal">EmbeddedServerPortFileWriter</code> creates a file (or files) containing the ports of the embedded server (by default in the application directory with the file name <code class="literal">application.port</code>).</li></ul></div><p>These writers are not activated by default, but you can enable them in one of the ways described below.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="production-ready-process-monitoring-configuration" href="#production-ready-process-monitoring-configuration"></a>47.1 Extend configuration</h2></div></div></div><p>In <code class="literal">META-INF/spring.factories</code> file you have to activate the listener(s):</p><pre class="screen">org.springframework.context.ApplicationListener=\ org.springframework.boot.actuate.system.ApplicationPidFileWriter, org.springframework.boot.actuate.system.EmbeddedServerPortFileWriter</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="production-ready-process-monitoring-programmatically" href="#production-ready-process-monitoring-programmatically"></a>47.2 Programmatically</h2></div></div></div><p>You can also activate a listener by invoking the <code class="literal">SpringApplication.addListeners(…)</code> method and passing the appropriate <code class="literal">Writer</code> object. This method also allows you to customize the file name and path via the <code class="literal">Writer</code> constructor.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="production-ready-whats-next" href="#production-ready-whats-next"></a>48. What to read next</h2></div></div></div><p>If you want to explore some of the concepts discussed in this chapter, you can take a look at the actuator <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-samples" target="_top">sample applications</a>. You also might want to read about graphing tools such as <a class="link" href="http://graphite.wikidot.com/" target="_top">Graphite</a>.</p><p>Otherwise, you can continue on, to read about <a class="link" href="#cloud-deployment" title="Part VI. Deploying to the cloud">‘cloud deployment options’</a> or jump ahead for some in-depth information about Spring Boot’s <span class="emphasis"><em><a class="link" href="#build-tool-plugins" title="Part VIII. Build tool plugins">build tool plugins</a></em></span>.</p></div></div><div class="part"><div class="titlepage"><div><div><h1 class="title"><a name="cloud-deployment" href="#cloud-deployment"></a>Part VI. Deploying to the cloud</h1></div></div></div><div class="partintro"><div></div><p>Spring Boot’s executable jars are ready-made for most popular cloud PaaS (platform-as-a-service) providers. These providers tend to require that you “bring your own container”; they manage application processes (not Java applications specifically), so they need some intermediary layer that adapts <span class="emphasis"><em>your</em></span> application to the <span class="emphasis"><em>cloud’s</em></span> notion of a running process.</p><p>Two popular cloud providers, Heroku and Cloud Foundry, employ a “buildpack” approach. The buildpack wraps your deployed code in whatever is needed to <span class="emphasis"><em>start</em></span> your application: it might be a JDK and a call to <code class="literal">java</code>, it might be an embedded webserver, or it might be a full-fledged application server. A buildpack is pluggable, but ideally you should be able to get by with as few customizations to it as possible. This reduces the footprint of functionality that is not under your control. It minimizes divergence between deployment and production environments.</p><p>Ideally, your application, like a Spring Boot executable jar, has everything that it needs to run packaged within it.</p><p>In this section we’ll look at what it takes to get the <a class="link" href="#getting-started-first-application" title="11. Developing your first Spring Boot application">simple application that we developed</a> in the “Getting Started” section up and running in the Cloud.</p></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="cloud-deployment-cloud-foundry" href="#cloud-deployment-cloud-foundry"></a>49. Cloud Foundry</h2></div></div></div><p>Cloud Foundry provides default buildpacks that come into play if no other buildpack is specified. The Cloud Foundry <a class="link" href="https://github.com/cloudfoundry/java-buildpack" target="_top">Java buildpack</a> has excellent support for Spring applications, including Spring Boot. You can deploy stand-alone executable jar applications, as well as traditional <code class="literal">.war</code> packaged applications.</p><p>Once you’ve built your application (using, for example, <code class="literal">mvn clean package</code>) and <a class="link" href="http://docs.cloudfoundry.org/devguide/installcf/install-go-cli.html" target="_top">installed the <code class="literal">cf</code> command line tool</a>, simply deploy your application using the <code class="literal">cf push</code> command as follows, substituting the path to your compiled <code class="literal">.jar</code>. Be sure to have <a class="link" href="http://docs.cloudfoundry.org/devguide/installcf/whats-new-v6.html#login" target="_top">logged in with your <code class="literal">cf</code> command line client</a> before pushing an application.</p><pre class="screen">$ cf push acloudyspringtime -p target/demo-0.0.1-SNAPSHOT.jar</pre><p>See the <a class="link" href="http://docs.cloudfoundry.org/devguide/installcf/whats-new-v6.html#push" target="_top"><code class="literal">cf push</code> documentation</a> for more options. If there is a Cloud Foundry <a class="link" href="http://docs.cloudfoundry.org/devguide/deploy-apps/manifest.html" target="_top"><code class="literal">manifest.yml</code></a> file present in the same directory, it will be consulted.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>Here we are substituting <code class="literal">acloudyspringtime</code> for whatever value you give <code class="literal">cf</code> as the name of your application.</p></td></tr></tbody></table></div><p>At this point <code class="literal">cf</code> will start uploading your application:</p><pre class="screen">Uploading acloudyspringtime... <span class="strong"><strong>OK</strong></span> Preparing to start acloudyspringtime... <span class="strong"><strong>OK</strong></span> -----> Downloaded app package (<span class="strong"><strong>8.9M</strong></span>) -----> Java Buildpack source: system -----> Downloading Open JDK 1.7.0_51 from .../x86_64/openjdk-1.7.0_51.tar.gz (<span class="strong"><strong>1.8s</strong></span>) Expanding Open JDK to .java-buildpack/open_jdk (<span class="strong"><strong>1.2s</strong></span>) -----> Downloading Spring Auto Reconfiguration from 0.8.7 .../auto-reconfiguration-0.8.7.jar (<span class="strong"><strong>0.1s</strong></span>) -----> Uploading droplet (<span class="strong"><strong>44M</strong></span>) Checking status of app 'acloudyspringtime'... 0 of 1 instances running (1 starting) ... 0 of 1 instances running (1 down) ... 0 of 1 instances running (1 starting) ... 1 of 1 instances running (1 running) App started</pre><p>Congratulations! The application is now live!</p><p>It’s easy to then verify the status of the deployed application:</p><pre class="screen">$ cf apps Getting applications in ... OK name requested state instances memory disk urls ... acloudyspringtime started 1/1 512M 1G acloudyspringtime.cfapps.io ...</pre><p>Once Cloud Foundry acknowledges that your application has been deployed, you should be able to hit the application at the URI given, in this case <code class="literal"><a class="link" href="http://acloudyspringtime.cfapps.io/" target="_top">acloudyspringtime.cfapps.io/</a></code>.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="cloud-deployment-cloud-foundry-services" href="#cloud-deployment-cloud-foundry-services"></a>49.1 Binding to services</h2></div></div></div><p>By default, metadata about the running application as well as service connection information is exposed to the application as environment variables (for example: <code class="literal">$VCAP_SERVICES</code>). This architecture decision is due to Cloud Foundry’s polyglot (any language and platform can be supported as a buildpack) nature; process-scoped environment variables are language agnostic.</p><p>Environment variables don’t always make for the easiest API so Spring Boot automatically extracts them and flattens the data into properties that can be accessed through Spring’s <code class="literal">Environment</code> abstraction:</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@Component</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> MyBean <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">implements</span> EnvironmentAware { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">private</span> String instanceId; <em><span class="hl-annotation" style="color: gray">@Override</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">void</span> setEnvironment(Environment environment) { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">this</span>.instanceId = environment.getProperty(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"vcap.application.instance_id"</span>); } <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// ...</span> }</pre><p>All Cloud Foundry properties are prefixed with <code class="literal">vcap</code>. You can use vcap properties to access application information (such as the public URL of the application) and service information (such as database credentials). See <code class="literal">VcapApplicationListener</code> Javdoc for complete details.</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>The <a class="link" href="http://cloud.spring.io/spring-cloud-connectors/" target="_top">Spring Cloud Connectors</a> project is a better fit for tasks such as configuring a DataSource. Spring Boot includes auto-configuration support and a <code class="literal">spring-boot-starter-cloud-connectors</code> starter POM.</p></td></tr></tbody></table></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="cloud-deployment-heroku" href="#cloud-deployment-heroku"></a>50. Heroku</h2></div></div></div><p>Heroku is another popular PaaS platform. To customize Heroku builds, you provide a <code class="literal">Procfile</code>, which provides the incantation required to deploy an application. Heroku assigns a <code class="literal">port</code> for the Java application to use and then ensures that routing to the external URI works.</p><p>You must configure your application to listen on the correct port. Here’s the <code class="literal">Procfile</code> for our starter REST application:</p><pre class="screen">web: java -Dserver.port=$PORT -jar target/demo-0.0.1-SNAPSHOT.jar</pre><p>Spring Boot makes <code class="literal">-D</code> arguments available as properties accessible from a Spring <code class="literal">Environment</code> instance. The <code class="literal">server.port</code> configuration property is fed to the embedded Tomcat, Jetty or Undertow instance which then uses it when it starts up. The <code class="literal">$PORT</code> environment variable is assigned to us by the Heroku PaaS.</p><p>Heroku by default will use Java 1.6. This is fine as long as your Maven or Gradle build is set to use the same version (Maven users can use the <code class="literal">java.version</code> property). If you want to use JDK 1.7, create a new file adjacent to your <code class="literal">pom.xml</code> and <code class="literal">Procfile</code>, called <code class="literal">system.properties</code>. In this file add the following:</p><pre class="programlisting">java.runtime.version=<span class="hl-number">1.7</span></pre><p>This should be everything you need. The most common workflow for Heroku deployments is to <code class="literal">git push</code> the code to production.</p><pre class="screen">$ git push heroku master Initializing repository, <span class="strong"><strong>done</strong></span>. Counting objects: 95, <span class="strong"><strong>done</strong></span>. Delta compression using up to 8 threads. Compressing objects: 100% (78/78), <span class="strong"><strong>done</strong></span>. Writing objects: 100% (95/95), 8.66 MiB | 606.00 KiB/s, <span class="strong"><strong>done</strong></span>. Total 95 (delta 31), reused 0 (delta 0) -----> Java app detected -----> Installing OpenJDK 1.7... <span class="strong"><strong>done</strong></span> -----> Installing Maven 3.2.3... <span class="strong"><strong>done</strong></span> -----> Installing settings.xml... <span class="strong"><strong>done</strong></span> -----> executing /app/tmp/cache/.maven/bin/mvn -B -Duser.home=/tmp/build_0c35a5d2-a067-4abc-a232-14b1fb7a8229 -Dmaven.repo.local=/app/tmp/cache/.m2/repository -s /app/tmp/cache/.m2/settings.xml -DskipTests=true clean install [INFO] Scanning for projects... Downloading: http://repo.spring.io/... Downloaded: http://repo.spring.io/... (818 B at 1.8 KB/sec) .... Downloaded: http://s3pository.heroku.com/jvm/... (152 KB at 595.3 KB/sec) [INFO] Installing /tmp/build_0c35a5d2-a067-4abc-a232-14b1fb7a8229/target/... [INFO] Installing /tmp/build_0c35a5d2-a067-4abc-a232-14b1fb7a8229/pom.xml ... [INFO] ------------------------------------------------------------------------ [INFO] <span class="strong"><strong>BUILD SUCCESS</strong></span> [INFO] ------------------------------------------------------------------------ [INFO] Total time: 59.358s [INFO] Finished at: Fri Mar 07 07:28:25 UTC 2014 [INFO] Final Memory: 20M/493M [INFO] ------------------------------------------------------------------------ -----> Discovering process types Procfile declares types -> <span class="strong"><strong>web</strong></span> -----> Compressing... <span class="strong"><strong>done</strong></span>, 70.4MB -----> Launching... <span class="strong"><strong>done</strong></span>, v6 http://agile-sierra-1405.herokuapp.com/ <span class="strong"><strong>deployed to Heroku</strong></span> To git@heroku.com<script id="undefined" src="Spring%20Boot%20Reference%20Guide_files/inpage_linkid.js" async="" type="text/javascript"></script><script src="Spring%20Boot%20Reference%20Guide_files/ga.js" async="" type="text/javascript"></script><script cf-hash="f9e31" type="text/javascript"> /* <![CDATA[ */!function(){try{var t="currentScript"in document?document.currentScript:function(){for(var t=document.getElementsByTagName("script"),e=t.length;e--;)if(t[e].getAttribute("cf-hash"))return t[e]}();if(t&&t.previousSibling){var e,r,n,i,c=t.previousSibling,a=c.getAttribute("data-cfemail");if(a){for(e="",r=parseInt(a.substr(0,2),16),n=2;a.length-n;n+=2)i=parseInt(a.substr(n,2),16)^r,e+=String.fromCharCode(i);e=document.createTextNode(e),c.parentNode.replaceChild(e,c)}}}catch(u){}}();/* ]]> */</script>:agile-sierra-1405.git * [new branch] master -> master</pre><p>Your application should now be up and running on Heroku.</p></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="cloud-deployment-openshift" href="#cloud-deployment-openshift"></a>51. Openshift</h2></div></div></div><p><a class="link" href="https://www.openshift.com/" target="_top">Openshift</a> is the RedHat public (and enterprise) PaaS solution. Like Heroku, it works by running scripts triggered by git commits, so you can script the launching of a Spring Boot application in pretty much any way you like as long as the Java runtime is available (which is a standard feature you can ask for at Openshift). To do this you can use the <a class="link" href="https://www.openshift.com/developers/do-it-yourself" target="_top">DIY Cartridge</a> and hooks in your repository under <code class="literal">.openshift/action_scripts</code>:</p><p>The basic model is to:</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">Ensure Java and your build tool are installed remotely, e.g. using a <code class="literal">pre_build</code> hook (Java and Maven are installed by default, Gradle is not)</li><li class="listitem"><p class="simpara">Use a <code class="literal">build</code> hook to build your jar (using Maven or Gradle), e.g.</p><pre class="screen">#!/bin/bash cd $OPENSHIFT_REPO_DIR mvn package -s .openshift/settings.xml -DskipTests=true</pre></li><li class="listitem"><p class="simpara">Add a <code class="literal">start</code> hook that calls <code class="literal">java -jar …</code></p><pre class="screen">#!/bin/bash cd $OPENSHIFT_REPO_DIR nohup java -jar target/*.jar --server.port=${OPENSHIFT_DIY_PORT} --server.address=${OPENSHIFT_DIY_IP} &</pre></li><li class="listitem"><p class="simpara">Use a <code class="literal">stop</code> hook (since the start is supposed to return cleanly), e.g.</p><pre class="screen">#!/bin/bash source $OPENSHIFT_CARTRIDGE_SDK_BASH PID=$(ps -ef | grep java.*\.jar | grep -v grep | awk '{ print $2 }') if [ -z "$PID" ] then client_result "Application is already stopped" else kill $PID fi</pre></li><li class="listitem"><p class="simpara">Embed service bindings from environment variables provided by the platform in your <code class="literal">application.properties</code>, e.g.</p><pre class="screen">spring.datasource.url: jdbc:mysql://${OPENSHIFT_MYSQL_DB_HOST}:${OPENSHIFT_MYSQL_DB_PORT}/${OPENSHIFT_APP_NAME} spring.datasource.username: ${OPENSHIFT_MYSQL_DB_USERNAME} spring.datasource.password: ${OPENSHIFT_MYSQL_DB_PASSWORD}</pre></li></ol></div><p>There’s a blog on <a class="link" href="https://www.openshift.com/blogs/run-gradle-builds-on-openshift" target="_top">running Gradle in Openshift</a> on their website that will get you started with a gradle build to run the app. A <a class="link" href="http://issues.gradle.org/browse/GRADLE-2871" target="_top">bug in Gradle</a> currently prevents you from using Gradle newer than 1.6.</p></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="cloud-deployment-gae" href="#cloud-deployment-gae"></a>52. Google App Engine</h2></div></div></div><p>Google App Engine is tied to the Servlet 2.5 API, so you can’t deploy a Spring Application there without some modifications. See the <a class="link" href="#howto-servlet-2-5" title="74.5 Deploying a WAR in an Old (Servlet 2.5) Container">Servlet 2.5 section</a> of this guide.</p></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="cloud-deployment-whats-next" href="#cloud-deployment-whats-next"></a>53. What to read next</h2></div></div></div><p>Check out the <a class="link" href="http://www.cloudfoundry.com/" target="_top">Cloud Foundry</a>, <a class="link" href="https://www.heroku.com/" target="_top">Heroku</a> and <a class="link" href="https://www.openshift.com/" target="_top">Openshift</a> web sites for more information about the kinds of features that a PaaS can offer. These are just three of the most popular Java PaaS providers, since Spring Boot is so amenable to cloud-based deployment you’re free to consider other providers as well.</p><p>The next section goes on to cover the <span class="emphasis"><em><a class="link" href="#cli" title="Part VII. Spring Boot CLI">Spring Boot CLI</a></em></span>; or you can jump ahead to read about <span class="emphasis"><em><a class="link" href="#build-tool-plugins" title="Part VIII. Build tool plugins">build tool plugins</a></em></span>.</p></div></div><div class="part"><div class="titlepage"><div><div><h1 class="title"><a name="cli" href="#cli"></a>Part VII. Spring Boot CLI</h1></div></div></div><div class="partintro"><div></div><p>The Spring Boot CLI is a command line tool that can be used if you want to quickly develop with Spring. It allows you to run Groovy scripts, which means that you have a familiar Java-like syntax, without so much boilerplate code. You can also bootstrap a new project or write your own command for it.</p></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="cli-installation" href="#cli-installation"></a>54. Installing the CLI</h2></div></div></div><p>The Spring Boot CLI can be installed manually; using GVM (the Groovy Environment Manually) or using Homebrew or MacPorts if you are an OSX user. See <span class="emphasis"><em><a class="xref" href="#getting-started-installing-the-cli" title="10.2 Installing the Spring Boot CLI">Section 10.2, “Installing the Spring Boot CLI”</a></em></span> in the “Getting started” section for comprehensive installation instructions.</p></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="cli-using-the-cli" href="#cli-using-the-cli"></a>55. Using the CLI</h2></div></div></div><p>Once you have installed the CLI you can run it by typing <code class="literal">spring</code>. If you run <code class="literal">spring</code> without any arguments, a simple help screen is displayed:</p><pre class="screen">$ spring usage: spring [--help] [--version] <command> [<args>] Available commands are: run [options] <files> [--] [args] Run a spring groovy script <span class="emphasis"><em>... more command help is shown here</em></span></pre><p>You can use <code class="literal">help</code> to get more details about any of the supported commands. For example:</p><pre class="screen">$ spring help run spring run - Run a spring groovy script usage: spring run [options] <files> [--] [args] Option Description ------ ----------- --autoconfigure [Boolean] Add autoconfigure compiler transformations (default: true) --classpath, -cp Additional classpath entries -e, --edit Open the file with the default system editor --no-guess-dependencies Do not attempt to guess dependencies --no-guess-imports Do not attempt to guess imports -q, --quiet Quiet logging -v, --verbose Verbose logging of dependency resolution --watch Watch the specified file for changes</pre><p>The <code class="literal">version</code> command provides a quick way to check which version of Spring Boot you are using.</p><pre class="screen">$ spring version Spring CLI v1.2.2.RELEASE</pre><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="cli-run" href="#cli-run"></a>55.1 Running applications using the CLI</h2></div></div></div><p>You can compile and run Groovy source code using the <code class="literal">run</code> command. The Spring Boot CLI is completely self-contained so you don’t need any external Groovy installation.</p><p>Here is an example “hello world” web application written in Groovy:</p><p><b>hello.groovy. </b> </p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@RestController</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> WebApplication { <em><span class="hl-annotation" style="color: gray">@RequestMapping("/")</span></em> String home() { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"Hello World!"</span> } }</pre><p> </p><p>To compile and run the application type:</p><pre class="screen">$ spring run hello.groovy</pre><p>To pass command line arguments to the application, you need to use a <code class="literal">--</code> to separate them from the “spring” command arguments, e.g.</p><pre class="screen">$ spring run hello.groovy -- --server.port=9000</pre><p>To set JVM command line arguments you can use the <code class="literal">JAVA_OPTS</code> environment variable, e.g.</p><pre class="screen">$ JAVA_OPTS=-Xmx1024m spring run hello.groovy</pre><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="cli-deduced-grab-annotations" href="#cli-deduced-grab-annotations"></a>55.1.1 Deduced “grab” dependencies</h3></div></div></div><p>Standard Groovy includes a <code class="literal">@Grab</code> annotation which allows you to declare dependencies on a third-party libraries. This useful technique allows Groovy to download jars in the same way as Maven or Gradle would, but without requiring you to use a build tool.</p><p>Spring Boot extends this technique further, and will attempt to deduce which libraries to “grab” based on your code. For example, since the <code class="literal">WebApplication</code> code above uses <code class="literal">@RestController</code> annotations, “Tomcat” and “Spring MVC” will be grabbed.</p><p>The following items are used as “grab hints”:</p><div class="informaltable"><table style="border-collapse: collapse;border-top: 0.5pt solid ; border-bottom: 0.5pt solid ; border-left: 0.5pt solid ; border-right: 0.5pt solid ; "><colgroup><col class="col_1"><col class="col_2"></colgroup><thead><tr><th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top">Items</th><th style="border-bottom: 0.5pt solid ; " align="left" valign="top">Grabs</th></tr></thead><tbody><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">JdbcTemplate</code>, <code class="literal">NamedParameterJdbcTemplate</code>, <code class="literal">DataSource</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>JDBC Application.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">@EnableJms</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>JMS Application.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">@EnableCaching</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Caching abstraction.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">@Test</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>JUnit.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">@EnableRabbit</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>RabbitMQ.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">@EnableReactor</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Project Reactor.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>extends <code class="literal">Specification</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Spock test.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">@EnableBatchProcessing</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Spring Batch.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">@MessageEndpoint</code> <code class="literal">@EnableIntegrationPatterns</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Spring Integration.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">@EnableDeviceResolver</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Spring Mobile.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">@Controller</code> <code class="literal">@RestController</code> <code class="literal">@EnableWebMvc</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Spring MVC + Embedded Tomcat.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">@EnableWebSecurity</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Spring Security.</p></td></tr><tr><td style="border-right: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">@EnableTransactionManagement</code></p></td><td style="" align="left" valign="top"><p>Spring Transaction Management.</p></td></tr></tbody></table></div><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>See subclasses of <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/CompilerAutoConfiguration.java" target="_top"><code class="literal">CompilerAutoConfiguration</code></a> in the Spring Boot CLI source code to understand exactly how customizations are applied.</p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="cli-default-grab-deduced-coordinates" href="#cli-default-grab-deduced-coordinates"></a>55.1.2 Deduced “grab” coordinates</h3></div></div></div><p>Spring Boot extends Groovy’s standard <code class="literal">@Grab</code> support by allowing you to specify a dependency without a group or version, for example <code class="literal">@Grab('freemarker')</code>. This will consult Spring Boot’s default dependency metadata to deduce the artifact’s group and version. Note that the default metadata is tied to the version of the CLI that you’re using – it will only change when you move to a new version of the CLI, putting you in control of when the versions of your dependencies may change. A table showing the dependencies and their versions that are included in the default metadata can be found in the <a class="link" href="#appendix-dependency-versions" title="Appendix E. Dependency versions">appendix</a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="cli-default-import-statements" href="#cli-default-import-statements"></a>55.1.3 Default import statements</h3></div></div></div><p>To help reduce the size of your Groovy code, several <code class="literal">import</code> statements are automatically included. Notice how the example above refers to <code class="literal">@Component</code>, <code class="literal">@RestController</code> and <code class="literal">@RequestMapping</code> without needing to use fully-qualified names or <code class="literal">import</code> statements.</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>Many Spring annotations will work without using <code class="literal">import</code> statements. Try running your application to see what fails before adding imports.</p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="cli-automatic-main-method" href="#cli-automatic-main-method"></a>55.1.4 Automatic main method</h3></div></div></div><p>Unlike the equivalent Java application, you do not need to include a <code class="literal">public static void main(String[] args)</code> method with your <code class="literal">Groovy</code> scripts. A <code class="literal">SpringApplication</code> is automatically created, with your compiled code acting as the <code class="literal">source</code>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="cli-default-grab-deduced-coordinates-custom-metadata" href="#cli-default-grab-deduced-coordinates-custom-metadata"></a>55.1.5 Custom “grab” metadata</h3></div></div></div><p>Spring Boot provides a new <code class="literal">@GrabMetadata</code> annotation that can be used to provide custom dependency metadata that overrides Spring Boot’s defaults. This metadata is specified by using the annotation to provide coordinates of one or more properties files (deployed to a Maven repository with a “type” identifier of <code class="literal">properties</code>). Each entry in each properties file must be in the form <code class="literal">group:module=version</code>.</p><p>For example, the following declaration:</p><pre class="programlisting">`@GrabMetadata(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"com.example.custom-versions:1.0.0"</span>)`</pre><p>Will pick up <code class="literal">custom-versions-1.0.0.properties</code> in a Maven repository under <code class="literal">com/example/custom-versions/1.0.0/</code>.</p><p>Multiple properties files can be specified from the annotation, they will be applied in the order that they’re declared. For example:</p><pre class="programlisting">`@GrabMetadata([<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"com.example.custom-versions:1.0.0"</span>, <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"com.example.more-versions:1.0.0"</span>])`</pre><p>indicates that properties in <code class="literal">more-versions</code> will override properties in <code class="literal">custom-versions</code>.</p><p>You can use <code class="literal">@GrabMetadata</code> anywhere that you can use <code class="literal">@Grab</code>, however, to ensure consistent ordering of the metadata, you can only use <code class="literal">@GrabMetadata</code> at most once in your application. A useful source of dependency metadata (a superset of Spring Boot) is the <a class="link" href="http://platform.spring.io/" target="_top">Spring IO Platform</a>, e.g. <code class="literal">@GrabMetadata('io.spring.platform:platform-versions:1.0.4.RELEASE')</code>.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="cli-testing" href="#cli-testing"></a>55.2 Testing your code</h2></div></div></div><p>The <code class="literal">test</code> command allows you to compile and run tests for your application. Typical usage looks like this:</p><pre class="screen">$ spring test app.groovy tests.groovy Total: 1, Success: 1, : Failures: 0 Passed? true</pre><p>In this example, <code class="literal">tests.groovy</code> contains JUnit <code class="literal">@Test</code> methods or Spock <code class="literal">Specification</code> classes. All the common framework annotations and static methods should be available to you without having to <code class="literal">import</code> them.</p><p>Here is the <code class="literal">tests.groovy</code> file that we used above (with a JUnit test):</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> ApplicationTests { <em><span class="hl-annotation" style="color: gray">@Test</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">void</span> homeSaysHello() { assertEquals(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"Hello World!"</span>, <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">new</span> WebApplication().home()) } }</pre><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>If you have more than one test source files, you might prefer to organize them into a <code class="literal">test</code> directory.</p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="cli-multiple-source-files" href="#cli-multiple-source-files"></a>55.3 Applications with multiple source files</h2></div></div></div><p>You can use “shell globbing” with all commands that accept file input. This allows you to easily use multiple files from a single directory, e.g.</p><pre class="screen">$ spring run *.groovy</pre><p>This technique can also be useful if you want to segregate your “test” or “spec” code from the main application code:</p><pre class="screen">$ spring test app/*.groovy test/*.groovy</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="cli-jar" href="#cli-jar"></a>55.4 Packaging your application</h2></div></div></div><p>You can use the <code class="literal">jar</code> command to package your application into a self-contained executable jar file. For example:</p><pre class="screen">$ spring jar my-app.jar *.groovy</pre><p>The resulting jar will contain the classes produced by compiling the application and all of the application’s dependencies so that it can then be run using <code class="literal">java -jar</code>. The jar file will also contain entries from the application’s classpath. You can add explicit paths to the jar using <code class="literal">--include</code> and <code class="literal">--exclude</code> (both are comma-separated, and both accept prefixes to the values “+” and “-” to signify that they should be removed from the defaults). The default includes are</p><pre class="screen">public/**, resources/**, static/**, templates/**, META-INF/**, *</pre><p>and the default excludes are</p><pre class="screen">.*, repository/**, build/**, target/**, **/*.jar, **/*.groovy</pre><p>See the output of <code class="literal">spring help jar</code> for more information.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="cli-init" href="#cli-init"></a>55.5 Initialize a new project</h2></div></div></div><p>The <code class="literal">init</code> command allows you to create a new project using <a class="link" href="https://start.spring.io/" target="_top">start.spring.io</a> without leaving the shell. For example:</p><pre class="screen">$ spring init --dependencies=web,data-jpa my-project Using service at https://start.spring.io Project extracted to '/Users/developer/example/my-project'</pre><p>This creates a <code class="literal">my-project</code> directory with a Maven-based project using <code class="literal">spring-boot-starter-web</code> and <code class="literal">spring-boot-starter-data-jpa</code>. You can list the capabilities of the service using the <code class="literal">--list</code> flag</p><pre class="screen">$ spring init --list ======================================= Capabilities of https://start.spring.io ======================================= Available dependencies: ----------------------- actuator - Actuator: Production ready features to help you monitor and manage your application ... web - Web: Support for full-stack web development, including Tomcat and spring-webmvc websocket - Websocket: Support for WebSocket development ws - WS: Support for Spring Web Services Available project types: ------------------------ gradle-build - Gradle Config [format:build, build:gradle] gradle-project - Gradle Project [format:project, build:gradle] maven-build - Maven POM [format:build, build:maven] maven-project - Maven Project [format:project, build:maven] (default) ...</pre><p>The <code class="literal">init</code> command supports many options, check the <code class="literal">help</code> output for more details. For instance, the following command creates a gradle project using Java 8 and <code class="literal">war</code> packaging:</p><pre class="screen">$ spring init --build=gradle --java-version=1.8 --dependencies=websocket --packaging=war sample-app.zip Using service at https://start.spring.io Content saved to 'sample-app.zip'</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="cli-shell" href="#cli-shell"></a>55.6 Using the embedded shell</h2></div></div></div><p>Spring Boot includes command-line completion scripts for BASH and zsh shells. If you don’t use either of these shells (perhaps you are a Windows user) then you can use the <code class="literal">shell</code> command to launch an integrated shell.</p><pre class="screen">$ spring shell <span class="strong"><strong>Spring Boot</strong></span> (v1.2.2.RELEASE) Hit TAB to complete. Type \'help' and hit RETURN for help, and \'exit' to quit.</pre><p>From inside the embedded shell you can run other commands directly:</p><pre class="screen">$ version Spring CLI v1.2.2.RELEASE</pre><p>The embedded shell supports ANSI color output as well as <code class="literal">tab</code> completion. If you need to run a native command you can use the <code class="literal">$</code> prefix. Hitting <code class="literal">ctrl-c</code> will exit the embedded shell.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="cli-install-uninstall" href="#cli-install-uninstall"></a>55.7 Adding extensions to the CLI</h2></div></div></div><p>You can add extensions to the CLI using the <code class="literal">install</code> command. The command takes one or more sets of artifact coordinates in the format <code class="literal">group:artifact:version</code>. For example:</p><pre class="screen">$ spring install com.example:spring-boot-cli-extension:1.0.0.RELEASE</pre><p>In addition to installing the artifacts identified by the coordinates you supply, all of the artifacts' dependencies will also be installed.</p><p>To uninstall a dependency use the <code class="literal">uninstall</code> command. As with the <code class="literal">install</code> command, it takes one or more sets of artifact coordinates in the format <code class="literal">group:artifact:version</code>. For example:</p><pre class="screen">$ spring uninstall com.example:spring-boot-cli-extension:1.0.0.RELEASE</pre><p>It will uninstall the artifacts identified by the coordinates you supply and their dependencies.</p><p>To uninstall all additional dependencies you can use the <code class="literal">--all</code> option. For example:</p><pre class="screen">$ spring uninstall --all</pre></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="cli-groovy-beans-dsl" href="#cli-groovy-beans-dsl"></a>56. Developing application with the Groovy beans DSL</h2></div></div></div><p>Spring Framework 4.0 has native support for a <code class="literal">beans{}</code> “DSL” (borrowed from <a class="link" href="http://grails.org/" target="_top">Grails</a>), and you can embed bean definitions in your Groovy application scripts using the same format. This is sometimes a good way to include external features like middleware declarations. For example:</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@Configuration</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> Application <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">implements</span> CommandLineRunner { <em><span class="hl-annotation" style="color: gray">@Autowired</span></em> SharedService service <em><span class="hl-annotation" style="color: gray">@Override</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">void</span> run(String... args) { println service.message } } <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> my.company.SharedService beans { service(SharedService) { message = <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"Hello World"</span> } }</pre><p>You can mix class declarations with <code class="literal">beans{}</code> in the same file as long as they stay at the top level, or you can put the beans DSL in a separate file if you prefer.</p></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="cli-whats-next" href="#cli-whats-next"></a>57. What to read next</h2></div></div></div><p>There are some <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-cli/samples" target="_top">sample groovy scripts</a> available from the GitHub repository that you can use to try out the Spring Boot CLI. There is also extensive javadoc throughout the <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-cli/src/main/java/org/springframework/boot/cli" target="_top">source code</a>.</p><p>If you find that you reach the limit of the CLI tool, you will probably want to look at converting your application to full Gradle or Maven built “groovy project”. The next section covers Spring Boot’s <span class="emphasis"><em><a class="link" href="#build-tool-plugins" title="Part VIII. Build tool plugins">Build tool plugins</a></em></span> that you can use with Gradle or Maven.</p></div></div><div class="part"><div class="titlepage"><div><div><h1 class="title"><a name="build-tool-plugins" href="#build-tool-plugins"></a>Part VIII. Build tool plugins</h1></div></div></div><div class="partintro"><div></div><p>Spring Boot provides build tool plugins for Maven and Gradle. The plugins offer a variety of features, including the packaging of executable jars. This section provides more details on both plugins, as well as some help should you need to extend an unsupported build system. If you are just getting started, you might want to read “<a class="xref" href="#using-boot-build-systems" title="13. Build systems">Chapter 13, <i>Build systems</i></a>” from the <a class="xref" href="#using-boot" title="Part III. Using Spring Boot">Part III, “Using Spring Boot”</a> section first.</p></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="build-tool-plugins-maven-plugin" href="#build-tool-plugins-maven-plugin"></a>58. Spring Boot Maven plugin</h2></div></div></div><p>The <a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/maven-plugin/" target="_top">Spring Boot Maven Plugin</a> provides Spring Boot support in Maven, allowing you to package executable jar or war archives and run an application “in-place”. To use it you must be using Maven 3.2 (or better).</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>Refer to the <a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/maven-plugin/" target="_top">Spring Boot Maven Plugin Site</a> for complete plugin documentation.</p></td></tr></tbody></table></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="build-tool-plugins-include-maven-plugin" href="#build-tool-plugins-include-maven-plugin"></a>58.1 Including the plugin</h2></div></div></div><p>To use the Spring Boot Maven Plugin simply include the appropriate XML in the <code class="literal">plugins</code> section of your <code class="literal">pom.xml</code></p><pre class="programlisting"><span class="hl-directive" style="color: maroon"><?xml version="1.0" encoding="UTF-8"?></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><project</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">xmlns</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"http://maven.apache.org/POM/4.0.0"</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">xmlns:xsi</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"http://www.w3.org/2001/XMLSchema-instance"</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">xsi:schemaLocation</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><modelVersion></span>4.0.0<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></modelVersion></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"><!-- ... --></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><build></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><plugins></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><plugin></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.boot<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-boot-maven-plugin<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><version></span>1.2.2.RELEASE<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></version></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><executions></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><execution></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><goals></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><goal></span>repackage<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></goal></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></goals></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></execution></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></executions></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></plugin></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></plugins></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></build></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></project></span></pre><p>This configuration will repackage a jar or war that is built during the <code class="literal">package</code> phase of the Maven lifecycle. The following example shows both the repackaged jar, as well as the original jar, in the <code class="literal">target</code> directory:</p><pre class="screen">$ mvn package $ ls target/*.jar target/myproject-1.0.0.jar target/myproject-1.0.0.jar.original</pre><p>If you don’t include the <code class="literal"><execution/></code> configuration as above, you can run the plugin on its own (but only if the package goal is used as well). For example:</p><pre class="screen">$ mvn package spring-boot:repackage $ ls target/*.jar target/myproject-1.0.0.jar target/myproject-1.0.0.jar.original</pre><p>If you are using a milestone or snapshot release you will also need to add appropriate <code class="literal">pluginRepository</code> elements:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><pluginRepositories></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><pluginRepository></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><id></span>spring-snapshots<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></id></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><url></span>http://repo.spring.io/snapshot<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></url></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></pluginRepository></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><pluginRepository></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><id></span>spring-milestones<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></id></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><url></span>http://repo.spring.io/milestone<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></url></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></pluginRepository></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></pluginRepositories></span></pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="build-tool-plugins-maven-packaging" href="#build-tool-plugins-maven-packaging"></a>58.2 Packaging executable jar and war files</h2></div></div></div><p>Once <code class="literal">spring-boot-maven-plugin</code> has been included in your <code class="literal">pom.xml</code> it will automatically attempt to rewrite archives to make them executable using the <code class="literal">spring-boot:repackage</code> goal. You should configure your project to build a jar or war (as appropriate) using the usual <code class="literal">packaging</code> element:</p><pre class="programlisting"><span class="hl-directive" style="color: maroon"><?xml version="1.0" encoding="UTF-8"?></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><project</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">xmlns</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"http://maven.apache.org/POM/4.0.0"</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">xmlns:xsi</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"http://www.w3.org/2001/XMLSchema-instance"</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">xsi:schemaLocation</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"><!-- ... --></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><packaging></span>jar<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></packaging></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"><!-- ... --></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></project></span></pre><p>Your existing archive will be enhanced by Spring Boot during the <code class="literal">package</code> phase. The main class that you want to launch can either be specified using a configuration option, or by adding a <code class="literal">Main-Class</code> attribute to the manifest in the usual way. If you don’t specify a main class the plugin will search for a class with a <code class="literal">public static void main(String[] args)</code> method.</p><p>To build and run a project artifact, you can type the following:</p><pre class="screen">$ mvn package $ java -jar target/mymodule-0.0.1-SNAPSHOT.jar</pre><p>To build a war file that is both executable and deployable into an external container you need to mark the embedded container dependencies as “provided”, e.g:</p><pre class="programlisting"><span class="hl-directive" style="color: maroon"><?xml version="1.0" encoding="UTF-8"?></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><project</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">xmlns</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"http://maven.apache.org/POM/4.0.0"</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">xmlns:xsi</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"http://www.w3.org/2001/XMLSchema-instance"</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">xsi:schemaLocation</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"><!-- ... --></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><packaging></span>war<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></packaging></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"><!-- ... --></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependencies></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.boot<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-boot-starter-web<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.boot<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-boot-starter-tomcat<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><scope></span>provided<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></scope></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"><!-- ... --></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependencies></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></project></span></pre><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>See the “<a class="xref" href="#howto-create-a-deployable-war-file" title="74.1 Create a deployable war file">Section 74.1, “Create a deployable war file”</a>” section for more details on how to create a deployable war file.</p></td></tr></tbody></table></div><p>Advanced configuration options and examples are available in the <a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/maven-plugin/" target="_top">plugin info page</a>.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="build-tool-plugins-gradle-plugin" href="#build-tool-plugins-gradle-plugin"></a>59. Spring Boot Gradle plugin</h2></div></div></div><p>The Spring Boot Gradle Plugin provides Spring Boot support in Gradle, allowing you to package executable jar or war archives, run Spring Boot applications and omit version information from your <code class="literal">build.gradle</code> file for “blessed” dependencies.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="build-tool-plugins-including-the-gradle-plugin" href="#build-tool-plugins-including-the-gradle-plugin"></a>59.1 Including the plugin</h2></div></div></div><p>To use the Spring Boot Gradle Plugin simply include a <code class="literal">buildscript</code> dependency and apply the <code class="literal">spring-boot</code> plugin:</p><pre class="programlisting">buildscript { dependencies { classpath(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"org.springframework.boot:spring-boot-gradle-plugin:1.2.2.RELEASE"</span>) } } apply plugin: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'spring-boot'</span></pre><p>If you are using a milestone or snapshot release you will also need to add appropriate <code class="literal">repositories</code> reference:</p><pre class="programlisting">buildscript { repositories { maven.url <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"http://repo.spring.io/snapshot"</span> maven.url <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"http://repo.spring.io/milestone"</span> } <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// ...</span> }</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="build-tool-plugins-gradle-dependencies-without-versions" href="#build-tool-plugins-gradle-dependencies-without-versions"></a>59.2 Declaring dependencies without versions</h2></div></div></div><p>The <code class="literal">spring-boot</code> plugin will register a custom Gradle <code class="literal">ResolutionStrategy</code> with your build that allows you to omit version numbers when declaring dependencies to “blessed” artifacts. To make use of this functionality, simply declare dependencies in the usual way, but leave the version number empty:</p><pre class="programlisting">dependencies { compile(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"org.springframework.boot:spring-boot-starter-web"</span>) compile(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"org.thymeleaf:thymeleaf-spring4"</span>) compile(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect"</span>) }</pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>The version of the <code class="literal">spring-boot</code> gradle plugin that you declare determines the actual versions of the “blessed” dependencies (this ensures that builds are always repeatable). You should always set the version of the <code class="literal">spring-boot</code> gradle plugin to the actual Spring Boot version that you wish to use. Details of the versions that are provided can be found in the <a class="link" href="#appendix-dependency-versions" title="Appendix E. Dependency versions">appendix</a>.</p></td></tr></tbody></table></div><p>The <code class="literal">spring-boot</code> plugin will only supply a version where one is not specified. To use a version of an artifact that differs from the one that the plugin would provide, simply specify the version when you declare the dependency as you usually would. For example:</p><pre class="programlisting">dependencies { compile(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"org.thymeleaf:thymeleaf-spring4:2.1.1.RELEASE"</span>) }</pre><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="build-tool-plugins-gradle-custom-version-management" href="#build-tool-plugins-gradle-custom-version-management"></a>59.2.1 Custom version management</h3></div></div></div><p>If is possible to customize the versions used by the <code class="literal">ResolutionStrategy</code> if you need to deviate from Spring Boot’s “blessed” dependencies. Alternative version metadata is consulted using the <code class="literal">versionManagement</code> configuration. For example:</p><pre class="programlisting">dependencies { versionManagement(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"com.mycorp:mycorp-versions:1.0.0.RELEASE@properties"</span>) compile(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"org.springframework.data:spring-data-hadoop"</span>) }</pre><p>Version information needs to be published to a repository as a <code class="literal">.properties</code> file. For the above example <code class="literal">mycorp-versions.properties</code> file might contain the following:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">org.springframework.data\</span>:spring-data-hadoop=2.0.0.RELEASE</pre><p>The properties file takes precedence over Spring Boot’s defaults, and can be used to override version numbers if necessary.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="build-tool-plugins-gradle-exclude-rules" href="#build-tool-plugins-gradle-exclude-rules"></a>59.3 Default exclude rules</h2></div></div></div><p>Gradle handles “exclude rules” in a slightly different way to Maven which can cause unexpected results when using the starter POMs. Specifically, exclusions declared on a dependency will not be applied when the dependency can be reached through a different path. For example, if a starter POM declares the following:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependencies></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-core<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><version></span>4.0.5.RELEASE<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></version></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><exclusions></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><exclusion></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>commons-logging<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>commons-logging<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></exclusion></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></exclusions></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-context<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><version></span>4.0.5.RELEASE<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></version></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependencies></span></pre><p>The <code class="literal">commons-logging</code> jar will <span class="strong"><strong>not</strong></span> be excluded by Gradle because it is pulled in transitively via <code class="literal">spring-context</code> (<code class="literal">spring-context</code> → <code class="literal">spring-core</code> → <code class="literal">commons-logging</code>) which does not have an <code class="literal">exclusion</code> element.</p><p>To ensure that correct exclusions are actually applied, the Spring Boot Gradle plugin will automatically add exclusion rules. All exclusions defined in the <code class="literal">spring-boot-dependencies</code> POM and implicit rules for the “starter” POMs will be added.</p><p>If you don’t want exclusion rules automatically applied you can use the following configuration:</p><pre class="programlisting">springBoot { applyExcludeRules=false }</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="build-tool-plugins-gradle-packaging" href="#build-tool-plugins-gradle-packaging"></a>59.4 Packaging executable jar and war files</h2></div></div></div><p>Once the <code class="literal">spring-boot</code> plugin has been applied to your project it will automatically attempt to rewrite archives to make them executable using the <code class="literal">bootRepackage</code> task. You should configure your project to build a jar or war (as appropriate) in the usual way.</p><p>The main class that you want to launch can either be specified using a configuration option, or by adding a <code class="literal">Main-Class</code> attribute to the manifest. If you don’t specify a main class the plugin will search for a class with a <code class="literal">public static void main(String[] args)</code> method.</p><p>To build and run a project artifact, you can type the following:</p><pre class="screen">$ gradle build $ java -jar build/libs/mymodule-0.0.1-SNAPSHOT.jar</pre><p>To build a war file that is both executable and deployable into an external container, you need to mark the embedded container dependencies as belonging to a configuration named “providedRuntime”, e.g:</p><pre class="programlisting">... apply plugin: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'war'</span> war { baseName = <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'myapp'</span> version = <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'0.5.0'</span> } repositories { jcenter() maven { url <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"http://repo.spring.io/libs-snapshot"</span> } } configurations { providedRuntime } dependencies { compile(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"org.springframework.boot:spring-boot-starter-web"</span>) providedRuntime(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"org.springframework.boot:spring-boot-starter-tomcat"</span>) ... }</pre><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>See the “<a class="xref" href="#howto-create-a-deployable-war-file" title="74.1 Create a deployable war file">Section 74.1, “Create a deployable war file”</a>” section for more details on how to create a deployable war file.</p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="build-tool-plugins-gradle-running-applications" href="#build-tool-plugins-gradle-running-applications"></a>59.5 Running a project in-place</h2></div></div></div><p>To run a project in place without building a jar first you can use the “bootRun” task:</p><pre class="screen">$ gradle bootRun</pre><p>By default, running this way makes your static classpath resources (i.e. in <code class="literal">src/main/resources</code> by default) reloadable in the live application, which can be helpful at development time. Making static classpath resources reloadable means that <code class="literal">bootRun</code> does not use the output of the <code class="literal">processResources</code> task, i.e., when invoked using <code class="literal">bootRun</code>, your application will use the resources in their unprocessed form.</p><p>You can disable the direct use of your static classpath resources. This will mean that the resources are no longer reloadable but the output of the <code class="literal">processResources</code> task will be used. To do so, set <code class="literal">addResources</code> on the <code class="literal">bootRun</code> task to <code class="literal">false</code>:</p><pre class="programlisting">bootRun { addResources = false }</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="build-tool-plugins-gradle-global-configuration" href="#build-tool-plugins-gradle-global-configuration"></a>59.6 Spring Boot plugin configuration</h2></div></div></div><p>The gradle plugin automatically extends your build script DSL with a <code class="literal">springBoot</code> element for global configuration of the Boot plugin. Set the appropriate properties as you would with any other Gradle extension (see below for a list of configuration options):</p><pre class="programlisting">springBoot { backupSource = false }</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="build-tool-plugins-gradle-repackage-configuration" href="#build-tool-plugins-gradle-repackage-configuration"></a>59.7 Repackage configuration</h2></div></div></div><p>The plugin adds a <code class="literal">bootRepackage</code> task which you can also configure directly, e.g.:</p><pre class="programlisting">bootRepackage { mainClass = <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'demo.Application'</span> }</pre><p>The following configuration options are available:</p><div class="informaltable"><table style="border-collapse: collapse;border-top: 0.5pt solid ; border-bottom: 0.5pt solid ; border-left: 0.5pt solid ; border-right: 0.5pt solid ; "><colgroup><col class="col_1"><col class="col_2"></colgroup><thead><tr><th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top">Name</th><th style="border-bottom: 0.5pt solid ; " align="left" valign="top">Description</th></tr></thead><tbody><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">enabled</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Boolean flag to switch the repackager off (sometimes useful if you want the other Boot features but not this one)</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">mainClass</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>The main class that should be run. If not specified the <code class="literal">mainClassName</code> project property will be used or, if the no <code class="literal">mainClassName</code> id defined the archive will be searched for a suitable class. "Suitable" means a unique class with a well-formed <code class="literal">main()</code> method (if more than one is found the build will fail). You should also be able to specify the main class name via the "run" task (<code class="literal">main</code> property) and/or the "startScripts" (<code class="literal">mainClassName</code> property) as an alternative to using the "springBoot" configuration.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">classifier</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>A file name segment (before the extension) to add to the archive, so that the original is preserved in its original location. Defaults to null in which case the archive is repackaged in place. The default is convenient for many purposes, but if you want to use the original jar as a dependency in another project, it’s best to use an extension to define the executable archive.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">withJarTask</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>The name or value of the <code class="literal">Jar</code> task (defaults to all tasks of type <code class="literal">Jar</code>) which is used to locate the archive to repackage.</p></td></tr><tr><td style="border-right: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">customConfiguration</code></p></td><td style="" align="left" valign="top"><p>The name of the custom configuration whuch is used to populate the nested lib directory (without specifying this you get all compile and runtime dependencies).</p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="build-tool-plugins-gradle-repackage-custom-configuration" href="#build-tool-plugins-gradle-repackage-custom-configuration"></a>59.8 Repackage with custom Gradle configuration</h2></div></div></div><p>Sometimes it may be more appropriate to not package default dependencies resolved from <code class="literal">compile</code>, <code class="literal">runtime</code> and <code class="literal">provided</code> scopes. If the created executable jar file is intended to be run as it is, you need to have all dependencies nested inside it; however, if the plan is to explode a jar file and run the main class manually, you may already have some of the libraries available via <code class="literal">CLASSPATH</code>. This is a situation where you can repackage your jar with a different set of dependencies.</p><p>Using a custom configuration will automatically disable dependency resolving from <code class="literal">compile</code>, <code class="literal">runtime</code> and <code class="literal">provided</code> scopes. Custom configuration can be either defined globally (inside the <code class="literal">springBoot</code> section) or per task.</p><pre class="programlisting">task clientJar(type: Jar) { appendix = <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'client'</span> from sourceSets.main.output exclude(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'**/*Something*'</span>) } task clientBoot(type: BootRepackage, dependsOn: clientJar) { withJarTask = clientJar customConfiguration = <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"mycustomconfiguration"</span> }</pre><p>In above example, we created a new <code class="literal">clientJar</code> Jar task to package a customized file set from your compiled sources. Then we created a new <code class="literal">clientBoot</code> BootRepackage task and instructed it to work with only <code class="literal">clientJar</code> task and <code class="literal">mycustomconfiguration</code>.</p><pre class="programlisting">configurations { mycustomconfiguration.exclude group: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'log4j'</span> } dependencies { mycustomconfiguration configurations.runtime }</pre><p>The configuration that we are referring to in <code class="literal">BootRepackage</code> is a normal <a class="link" href="http://www.gradle.org/docs/current/dsl/org.gradle.api.artifacts.Configuration.html" target="_top">Gradle configuration</a>. In the above example we created a new configuration named <code class="literal">mycustomconfiguration</code> instructing it to derive from a <code class="literal">runtime</code> and exclude the <code class="literal">log4j</code> group. If the <code class="literal">clientBoot</code> task is executed, the repackaged boot jar will have all dependencies from <code class="literal">runtime</code> but no <code class="literal">log4j</code> jars.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="build-tool-plugins-gradle-configuration-options" href="#build-tool-plugins-gradle-configuration-options"></a>59.8.1 Configuration options</h3></div></div></div><p>The following configuration options are available:</p><div class="informaltable"><table style="border-collapse: collapse;border-top: 0.5pt solid ; border-bottom: 0.5pt solid ; border-left: 0.5pt solid ; border-right: 0.5pt solid ; "><colgroup><col class="col_1"><col class="col_2"></colgroup><thead><tr><th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top">Name</th><th style="border-bottom: 0.5pt solid ; " align="left" valign="top">Description</th></tr></thead><tbody><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">mainClass</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>The main class that should be run by the executable archive.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">providedConfiguration</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>The name of the provided configuration (defaults to <code class="literal">providedRuntime</code>).</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">backupSource</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>If the original source archive should be backed-up before being repackaged (defaults to <code class="literal">true</code>).</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">customConfiguration</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>The name of the custom configuration.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">layout</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>The type of archive, corresponding to how the dependencies are laid out inside (defaults to a guess based on the archive type).</p></td></tr><tr><td style="border-right: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">requiresUnpack</code></p></td><td style="" align="left" valign="top"><p>A list of dependencies (in the form “groupId:artifactId” that must be unpacked from fat jars in order to run. Items are still packaged into the fat jar, but they will be automatically unpacked when it runs.</p></td></tr></tbody></table></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="build-tool-plugins-understanding-the-gradle-plugin" href="#build-tool-plugins-understanding-the-gradle-plugin"></a>59.9 Understanding how the Gradle plugin works</h2></div></div></div><p>When <code class="literal">spring-boot</code> is applied to your Gradle project a default task named <code class="literal">bootRepackage</code> is created automatically. The <code class="literal">bootRepackage</code> task depends on Gradle <code class="literal">assemble</code> task, and when executed, it tries to find all jar artifacts whose qualifier is empty (i.e. tests and sources jars are automatically skipped).</p><p>Due to the fact that <code class="literal">bootRepackage</code> finds 'all' created jar artifacts, the order of Gradle task execution is important. Most projects only create a single jar file, so usually this is not an issue; however, if you are planning to create a more complex project setup, with custom <code class="literal">Jar</code> and <code class="literal">BootRepackage</code> tasks, there are few tweaks to consider.</p><p>If you are 'just' creating custom jar files from your project you can simply disable default <code class="literal">jar</code> and <code class="literal">bootRepackage</code> tasks:</p><pre class="programlisting">jar.enabled = false bootRepackage.enabled = false</pre><p>Another option is to instruct the default <code class="literal">bootRepackage</code> task to only work with a default <code class="literal">jar</code> task.</p><pre class="programlisting">bootRepackage.withJarTask = jar</pre><p>If you have a default project setup where the main jar file is created and repackaged, 'and' you still want to create additional custom jars, you can combine your custom repackage tasks together and use <code class="literal">dependsOn</code> so that the <code class="literal">bootJars</code> task will run after the default <code class="literal">bootRepackage</code> task is executed:</p><pre class="programlisting">task bootJars bootJars.dependsOn = [clientBoot1,clientBoot2,clientBoot3] build.dependsOn(bootJars)</pre><p>All the above tweaks are usually used to avoid situations where an already created boot jar is repackaged again. Repackaging an existing boot jar will not break anything, but you may find that it includes unnecessary dependencies.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="build-tool-plugins-gradle-publishing-artifacts-to-a-maven-repository" href="#build-tool-plugins-gradle-publishing-artifacts-to-a-maven-repository"></a>59.10 Publishing artifacts to a Maven repository using Gradle</h2></div></div></div><p>If you are <a class="link" href="#build-tool-plugins-gradle-dependencies-without-versions" title="59.2 Declaring dependencies without versions">declaring dependencies without versions</a> and you want to publish artifacts to a Maven repository you will need to configure the Maven publication with details of Spring Boot’s dependency management. This can be achieved by configuring it to publish poms that inherit from <code class="literal">spring-boot-starter-parent</code> or that import dependency management from <code class="literal">spring-boot-dependencies</code>. The exact details of this configuration depend on how you’re using Gradle and how you’re trying to publish the artifacts.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="build-tool-plugins-gradle-publishing-artifacts-to-a-maven-repository-inherit" href="#build-tool-plugins-gradle-publishing-artifacts-to-a-maven-repository-inherit"></a>59.10.1 Configuring Gradle to produce a pom that inherits dependency management</h3></div></div></div><p>The following is an example of configuring Gradle to generate a pom that inherits from <code class="literal">spring-boot-starter-parent</code>. Please refer to the <a class="link" href="http://www.gradle.org/docs/current/userguide/userguide.html" target="_top">Gradle User Guide</a> for further information.</p><pre class="programlisting">uploadArchives { repositories { mavenDeployer { pom { project { parent { groupId <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"org.springframework.boot"</span> artifactId <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"spring-boot-starter-parent"</span> version <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"1.2.2.RELEASE"</span> } } } } } }</pre></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="build-tool-plugins-gradle-publishing-artifacts-to-a-maven-repository-import" href="#build-tool-plugins-gradle-publishing-artifacts-to-a-maven-repository-import"></a>59.10.2 Configuring Gradle to produce a pom that imports dependency management</h3></div></div></div><p>The following is an example of configuring Gradle to generate a pom that imports the dependency management provided by <code class="literal">spring-boot-dependencies</code>. Please refer to the <a class="link" href="http://www.gradle.org/docs/current/userguide/userguide.html" target="_top">Gradle User Guide</a> for further information.</p><pre class="programlisting">uploadArchives { repositories { mavenDeployer { pom { project { dependencyManagement { dependencies { dependency { groupId <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"org.springframework.boot"</span> artifactId <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"spring-boot-dependencies"</span> version <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"1.2.2.RELEASE"</span> type <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"pom"</span> scope <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"import"</span> } } } } } } } }</pre></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="build-tool-plugins-other-build-systems" href="#build-tool-plugins-other-build-systems"></a>60. Supporting other build systems</h2></div></div></div><p>If you want to use a build tool other than Maven or Gradle, you will likely need to develop your own plugin. Executable jars need to follow a specific format and certain entries need to be written in an uncompressed form (see the <span class="emphasis"><em><a class="link" href="#executable-jar" title="Appendix D. The executable jar format">executable jar format</a></em></span> section in the appendix for details).</p><p>The Spring Boot Maven and Gradle plugins both make use of <code class="literal">spring-boot-loader-tools</code> to actually generate jars. You are also free to use this library directly yourself if you need to.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="build-tool-plugins-repackaging-archives" href="#build-tool-plugins-repackaging-archives"></a>60.1 Repackaging archives</h2></div></div></div><p>To repackage an existing archive so that it becomes a self-contained executable archive use <code class="literal">org.springframework.boot.loader.tools.Repackager</code>. The <code class="literal">Repackager</code> class takes a single constructor argument that refers to an existing jar or war archive. Use one of the two available <code class="literal">repackage()</code> methods to either replace the original file or write to a new destination. Various settings can also be configured on the repackager before it is run.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="build-tool-plugins-nested-libraries" href="#build-tool-plugins-nested-libraries"></a>60.2 Nested libraries</h2></div></div></div><p>When repackaging an archive you can include references to dependency files using the <code class="literal">org.springframework.boot.loader.tools.Libraries</code> interface. We don’t provide any concrete implementations of <code class="literal">Libraries</code> here as they are usually build system specific.</p><p>If your archive already includes libraries you can use <code class="literal">Libraries.NONE</code>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="build-tool-plugins-find-a-main-class" href="#build-tool-plugins-find-a-main-class"></a>60.3 Finding a main class</h2></div></div></div><p>If you don’t use <code class="literal">Repackager.setMainClass()</code> to specify a main class, the repackager will use <a class="link" href="http://asm.ow2.org/" target="_top">ASM</a> to read class files and attempt to find a suitable class with a <code class="literal">public static void main(String[] args)</code> method. An exception is thrown if more than one candidate is found.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="build-tool-plugins-repackage-implementation" href="#build-tool-plugins-repackage-implementation"></a>60.4 Example repackage implementation</h2></div></div></div><p>Here is a typical example repackage:</p><pre class="programlisting">Repackager repackager = <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">new</span> Repackager(sourceJarFile); repackager.setBackupSource(false); repackager.repackage(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">new</span> Libraries() { <em><span class="hl-annotation" style="color: gray">@Override</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">void</span> doWithLibraries(LibraryCallback callback) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">throws</span> IOException { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// Build system specific implementation, callback for each dependency</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// callback.library(new Library(nestedFile, LibraryScope.COMPILE));</span> } });</pre></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="build-tool-plugins-whats-next" href="#build-tool-plugins-whats-next"></a>61. What to read next</h2></div></div></div><p>If you’re interested in how the build tool plugins work you can look at the <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-tools" target="_top"><code class="literal">spring-boot-tools</code></a> module on GitHub. More technical details of the <a class="link" href="#executable-jar" title="Appendix D. The executable jar format">executable jar format</a> are covered in the appendix.</p><p>If you have specific build-related questions you can check out the “<a class="link" href="#howto" title="Part IX. ‘How-to’ guides">how-to</a>” guides.</p></div></div><div class="part"><div class="titlepage"><div><div><h1 class="title"><a name="howto" href="#howto"></a>Part IX. ‘How-to’ guides</h1></div></div></div><div class="partintro"><div></div><p>This section provides answers to some common ‘how do I do that…’ type of questions that often arise when using Spring Boot. This is by no means an exhaustive list, but it does cover quite a lot.</p><p>If you are having a specific problem that we don’t cover here, you might want to check out <a class="link" href="http://stackoverflow.com/tags/spring-boot" target="_top">stackoverflow.com</a> to see if someone has already provided an answer; this is also a great place to ask new questions (please use the <code class="literal">spring-boot</code> tag).</p><p>We’re also more than happy to extend this section; If you want to add a ‘how-to’ you can send us a <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE" target="_top">pull request</a>.</p></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="howto-spring-boot-application" href="#howto-spring-boot-application"></a>62. Spring Boot application</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-troubleshoot-auto-configuration" href="#howto-troubleshoot-auto-configuration"></a>62.1 Troubleshoot auto-configuration</h2></div></div></div><p>The Spring Boot auto-configuration tries its best to ‘do the right thing’, but sometimes things fail and it can be hard to tell why.</p><p>There is a really useful <code class="literal">ConditionEvaluationReport</code> available in any Spring Boot <code class="literal">ApplicationContext</code>. You will see it if you enable <code class="literal">DEBUG</code> logging output. If you use the <code class="literal">spring-boot-actuator</code> there is also an <code class="literal">autoconfig</code> endpoint that renders the report in JSON. Use that to debug the application and see what features have been added (and which not) by Spring Boot at runtime.</p><p>Many more questions can be answered by looking at the source code and the javadoc. Some rules of thumb:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Look for classes called <code class="literal">*AutoConfiguration</code> and read their sources, in particular the <code class="literal">@Conditional*</code> annotations to find out what features they enable and when. Add <code class="literal">--debug</code> to the command line or a System property <code class="literal">-Ddebug</code> to get a log on the console of all the autoconfiguration decisions that were made in your app. In a running Actuator app look at the <code class="literal">autoconfig</code> endpoint (‘/autoconfig’ or the JMX equivalent) for the same information.</li><li class="listitem">Look for classes that are <code class="literal">@ConfigurationProperties</code> (e.g. <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java" target="_top"><code class="literal">ServerProperties</code></a>) and read from there the available external configuration options. The <code class="literal">@ConfigurationProperties</code> has a <code class="literal">name</code> attribute which acts as a prefix to external properties, thus <code class="literal">ServerProperties</code> has <code class="literal">prefix="server"</code> and its configuration properties are <code class="literal">server.port</code>, <code class="literal">server.address</code> etc. In a running Actuator app look at the <code class="literal">configprops</code> endpoint.</li><li class="listitem">Look for use of <code class="literal">RelaxedEnvironment</code> to pull configuration values explicitly out of the <code class="literal">Environment</code>. It often is used with a prefix.</li><li class="listitem">Look for <code class="literal">@Value</code> annotations that bind directly to the <code class="literal">Environment</code>. This is less flexible than the <code class="literal">RelaxedEnvironment</code> approach, but does allow some relaxed binding, specifically for OS environment variables (so <code class="literal">CAPITALS_AND_UNDERSCORES</code> are synonyms for <code class="literal">period.separated</code>).</li><li class="listitem">Look for <code class="literal">@ConditionalOnExpression</code> annotations that switch features on and off in response to SpEL expressions, normally evaluated with place-holders resolved from the <code class="literal">Environment</code>.</li></ul></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-customize-the-environment-or-application-context" href="#howto-customize-the-environment-or-application-context"></a>62.2 Customize the Environment or ApplicationContext before it starts</h2></div></div></div><p>A <code class="literal">SpringApplication</code> has <code class="literal">ApplicationListeners</code> and <code class="literal">ApplicationContextInitializers</code> that are used to apply customizations to the context or environment. Spring Boot loads a number of such customizations for use internally from <code class="literal">META-INF/spring.factories</code>. There is more than one way to register additional ones:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Programmatically per application by calling the <code class="literal">addListeners</code> and <code class="literal">addInitializers</code> methods on <code class="literal">SpringApplication</code> before you run it.</li><li class="listitem">Declaratively per application by setting <code class="literal">context.initializer.classes</code> or <code class="literal">context.listener.classes</code>.</li><li class="listitem">Declaratively for all applications by adding a <code class="literal">META-INF/spring.factories</code> and packaging a jar file that the applications all use as a library.</li></ul></div><p>The <code class="literal">SpringApplication</code> sends some special <code class="literal">ApplicationEvents</code> to the listeners (even some before the context is created), and then registers the listeners for events published by the <code class="literal">ApplicationContext</code> as well. See <span class="emphasis"><em><a class="xref" href="#boot-features-application-events-and-listeners" title="22.4 Application events and listeners">Section 22.4, “Application events and listeners”</a></em></span> in the ‘Spring Boot features’ section for a complete list.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-build-an-application-context-hierarchy" href="#howto-build-an-application-context-hierarchy"></a>62.3 Build an ApplicationContext hierarchy (adding a parent or root context)</h2></div></div></div><p>You can use the <code class="literal">ApplicationBuilder</code> class to create parent/child <code class="literal">ApplicationContext</code> hierarchies. See <span class="emphasis"><em><a class="xref" href="#boot-features-fluent-builder-api" title="22.3 Fluent builder API">Section 22.3, “Fluent builder API”</a></em></span> in the ‘Spring Boot features’ section for more information.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-create-a-non-web-application" href="#howto-create-a-non-web-application"></a>62.4 Create a non-web application</h2></div></div></div><p>Not all Spring applications have to be web applications (or web services). If you want to execute some code in a <code class="literal">main</code> method, but also bootstrap a Spring application to set up the infrastructure to use, then it’s easy with the <code class="literal">SpringApplication</code> features of Spring Boot. A <code class="literal">SpringApplication</code> changes its <code class="literal">ApplicationContext</code> class depending on whether it thinks it needs a web application or not. The first thing you can do to help it is to just leave the servlet API dependencies off the classpath. If you can’t do that (e.g. you are running 2 applications from the same code base) then you can explicitly call <code class="literal">SpringApplication.setWebEnvironment(false)</code>, or set the <code class="literal">applicationContextClass</code> property (through the Java API or with external properties). Application code that you want to run as your business logic can be implemented as a <code class="literal">CommandLineRunner</code> and dropped into the context as a <code class="literal">@Bean</code> definition.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="howto-properties-and-configuration" href="#howto-properties-and-configuration"></a>63. Properties & configuration</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-externalize-configuration" href="#howto-externalize-configuration"></a>63.1 Externalize the configuration of SpringApplication</h2></div></div></div><p>A <code class="literal">SpringApplication</code> has bean properties (mainly setters) so you can use its Java API as you create the application to modify its behavior. Or you can externalize the configuration using properties in <code class="literal">spring.main.*</code>. E.g. in <code class="literal">application.properties</code> you might have.</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.main.web_environment</span>=false <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.main.show_banner</span>=false</pre><p>and then the Spring Boot banner will not be printed on startup, and the application will not be a web application.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>The example above also demonstrates how flexible binding allows the use of underscores (<code class="literal">_</code>) as well as dashes (<code class="literal">-</code>) in property names.</p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-change-the-location-of-external-properties" href="#howto-change-the-location-of-external-properties"></a>63.2 Change the location of external properties of an application</h2></div></div></div><p>By default properties from different sources are added to the Spring <code class="literal">Environment</code> in a defined order (see <span class="emphasis"><em><a class="xref" href="#boot-features-external-config" title="23. Externalized Configuration">Chapter 23, <i>Externalized Configuration</i></a></em></span> in the ‘Spring Boot features’ section for the exact order).</p><p>A nice way to augment and modify this is to add <code class="literal">@PropertySource</code> annotations to your application sources. Classes passed to the <code class="literal">SpringApplication</code> static convenience methods, and those added using <code class="literal">setSources()</code> are inspected to see if they have <code class="literal">@PropertySources</code>, and if they do, those properties are added to the <code class="literal">Environment</code> early enough to be used in all phases of the <code class="literal">ApplicationContext</code> lifecycle. Properties added in this way have precedence over any added using the default locations, but have lower priority than system properties, environment variables or the command line.</p><p>You can also provide System properties (or environment variables) to change the behavior:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><code class="literal">spring.config.name</code> (<code class="literal">SPRING_CONFIG_NAME</code>), defaults to <code class="literal">application</code> as the root of the file name.</li><li class="listitem"><code class="literal">spring.config.location</code> (<code class="literal">SPRING_CONFIG_LOCATION</code>) is the file to load (e.g. a classpath resource or a URL). A separate <code class="literal">Environment</code> property source is set up for this document and it can be overridden by system properties, environment variables or the command line.</li></ul></div><p>No matter what you set in the environment, Spring Boot will always load <code class="literal">application.properties</code> as described above. If YAML is used then files with the ‘.yml’ extension are also added to the list by default.</p><p>See <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java" target="_top"><code class="literal">ConfigFileApplicationListener</code></a> for more detail.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-use-short-command-line-arguments" href="#howto-use-short-command-line-arguments"></a>63.3 Use ‘short’ command line arguments</h2></div></div></div><p>Some people like to use (for example) <code class="literal">--port=9000</code> instead of <code class="literal">--server.port=9000</code> to set configuration properties on the command line. You can easily enable this by using placeholders in <code class="literal">application.properties</code>, e.g.</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.port</span>=${port:8080}</pre><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>If you are inheriting from the <code class="literal">spring-boot-starter-parent</code> POM, the default filter token of the <code class="literal">maven-resources-plugins</code> has been changed from <code class="literal">${*}</code> to <code class="literal">@</code> (i.e. <code class="literal">@maven.token@</code> instead of <code class="literal">${maven.token}</code>) to prevent conflicts with Spring-style placeholders. If you have enabled maven filtering for the <code class="literal">application.properties</code> directly, you may want to also change the default filter token to use <a class="link" href="http://maven.apache.org/plugins/maven-resources-plugin/resources-mojo.html#delimiters" target="_top">other delimiters</a>.</p></td></tr></tbody></table></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>In this specific case the port binding will work in a PaaS environment like Heroku and Cloud Foundry, since in those two platforms the <code class="literal">PORT</code> environment variable is set automatically and Spring can bind to capitalized synonyms for <code class="literal">Environment</code> properties.</p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-use-yaml-for-external-properties" href="#howto-use-yaml-for-external-properties"></a>63.4 Use YAML for external properties</h2></div></div></div><p>YAML is a superset of JSON and as such is a very convenient syntax for storing external properties in a hierarchical format. E.g.</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> application</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> name</span>: cruncher <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> datasource</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> driverClassName</span>: com.mysql.jdbc.Driver <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> url</span>: jdbc:mysql://localhost/test <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> port</span>: <span class="hl-number">9000</span></pre><p>Create a file called <code class="literal">application.yml</code> and stick it in the root of your classpath, and also add <code class="literal">snakeyaml</code> to your dependencies (Maven coordinates <code class="literal">org.yaml:snakeyaml</code>, already included if you use the <code class="literal">spring-boot-starter</code>). A YAML file is parsed to a Java <code class="literal">Map<String,Object></code> (like a JSON object), and Spring Boot flattens the map so that it is 1-level deep and has period-separated keys, a lot like people are used to with <code class="literal">Properties</code> files in Java.</p><p>The example YAML above corresponds to an <code class="literal">application.properties</code> file</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.application.name</span>=cruncher <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.datasource.driverClassName</span>=com.mysql.jdbc.Driver <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.datasource.url</span>=jdbc:mysql://localhost/test <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.port</span>=9000</pre><p>See <span class="emphasis"><em><a class="xref" href="#boot-features-external-config-yaml" title="23.6 Using YAML instead of Properties">Section 23.6, “Using YAML instead of Properties”</a></em></span> in the ‘Spring Boot features’ section for more information about YAML.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-set-active-spring-profiles" href="#howto-set-active-spring-profiles"></a>63.5 Set the active Spring profiles</h2></div></div></div><p>The Spring <code class="literal">Environment</code> has an API for this, but normally you would set a System profile (<code class="literal">spring.profiles.active</code>) or an OS environment variable (<code class="literal">SPRING_PROFILES_ACTIVE</code>). E.g. launch your application with a <code class="literal">-D</code> argument (remember to put it before the main class or jar archive):</p><pre class="screen">$ java -jar -Dspring.profiles.active=production demo-0.0.1-SNAPSHOT.jar</pre><p>In Spring Boot you can also set the active profile in <code class="literal">application.properties</code>, e.g.</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.profiles.active</span>=production</pre><p>A value set this way is replaced by the System property or environment variable setting, but not by the <code class="literal">SpringApplicationBuilder.profiles()</code> method. Thus the latter Java API can be used to augment the profiles without changing the defaults.</p><p>See <span class="emphasis"><em><a class="xref" href="#boot-features-profiles" title="24. Profiles">Chapter 24, <i>Profiles</i></a></em></span> in the ‘Spring Boot features’ section for more information.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-change-configuration-depending-on-the-environment" href="#howto-change-configuration-depending-on-the-environment"></a>63.6 Change configuration depending on the environment</h2></div></div></div><p>A YAML file is actually a sequence of documents separated by <code class="literal">---</code> lines, and each document is parsed separately to a flattened map.</p><p>If a YAML document contains a <code class="literal">spring.profiles</code> key, then the profiles value (comma-separated list of profiles) is fed into the Spring <code class="literal">Environment.acceptsProfiles()</code> and if any of those profiles is active that document is included in the final merge (otherwise not).</p><p>Example:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> port</span>: <span class="hl-number">9000</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">---</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> profiles</span>: development <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> port</span>: <span class="hl-number">9001</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">---</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> profiles</span>: production <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> port</span>: <span class="hl-number">0</span></pre><p>In this example the default port is 9000, but if the Spring profile ‘development’ is active then the port is 9001, and if ‘production’ is active then it is 0.</p><p>The YAML documents are merged in the order they are encountered (so later values override earlier ones).</p><p>To do the same thing with properties files you can use <code class="literal">application-${profile}.properties</code> to specify profile-specific values.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-discover-build-in-options-for-external-properties" href="#howto-discover-build-in-options-for-external-properties"></a>63.7 Discover built-in options for external properties</h2></div></div></div><p>Spring Boot binds external properties from <code class="literal">application.properties</code> (or <code class="literal">.yml</code>) (and other places) into an application at runtime. There is not (and technically cannot be) an exhaustive list of all supported properties in a single location because contributions can come from additional jar files on your classpath.</p><p>A running application with the Actuator features has a <code class="literal">configprops</code> endpoint that shows all the bound and bindable properties available through <code class="literal">@ConfigurationProperties</code>.</p><p>The appendix includes an <a class="link" href="#common-application-properties" title="Appendix A. Common application properties"><code class="literal">application.properties</code></a> example with a list of the most common properties supported by Spring Boot. The definitive list comes from searching the source code for <code class="literal">@ConfigurationProperties</code> and <code class="literal">@Value</code> annotations, as well as the occasional use of <code class="literal">RelaxedEnvironment</code>.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="howto-embedded-servlet-containers" href="#howto-embedded-servlet-containers"></a>64. Embedded servlet containers</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-add-a-servlet-filter-or-servletcontextlistener" href="#howto-add-a-servlet-filter-or-servletcontextlistener"></a>64.1 Add a Servlet, Filter or ServletContextListener to an application</h2></div></div></div><p><code class="literal">Servlet</code>, <code class="literal">Filter</code>, <code class="literal">ServletContextListener</code> and the other listeners supported by the Servlet spec can be added to your application as <code class="literal">@Bean</code> definitions. Be very careful that they don’t cause eager initialization of too many other beans because they have to be installed in the container very early in the application lifecycle (e.g. it’s not a good idea to have them depend on your <code class="literal">DataSource</code> or JPA configuration). You can work around restrictions like that by initializing them lazily when first used instead of on initialization.</p><p>In the case of <code class="literal">Filters</code> and <code class="literal">Servlets</code> you can also add mappings and init parameters by adding a <code class="literal">FilterRegistrationBean</code> or <code class="literal">ServletRegistrationBean</code> instead of or as well as the underlying component.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-disable-registration-of-a-servlet-or-filter" href="#howto-disable-registration-of-a-servlet-or-filter"></a>64.2 Disable registration of a Servlet or Filter</h2></div></div></div><p>As <a class="link" href="#howto-add-a-servlet-filter-or-servletcontextlistener" title="64.1 Add a Servlet, Filter or ServletContextListener to an application">described above</a> any <code class="literal">Servlet</code> or <code class="literal">Filter</code> beans will be registered with the servlet container automatically. To disable registration of a particular <code class="literal">Filter</code> or <code class="literal">Servlet</code> bean create a registration bean for it and mark it as disabled. For example:</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@Bean</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> FilterRegistrationBean registration(MyFilter filter) { FilterRegistrationBean registration = <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">new</span> FilterRegistrationBean(filter); registration.setEnabled(false); <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">return</span> registration; }</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-change-the-http-port" href="#howto-change-the-http-port"></a>64.3 Change the HTTP port</h2></div></div></div><p>In a standalone application the main HTTP port defaults to <code class="literal">8080</code>, but can be set with <code class="literal">server.port</code> (e.g. in <code class="literal">application.properties</code> or as a System property). Thanks to relaxed binding of <code class="literal">Environment</code> values you can also use <code class="literal">SERVER_PORT</code> (e.g. as an OS environment variable).</p><p>To switch off the HTTP endpoints completely, but still create a <code class="literal">WebApplicationContext</code>, use <code class="literal">server.port=-1</code> (this is sometimes useful for testing).</p><p>For more details look at <span class="emphasis"><em><a class="xref" href="#boot-features-customizing-embedded-containers" title="26.3.3 Customizing embedded servlet containers">Section 26.3.3, “Customizing embedded servlet containers”</a></em></span> in the ‘Spring Boot features’ section, or the <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java" target="_top"><code class="literal">ServerProperties</code></a> source code.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-user-a-random-unassigned-http-port" href="#howto-user-a-random-unassigned-http-port"></a>64.4 Use a random unassigned HTTP port</h2></div></div></div><p>To scan for a free port (using OS natives to prevent clashes) use <code class="literal">server.port=0</code>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-discover-the-http-port-at-runtime" href="#howto-discover-the-http-port-at-runtime"></a>64.5 Discover the HTTP port at runtime</h2></div></div></div><p>You can access the port the server is running on from log output or from the <code class="literal">EmbeddedWebApplicationContext</code> via its <code class="literal">EmbeddedServletContainer</code>. The best way to get that and be sure that it has initialized is to add a <code class="literal">@Bean</code> of type <code class="literal">ApplicationListener<EmbeddedServletContainerInitializedEvent></code> and pull the container out of the event when it is published.</p><p>A useful practice for use with <code class="literal">@WebIntegrationTests</code> is to set <code class="literal">server.port=0</code> and then inject the actual (‘local’) port as a <code class="literal">@Value</code>. For example:</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@RunWith(SpringJUnit4ClassRunner.class)</span></em> <em><span class="hl-annotation" style="color: gray">@SpringApplicationConfiguration(classes = SampleDataJpaApplication.class)</span></em> <em><span class="hl-annotation" style="color: gray">@WebIntegrationTest("server.port:0")</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> CityRepositoryIntegrationTests { <em><span class="hl-annotation" style="color: gray">@Autowired</span></em> EmbeddedWebApplicationContext server; <em><span class="hl-annotation" style="color: gray">@Value("${local.server.port}")</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">int</span> port; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// ...</span> }</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-configure-ssl" href="#howto-configure-ssl"></a>64.6 Configure SSL</h2></div></div></div><p>SSL can be configured declaratively by setting the various <code class="literal">server.ssl.*</code> properties, typically in <code class="literal">application.properties</code> or <code class="literal">application.yml</code>. For example:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.port </span>= 8443 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.ssl.key-store </span>= classpath:keystore.jks <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.ssl.key-store-password </span>= secret <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.ssl.key-password </span>= another-secret</pre><p>See <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot/src/main/java/org/springframework/boot/context/embedded/Ssl.java" target="_top"><code class="literal">Ssl</code></a> for details of all of the supported properties.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>Tomcat requires the key store (and trust store if you’re using one) to be directly accessible on the filesystem, i.e. it cannot be read from within a jar file. This limitation doesn’t apply to Jetty and Undertow.</p></td></tr></tbody></table></div><p>Using configuration like the example above means the application will no longer support plain HTTP connector at port 8080. Spring Boot doesn’t support the configuration of both an HTTP connector and an HTTPS connector via <code class="literal">application.properties</code>. If you want to have both then you’ll need to configure one of them programmatically. It’s recommended to use <code class="literal">application.properties</code> to configure HTTPS as the HTTP connector is the easier of the two to configure programmatically. See the <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-samples/spring-boot-sample-tomcat-multi-connectors" target="_top"><code class="literal">spring-boot-sample-tomcat-multi-connectors</code></a> sample project for an example.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-configure-tomcat" href="#howto-configure-tomcat"></a>64.7 Configure Tomcat</h2></div></div></div><p>Generally you can follow the advice from <span class="emphasis"><em><a class="xref" href="#howto-discover-build-in-options-for-external-properties" title="63.7 Discover built-in options for external properties">Section 63.7, “Discover built-in options for external properties”</a></em></span> about <code class="literal">@ConfigurationProperties</code> (<code class="literal">ServerProperties</code> is the main one here), but also look at <code class="literal">EmbeddedServletContainerCustomizer</code> and various Tomcat-specific <code class="literal">*Customizers</code> that you can add in one of those. The Tomcat APIs are quite rich so once you have access to the <code class="literal">TomcatEmbeddedServletContainerFactory</code> you can modify it in a number of ways. Or the nuclear option is to add your own <code class="literal">TomcatEmbeddedServletContainerFactory</code>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-enable-multiple-connectors-in-tomcat" href="#howto-enable-multiple-connectors-in-tomcat"></a>64.8 Enable Multiple Connectors with Tomcat</h2></div></div></div><p>Add a <code class="literal">org.apache.catalina.connector.Connector</code> to the <code class="literal">TomcatEmbeddedServletContainerFactory</code> which can allow multiple connectors, e.g. HTTP and HTTPS connector:</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@Bean</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> EmbeddedServletContainerFactory servletContainer() { TomcatEmbeddedServletContainerFactory tomcat = <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">new</span> TomcatEmbeddedServletContainerFactory(); tomcat.addAdditionalTomcatConnectors(createSslConnector()); <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">return</span> tomcat; } <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">private</span> Connector createSslConnector() { Connector connector = <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">new</span> Connector(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"org.apache.coyote.http11.Http11NioProtocol"</span>); Http11NioProtocol protocol = (Http11NioProtocol) connector.getProtocolHandler(); <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">try</span> { File keystore = <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">new</span> ClassPathResource(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"keystore"</span>).getFile(); File truststore = <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">new</span> ClassPathResource(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"keystore"</span>).getFile(); connector.setScheme(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"https"</span>); connector.setSecure(true); connector.setPort(<span class="hl-number">8443</span>); protocol.setSSLEnabled(true); protocol.setKeystoreFile(keystore.getAbsolutePath()); protocol.setKeystorePass(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"changeit"</span>); protocol.setTruststoreFile(truststore.getAbsolutePath()); protocol.setTruststorePass(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"changeit"</span>); protocol.setKeyAlias(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"apitester"</span>); <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">return</span> connector; } <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">catch</span> (IOException ex) { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">throw</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">new</span> IllegalStateException(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"can't access keystore: ["</span> + <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"keystore"</span> + <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"] or truststore: ["</span> + <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"keystore"</span> + <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"]"</span>, ex); } }</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-use-tomcat-behind-a-proxy-server" href="#howto-use-tomcat-behind-a-proxy-server"></a>64.9 Use Tomcat behind a front-end proxy server</h2></div></div></div><p>Spring Boot will automatically configure Tomcat’s <code class="literal">RemoteIpValve</code> if you enable it. This allows you to transparently use the standard <code class="literal">x-forwarded-for</code> and <code class="literal">x-forwarded-proto</code> headers that most front-end proxy servers add. The valve is switched on by setting one or both of these properties to something non-empty (these are the conventional values used by most proxies, and if you only set one the other will be set automatically):</p><pre class="screen">server.tomcat.remote_ip_header=x-forwarded-for server.tomcat.protocol_header=x-forwarded-proto</pre><p>If your proxy uses different headers you can customize the valve’s configuration by adding some entries to <code class="literal">application.properties</code>, e.g.</p><pre class="screen">server.tomcat.remote_ip_header=x-your-remote-ip-header server.tomcat.protocol_header=x-your-protocol-header</pre><p>The valve is also configured with a default regular expression that matches internal proxies that are to be trusted. By default, IP addresses in 10/8, 192.168/16, 169.254/16 and 127/8 are trusted. You can customize the valve’s configuration by adding an entry to <code class="literal">application.properties</code>, e.g.</p><pre class="screen">server.tomcat.internal_proxies=192\\.168\\.\\d{1,3}\\.\\d{1,3}</pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>The double backslashes are only required when you’re using a properties file for configuration. If you are using YAML, single backslashes are sufficient and a value that’s equivalent to the one shown above would be <code class="literal">192\.168\.\d{1,3}\.\d{1,3}</code>.</p></td></tr></tbody></table></div><p>Alternatively, you can take complete control of the configuration of the <code class="literal">RemoteIpValve</code> by configuring and adding it in a <code class="literal">TomcatEmbeddedServletContainerFactory</code> bean.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-use-jetty-instead-of-tomcat" href="#howto-use-jetty-instead-of-tomcat"></a>64.10 Use Jetty instead of Tomcat</h2></div></div></div><p>The Spring Boot starters (<code class="literal">spring-boot-starter-web</code> in particular) use Tomcat as an embedded container by default. You need to exclude those dependencies and include the Jetty one instead. Spring Boot provides Tomcat and Jetty dependencies bundled together as separate starters to help make this process as easy as possible.</p><p>Example in Maven:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.boot<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-boot-starter-web<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><exclusions></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><exclusion></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.boot<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-boot-starter-tomcat<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></exclusion></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></exclusions></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.boot<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-boot-starter-jetty<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependency></span></pre><p>Example in Gradle:</p><pre class="programlisting">configurations { compile.exclude module: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"spring-boot-starter-tomcat"</span> } dependencies { compile(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"org.springframework.boot:spring-boot-starter-web:1.2.2.RELEASE"</span>) compile(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"org.springframework.boot:spring-boot-starter-jetty:1.2.2.RELEASE"</span>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// ...</span> }</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-configure-jetty" href="#howto-configure-jetty"></a>64.11 Configure Jetty</h2></div></div></div><p>Generally you can follow the advice from <span class="emphasis"><em><a class="xref" href="#howto-discover-build-in-options-for-external-properties" title="63.7 Discover built-in options for external properties">Section 63.7, “Discover built-in options for external properties”</a></em></span> about <code class="literal">@ConfigurationProperties</code> (<code class="literal">ServerProperties</code> is the main one here), but also look at <code class="literal">EmbeddedServletContainerCustomizer</code>. The Jetty APIs are quite rich so once you have access to the <code class="literal">JettyEmbeddedServletContainerFactory</code> you can modify it in a number of ways. Or the nuclear option is to add your own <code class="literal">JettyEmbeddedServletContainerFactory</code>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-use-undertow-instead-of-tomcat" href="#howto-use-undertow-instead-of-tomcat"></a>64.12 Use Undertow instead of Tomcat</h2></div></div></div><p>Using Undertow instead of Tomcat is very similar to <a class="link" href="#howto-use-jetty-instead-of-tomcat" title="64.10 Use Jetty instead of Tomcat">using Jetty instead of Tomcat</a>. You need to exclude the Tomcat dependencies and include the Undertow starter instead.</p><p>Example in Maven:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.boot<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-boot-starter-web<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><exclusions></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><exclusion></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.boot<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-boot-starter-tomcat<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></exclusion></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></exclusions></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.boot<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-boot-starter-undertow<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependency></span></pre><p>Example in Gradle:</p><pre class="programlisting">configurations { compile.exclude module: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"spring-boot-starter-tomcat"</span> } dependencies { compile <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'org.springframework.boot:spring-boot-starter-web:1.2.2.RELEASE") </span> compile <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'org.springframework.boot:spring-boot-starter-undertow:1.2.2.RELEASE") </span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// ...</span> }</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-configure-undertow" href="#howto-configure-undertow"></a>64.13 Configure Undertow</h2></div></div></div><p>Generally you can follow the advice from <span class="emphasis"><em><a class="xref" href="#howto-discover-build-in-options-for-external-properties" title="63.7 Discover built-in options for external properties">Section 63.7, “Discover built-in options for external properties”</a></em></span> about <code class="literal">@ConfigurationProperties</code> (<code class="literal">ServerProperties</code> and <code class="literal">ServerProperties.Undertow</code> are the main ones here), but also look at <code class="literal">EmbeddedServletContainerCustomizer</code>. Once you have access to the <code class="literal">UndertowEmbeddedServletContainerFactory</code> you can use an <code class="literal">UndertowBuilderCustomizer</code> to modify Undertow’s configuration to meet your needs. Or the nuclear option is to add your own <code class="literal">UndertowEmbeddedServletContainerFactory</code>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-enable-multiple-listeners-in-undertow" href="#howto-enable-multiple-listeners-in-undertow"></a>64.14 Enable Multiple Listeners with Undertow</h2></div></div></div><p>Add an <code class="literal">UndertowBuilderCustomizer</code> to the <code class="literal">UndertowEmbeddedServletContainerFactory</code> and add a listener to the <code class="literal">Builder</code>:</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@Bean</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> UndertowEmbeddedServletContainerFactory embeddedServletContainerFactory() { UndertowEmbeddedServletContainerFactory factory = <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">new</span> UndertowEmbeddedServletContainerFactory(); factory.addBuilderCustomizers(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">new</span> UndertowBuilderCustomizer() { <em><span class="hl-annotation" style="color: gray">@Override</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">void</span> customize(Builder builder) { builder.addHttpListener(<span class="hl-number">8080</span>, <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"0.0.0.0"</span>); } }); <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">return</span> factory; }</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-use-tomcat-7" href="#howto-use-tomcat-7"></a>64.15 Use Tomcat 7</h2></div></div></div><p>Tomcat 7 works with Spring Boot, but the default is to use Tomcat 8. If you cannot use Tomcat 8 (for example, because you are using Java 1.6) you will need to change your classpath to reference Tomcat 7 .</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_use_tomcat_7_with_maven" href="#_use_tomcat_7_with_maven"></a>64.15.1 Use Tomcat 7 with Maven</h3></div></div></div><p><a name="howto-use-tomcat-7-maven" href="#howto-use-tomcat-7-maven"></a>If you are using the starter poms and parent you can just change the Tomcat version property, e.g. for a simple webapp or service:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><properties></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><tomcat.version></span>7.0.59<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></tomcat.version></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></properties></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependencies></span> ... <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.boot<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-boot-starter-web<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependency></span> ... <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependencies></span></pre></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_use_tomcat_7_with_gradle" href="#_use_tomcat_7_with_gradle"></a>64.15.2 Use Tomcat 7 with Gradle</h3></div></div></div><p><a name="howto-use-tomcat-7-gradle" href="#howto-use-tomcat-7-gradle"></a>You can use a resolution strategy to change the versions of the Tomcat dependencies, e.g. for a simple webapp or service:</p><pre class="programlisting">configurations.all { resolutionStrategy { eachDependency { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">if</span> (it.requested.group == <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'org.apache.tomcat.embed'</span>) { it.useVersion <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'7.0.59'</span> } } } } dependencies { compile <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'org.springframework.boot:spring-boot-starter-web'</span> }</pre></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-use-jetty-8" href="#howto-use-jetty-8"></a>64.16 Use Jetty 8</h2></div></div></div><p>Jetty 8 works with Spring Boot, but the default is to use Jetty 9. If you cannot use Jetty 9 (for example, because you are using Java 1.6) you will need to change your classpath to reference Jetty 8. You will also need to exclude Jetty’s WebSocket-related dependencies.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="howto-use-jetty-8-maven" href="#howto-use-jetty-8-maven"></a>64.16.1 Use Jetty 8 with Maven</h3></div></div></div><p>If you are using the starter poms and parent you can just add the Jetty starter with the required WebSocket exclusion and change the version properties, e.g. for a simple webapp or service:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><properties></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><jetty.version></span>8.1.15.v20140411<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></jetty.version></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><jetty-jsp.version></span>2.2.0.v201112011158<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></jetty-jsp.version></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></properties></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependencies></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.boot<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-boot-starter-web<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><exclusions></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><exclusion></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.boot<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-boot-starter-tomcat<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></exclusion></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></exclusions></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.boot<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-boot-starter-jetty<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><exclusions></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><exclusion></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.eclipse.jetty.websocket<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>*<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></exclusion></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></exclusions></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependencies></span></pre></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="howto-use-jetty-8-gradle" href="#howto-use-jetty-8-gradle"></a>64.16.2 Use Jetty 8 with Gradle</h3></div></div></div><p>You can use a resolution strategy to change the version of the Jetty dependencies, e.g. for a simple webapp or service:</p><pre class="programlisting">configurations.all { resolutionStrategy { eachDependency { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">if</span> (it.requested.group == <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'org.eclipse.jetty'</span>) { it.useVersion <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'8.1.15.v20140411'</span> } } } } dependencies { compile (<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'org.springframework.boot:spring-boot-starter-web'</span>) { exclude group: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'org.springframework.boot'</span>, module: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'spring-boot-starter-tomcat'</span> } compile (<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'org.springframework.boot:spring-boot-starter-jetty'</span>) { exclude group: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'org.eclipse.jetty.websocket'</span> } }</pre></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-create-websocket-endpoints-using-serverendpoint" href="#howto-create-websocket-endpoints-using-serverendpoint"></a>64.17 Create WebSocket endpoints using @ServerEndpoint</h2></div></div></div><p>If you want to use <code class="literal">@ServerEndpoint</code> in a Spring Boot application that used an embedded container, you must declare a single <code class="literal">ServerEndpointExporter</code> <code class="literal">@Bean</code>:</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@Bean</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> ServerEndpointExporter serverEndpointExporter() { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">return</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">new</span> ServerEndpointExporter(); }</pre><p>This bean will register any <code class="literal">@ServerEndpoint</code> annotated beans with the underlying WebSocket container. When deployed to a standalone servlet container this role is performed by a servlet container initializer and the <code class="literal">ServerEndpointExporter</code> bean is not required.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="how-to-enable-http-response-compression" href="#how-to-enable-http-response-compression"></a>64.18 Enable HTTP response compression</h2></div></div></div><p>Spring Boot provides two mechanisms for enabling compression of HTTP compression; one that is Tomcat-specific and another that uses a filter and works with Jetty, Tomcat, and Undertow.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="how-to-enable-http-response-compression-tomcat" href="#how-to-enable-http-response-compression-tomcat"></a>64.18.1 Enable Tomcat’s HTTP response compression</h3></div></div></div><p>Tomcat provides built-in support for HTTP response compression. It is disabled by default, but can easily be enabled via <code class="literal">application.properties</code>:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.tomcat.compression</span>: on</pre><p>When set to <code class="literal">on</code> Tomcat will compress responses with a length that is at least 2048 bytes. This limit can be configured by specifying an integer value rather than <code class="literal">on</code>, e.g.:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.tomcat.compression</span>: 4096</pre><p>By default Tomcat will only compress responses with certain MIME types (<code class="literal">text/html</code>, <code class="literal">text/xml</code>, and <code class="literal">text/plain</code>). You can customize this using the <code class="literal">server.tomcat.compressableMimeTypes</code> property, e.g.:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.tomcat.compressableMimeTypes</span>=application/json,application/xml</pre></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="how-to-enable-http-compression-gzip-filter" href="#how-to-enable-http-compression-gzip-filter"></a>64.18.2 Enable HTTP response compression using GzipFilter</h3></div></div></div><p>If you’re using Jetty or Undertow, or you want more sophisticated control over HTTP response compression, Spring Boot provides auto-configuration for Jetty’s <code class="literal">GzipFilter</code>. While this filter is part of Jetty, it’s compatible with Tomcat and Undertow as well. To enable the filter, simply add a dependency on <code class="literal">org.eclipse.jetty:jetty-servlets</code> to your application.</p><p><code class="literal">GzipFilter</code> can be configured using the <code class="literal">spring.http.gzip.*</code> properties. See <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/GzipFilterProperties.java" target="_top"><code class="literal">GzipFilterProperties</code></a> for more details.</p></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="howto-spring-mvc" href="#howto-spring-mvc"></a>65. Spring MVC</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-write-a-json-rest-service" href="#howto-write-a-json-rest-service"></a>65.1 Write a JSON REST service</h2></div></div></div><p>Any Spring <code class="literal">@RestController</code> in a Spring Boot application should render JSON response by default as long as Jackson2 is on the classpath. For example:</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@RestController</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> MyController { <em><span class="hl-annotation" style="color: gray">@RequestMapping("/thing")</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> MyThing thing() { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">return</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">new</span> MyThing(); } }</pre><p>As long as <code class="literal">MyThing</code> can be serialized by Jackson2 (e.g. a normal POJO or Groovy object) then <code class="literal"><a class="link" href="http://localhost:8080/thing" target="_top">localhost:8080/thing</a></code> will serve a JSON representation of it by default. Sometimes in a browser you might see XML responses because browsers tend to send accept headers that prefer XML.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-write-an-xml-rest-service" href="#howto-write-an-xml-rest-service"></a>65.2 Write an XML REST service</h2></div></div></div><p>If you have the Jackson XML extension (<code class="literal">jackson-dataformat-xml</code>) on the classpath, it will be used to render XML responses and the very same example as we used for JSON would work. To use it, add the following dependency to your project:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>com.fasterxml.jackson.dataformat<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>jackson-dataformat-xml<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependency></span></pre><p>You may also want to add a dependency on Woodstox. It’s faster than the default Stax implementation provided by the JDK and also adds pretty print support and improved namespace handling:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.codehaus.woodstox<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>woodstox-core-asl<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependency></span></pre><p>If Jackson’s XML extension is not available, JAXB (provided by default in the JDK) will be used, with the additional requirement to have <code class="literal">MyThing</code> annotated as <code class="literal">@XmlRootElement</code>:</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@XmlRootElement</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> MyThing { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">private</span> String name; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// .. getters and setters</span> }</pre><p>To get the server to render XML instead of JSON you might have to send an <code class="literal">Accept: text/xml</code> header (or use a browser).</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-customize-the-jackson-objectmapper" href="#howto-customize-the-jackson-objectmapper"></a>65.3 Customize the Jackson ObjectMapper</h2></div></div></div><p>Spring MVC (client and server side) uses <code class="literal">HttpMessageConverters</code> to negotiate content conversion in an HTTP exchange. If Jackson is on the classpath you already get the default converter(s) provided by <code class="literal">Jackson2ObjectMapperBuilder</code>.</p><p>The <code class="literal">ObjectMapper</code> (or <code class="literal">XmlMapper</code> for Jackson XML converter) instance created by default have the following customized properties:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><code class="literal">MapperFeature.DEFAULT_VIEW_INCLUSION</code> is disabled</li><li class="listitem"><code class="literal">DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES</code> is disabled</li></ul></div><p>Spring Boot has also some features to make it easier to customize this behavior.</p><p>You can configure the <code class="literal">ObjectMapper</code> and <code class="literal">XmlMapper</code> instances using the environment. Jackson provides an extensive suite of simple on/off features that can be used to configure various aspects of its processing. These features are described in five enums in Jackson which map onto properties in the environment:</p><div class="informaltable"><table style="border-collapse: collapse;border-top: 0.5pt solid ; border-bottom: 0.5pt solid ; border-left: 0.5pt solid ; border-right: 0.5pt solid ; "><colgroup><col class="col_1"><col class="col_2"></colgroup><thead><tr><th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top">Jackson enum</th><th style="border-bottom: 0.5pt solid ; " align="left" valign="top">Environment property</th></tr></thead><tbody><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">com.fasterxml.jackson.databind.DeserializationFeature</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring.jackson.deserialization.<feature_name>=true|false</code></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">com.fasterxml.jackson.core.JsonGenerator.Feature</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring.jackson.generator.<feature_name>=true|false</code></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">com.fasterxml.jackson.databind.MapperFeature</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring.jackson.mapper.<feature_name>=true|false</code></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">com.fasterxml.jackson.core.JsonParser.Feature</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring.jackson.parser.<feature_name>=true|false</code></p></td></tr><tr><td style="border-right: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">com.fasterxml.jackson.databind.SerializationFeature</code></p></td><td style="" align="left" valign="top"><p><code class="literal">spring.jackson.serialization.<feature_name>=true|false</code></p></td></tr></tbody></table></div><p>For example, to enable pretty print, set <code class="literal">spring.jackson.serialization.indent_output=true</code>. Note that, thanks to the use of <a class="link" href="#boot-features-external-config-relaxed-binding" title="23.7.2 Relaxed binding">relaxed binding</a>, the case of <code class="literal">indent_output</code> doesn’t have to match the case of the corresponding enum constant which is <code class="literal">INDENT_OUTPUT</code>.</p><p>If you want to replace the default <code class="literal">ObjectMapper</code> completely, define a <code class="literal">@Bean</code> of that type and mark it as <code class="literal">@Primary</code>.</p><p>Defining a <code class="literal">@Bean</code> of type <code class="literal">Jackson2ObjectMapperBuilder</code> will allow you to customize both default <code class="literal">ObjectMapper</code> and <code class="literal">XmlMapper</code> (used in <code class="literal">MappingJackson2HttpMessageConverter</code> and <code class="literal">MappingJackson2XmlHttpMessageConverter</code> respectively).</p><p>Another way to customize Jackson is to add beans of type <code class="literal">com.fasterxml.jackson.databind.Module</code> to your context. They will be registered with every bean of type <code class="literal">ObjectMapper</code>, providing a global mechanism for contributing custom modules when you add new features to your application.</p><p>Finally, if you provide any <code class="literal">@Beans</code> of type <code class="literal">MappingJackson2HttpMessageConverter</code> then they will replace the default value in the MVC configuration. Also, a convenience bean is provided of type <code class="literal">HttpMessageConverters</code> (always available if you use the default MVC configuration) which has some useful methods to access the default and user-enhanced message converters.</p><p>See also the <span class="emphasis"><em><a class="xref" href="#howto-customize-the-responsebody-rendering" title="65.4 Customize the @ResponseBody rendering">Section 65.4, “Customize the @ResponseBody rendering”</a></em></span> section and the <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.java" target="_top"><code class="literal">WebMvcAutoConfiguration</code></a> source code for more details.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-customize-the-responsebody-rendering" href="#howto-customize-the-responsebody-rendering"></a>65.4 Customize the @ResponseBody rendering</h2></div></div></div><p>Spring uses <code class="literal">HttpMessageConverters</code> to render <code class="literal">@ResponseBody</code> (or responses from <code class="literal">@RestController</code>). You can contribute additional converters by simply adding beans of that type in a Spring Boot context. If a bean you add is of a type that would have been included by default anyway (like <code class="literal">MappingJackson2HttpMessageConverter</code> for JSON conversions) then it will replace the default value. A convenience bean is provided of type <code class="literal">HttpMessageConverters</code> (always available if you use the default MVC configuration) which has some useful methods to access the default and user-enhanced message converters (useful, for example if you want to manually inject them into a custom <code class="literal">RestTemplate</code>).</p><p>As in normal MVC usage, any <code class="literal">WebMvcConfigurerAdapter</code> beans that you provide can also contribute converters by overriding the <code class="literal">configureMessageConverters</code> method, but unlike with normal MVC, you can supply only additional converters that you need (because Spring Boot uses the same mechanism to contribute its defaults). Finally, if you opt-out of the Spring Boot default MVC configuration by providing your own <code class="literal">@EnableWebMvc</code> configuration, then you can take control completely and do everything manually using <code class="literal">getMessageConverters</code> from <code class="literal">WebMvcConfigurationSupport</code>.</p><p>See the <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.java" target="_top"><code class="literal">WebMvcAutoConfiguration</code></a> source code for more details.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-multipart-file-upload-configuration" href="#howto-multipart-file-upload-configuration"></a>65.5 Handling Multipart File Uploads</h2></div></div></div><p>Spring Boot embraces the Servlet 3 <code class="literal">javax.servlet.http.Part</code> API to support uploading files. By default Spring Boot configures Spring MVC with a maximum file of 1Mb per file and a maximum of 10Mb of file data in a single request. You may override these values, as well as the location to which intermediate data is stored (e.g., to the <code class="literal">/tmp</code> directory) and the threshold past which data is flushed to disk by using the properties exposed in the <code class="literal">MultipartProperties</code> class. If you want to specify that files be unlimited, for example, set the <code class="literal">multipart.maxFileSize</code> property to <code class="literal">-1</code>.</p><p>The multipart support is helpful when you want to receive multipart encoded file data as a <code class="literal">@RequestParam</code>-annotated parameter of type <code class="literal">MultipartFile</code> in a Spring MVC controller handler method.</p><p>See the <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/MultipartAutoConfiguration.java" target="_top"><code class="literal">MultipartAutoConfiguration</code></a> source for more details.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-switch-off-the-spring-mvc-dispatcherservlet" href="#howto-switch-off-the-spring-mvc-dispatcherservlet"></a>65.6 Switch off the Spring MVC DispatcherServlet</h2></div></div></div><p>Spring Boot wants to serve all content from the root of your application <code class="literal">/</code> down. If you would rather map your own servlet to that URL you can do it, but of course you may lose some of the other Boot MVC features. To add your own servlet and map it to the root resource just declare a <code class="literal">@Bean</code> of type <code class="literal">Servlet</code> and give it the special bean name <code class="literal">dispatcherServlet</code> (You can also create a bean of a different type with that name if you want to switch it off and not replace it).</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-switch-off-default-mvc-configuration" href="#howto-switch-off-default-mvc-configuration"></a>65.7 Switch off the Default MVC configuration</h2></div></div></div><p>The easiest way to take complete control over MVC configuration is to provide your own <code class="literal">@Configuration</code> with the <code class="literal">@EnableWebMvc</code> annotation. This will leave all MVC configuration in your hands.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-customize-view-resolvers" href="#howto-customize-view-resolvers"></a>65.8 Customize ViewResolvers</h2></div></div></div><p>A <code class="literal">ViewResolver</code> is a core component of Spring MVC, translating view names in <code class="literal">@Controller</code> to actual <code class="literal">View</code> implementations. Note that <code class="literal">ViewResolvers</code> are mainly used in UI applications, rather than REST-style services (a <code class="literal">View</code> is not used to render a <code class="literal">@ResponseBody</code>). There are many implementations of <code class="literal">ViewResolver</code> to choose from, and Spring on its own is not opinionated about which ones you should use. Spring Boot, on the other hand, installs one or two for you depending on what it finds on the classpath and in the application context. The <code class="literal">DispatcherServlet</code> uses all the resolvers it finds in the application context, trying each one in turn until it gets a result, so if you are adding your own you have to be aware of the order and in which position your resolver is added.</p><p><code class="literal">WebMvcAutoConfiguration</code> adds the following <code class="literal">ViewResolvers</code> to your context:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">An <code class="literal">InternalResourceViewResolver</code> with bean id ‘defaultViewResolver’. This one locates physical resources that can be rendered using the <code class="literal">DefaultServlet</code> (e.g. static resources and JSP pages if you are using those). It applies a prefix and a suffix to the view name and then looks for a physical resource with that path in the servlet context (defaults are both empty, but accessible for external configuration via <code class="literal">spring.view.prefix</code> and <code class="literal">spring.view.suffix</code>). It can be overridden by providing a bean of the same type.</li><li class="listitem">A <code class="literal">BeanNameViewResolver</code> with id ‘beanNameViewResolver’. This is a useful member of the view resolver chain and will pick up any beans with the same name as the <code class="literal">View</code> being resolved. It shouldn’t be necessary to override or replace it.</li><li class="listitem">A <code class="literal">ContentNegotiatingViewResolver</code> with id ‘viewResolver’ is only added if there <span class="strong"><strong>are</strong></span> actually beans of type <code class="literal">View</code> present. This is a ‘master’ resolver, delegating to all the others and attempting to find a match to the ‘Accept’ HTTP header sent by the client. There is a useful <a class="link" href="https://spring.io/blog/2013/06/03/content-negotiation-using-views" target="_top">blog about <code class="literal">ContentNegotiatingViewResolver</code></a> that you might like to study to learn more, and also look at the source code for detail. You can switch off the auto-configured <code class="literal">ContentNegotiatingViewResolver</code> by defining a bean named ‘viewResolver’.</li><li class="listitem">If you use Thymeleaf you will also have a <code class="literal">ThymeleafViewResolver</code> with id ‘thymeleafViewResolver’. It looks for resources by surrounding the view name with a prefix and suffix (externalized to <code class="literal">spring.thymeleaf.prefix</code> and <code class="literal">spring.thymeleaf.suffix</code>, defaults ‘classpath:/templates/’ and ‘.html’ respectively). It can be overridden by providing a bean of the same name.</li><li class="listitem">If you use FreeMarker you will also have a <code class="literal">FreeMarkerViewResolver</code> with id ‘freeMarkerViewResolver’. It looks for resources in a loader path (externalized to <code class="literal">spring.freemarker.templateLoaderPath</code>, default ‘classpath:/templates/’) by surrounding the view name with a prefix and suffix (externalized to <code class="literal">spring.freemarker.prefix</code> and <code class="literal">spring.freemarker.suffix</code>, with empty and ‘.ftl’ defaults respectively). It can be overridden by providing a bean of the same name.</li><li class="listitem">If you use Groovy templates (actually if groovy-templates is on your classpath) you will also have a <code class="literal">Groovy TemplateViewResolver</code> with id ‘groovyTemplateViewResolver’. It looks for resources in a loader path by surrounding the view name with a prefix and suffix (externalized to <code class="literal">spring.groovy.template.prefix</code> and <code class="literal">spring.groovy.template.suffix</code>, defaults ‘classpath:/templates/’ and ‘.tpl’ respectively). It can be overriden by providing a bean of the same name.</li><li class="listitem">If you use Velocity you will also have a <code class="literal">VelocityViewResolver</code> with id ‘velocityViewResolver’. It looks for resources in a loader path (externalized to <code class="literal">spring.velocity.resourceLoaderPath</code>, default ‘classpath:/templates/’) by surrounding the view name with a prefix and suffix (externalized to <code class="literal">spring.velocity.prefix</code> and <code class="literal">spring.velocity.suffix</code>, with empty and ‘.vm’ defaults respectively). It can be overridden by providing a bean of the same name.</li></ul></div><p>Check out <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.java" target="_top"><code class="literal">WebMvcAutoConfiguration</code></a>, <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java" target="_top"><code class="literal">ThymeleafAutoConfiguration</code></a>, <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfiguration.java" target="_top"><code class="literal">FreeMarkerAutoConfiguration</code></a>, <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAutoConfiguration.java" target="_top"><code class="literal">GroovyTemplateAutoConfiguration</code></a> and <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/velocity/VelocityAutoConfiguration.java" target="_top"><code class="literal">VelocityAutoConfiguration</code></a></p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="howto-logging" href="#howto-logging"></a>66. Logging</h2></div></div></div><p>Spring Boot has no mandatory logging dependence, except for the <code class="literal">commons-logging</code> API, of which there are many implementations to choose from. To use <a class="link" href="http://logback.qos.ch/" target="_top">Logback</a> you need to include it, and some bindings for <code class="literal">commons-logging</code> on the classpath. The simplest way to do that is through the starter poms which all depend on <code class="literal">spring-boot-starter-logging</code>. For a web application you only need <code class="literal">spring-boot-starter-web</code> since it depends transitively on the logging starter. For example, using Maven:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.boot<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-boot-starter-web<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependency></span></pre><p>Spring Boot has a <code class="literal">LoggingSystem</code> abstraction that attempts to configure logging based on the content of the classpath. If Logback is available it is the first choice.</p><p>If the only change you need to make to logging is to set the levels of various loggers then you can do that in <code class="literal">application.properties</code> using the "logging.level" prefix, e.g.</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">logging.level.org.springframework.web</span>: DEBUG <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">logging.level.org.hibernate</span>: ERROR</pre><p>You can also set the location of a file to log to (in addition to the console) using "logging.file".</p><p>To configure the more fine-grained settings of a logging system you need to use the native configuration format supported by the <code class="literal">LoggingSystem</code> in question. By default Spring Boot picks up the native configuration from its default location for the system (e.g. <code class="literal">classpath:logback.xml</code> for Logback), but you can set the location of the config file using the "logging.config" property.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-configure-logback-for-loggin" href="#howto-configure-logback-for-loggin"></a>66.1 Configure Logback for logging</h2></div></div></div><p>If you put a <code class="literal">logback.xml</code> in the root of your classpath it will be picked up from there. Spring Boot provides a default base configuration that you can include if you just want to set levels, e.g.</p><pre class="programlisting"><span class="hl-directive" style="color: maroon"><?xml version="1.0" encoding="UTF-8"?></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><configuration></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><include</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">resource</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"org/springframework/boot/logging/logback/base.xml"</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">/></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><logger</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">name</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"org.springframework.web"</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">level</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"DEBUG"</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">/></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></configuration></span></pre><p>If you look at the default <code class="literal">logback.xml</code> in the spring-boot jar you will see that it uses some useful System properties which the <code class="literal">LoggingSystem</code> takes care of creating for you. These are:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><code class="literal">${PID}</code> the current process ID.</li><li class="listitem"><code class="literal">${LOG_FILE}</code> if <code class="literal">logging.file</code> was set in Boot’s external configuration.</li><li class="listitem"><code class="literal">${LOG_PATH}</code> if <code class="literal">logging.path</code> was set (representing a directory for log files to live in).</li></ul></div><p>Spring Boot also provides some nice ANSI colour terminal output on a console (but not in a log file) using a custom Logback converter. See the default <code class="literal">base.xml</code> configuration for details.</p><p>If Groovy is on the classpath you should be able to configure Logback with <code class="literal">logback.groovy</code> as well (it will be given preference if present).</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-configure-log4j-for-logging" href="#howto-configure-log4j-for-logging"></a>66.2 Configure Log4j for logging</h2></div></div></div><p>Spring Boot also supports either <a class="link" href="http://logging.apache.org/log4j/1.2" target="_top">Log4j</a> or <a class="link" href="http://logging.apache.org/log4j/2.x" target="_top">Log4j 2</a> for logging configuration, but only if one of them is on the classpath. If you are using the starter poms for assembling dependencies that means you have to exclude Logback and then include your chosen version of Log4j instead. If you aren’t using the starter poms then you need to provide <code class="literal">commons-logging</code> (at least) in addition to your chosen version of Log4j.</p><p>The simplest path is probably through the starter poms, even though it requires some jiggling with excludes, .e.g. in Maven:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.boot<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-boot-starter-web<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.boot<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-boot-starter<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><exclusions></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><exclusion></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.boot<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-boot-starter-logging<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></exclusion></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></exclusions></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.boot<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-boot-starter-log4j<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependency></span></pre><p>To use Log4j 2, simply depend on <code class="literal">spring-boot-starter-log4j2</code> rather than <code class="literal">spring-boot-starter-log4j</code>.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>The use of one of the Log4j starters gathers together the dependencies for common logging requirements (e.g. including having Tomcat use <code class="literal">java.util.logging</code> but configuring the output using Log4j or Log4j 2). See the Actuator Log4j or Log4j 2 samples for more detail and to see it in action.</p></td></tr></tbody></table></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="howto-configure-log4j-for-logging-yaml-or-json-config" href="#howto-configure-log4j-for-logging-yaml-or-json-config"></a>66.2.1 Use YAML or JSON to configure Log4j 2</h3></div></div></div><p>In addition to its default XML configuration format, Log4j 2 also supports YAML and JSON configuration files. To configure Log4j 2 to use an alternative configuration file format all you need to do is add an appropriate dependency to the classpath. To use YAML, add a dependency on <code class="literal">com.fasterxml.jackson.dataformat:jackson-dataformat-yaml</code> and Log4j 2 will look for configuration files names <code class="literal">log4j2.yaml</code> or <code class="literal">log4j2.yml</code>. To use JSON, add a dependency on <code class="literal">com.fasterxml.jackson.core:jackson-databind</code> and Log4j 2 will look for configuration files named <code class="literal">log4j2.json</code> or <code class="literal">log4j2.jsn</code></p></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="howto-data-access" href="#howto-data-access"></a>67. Data Access</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-configure-a-datasource" href="#howto-configure-a-datasource"></a>67.1 Configure a DataSource</h2></div></div></div><p>To override the default settings just define a <code class="literal">@Bean</code> of your own of type <code class="literal">DataSource</code>. Spring Boot provides a utility builder class <code class="literal">DataSourceBuilder</code> that can be used to create one of the standard ones (if it is on the classpath), or you can just create your own, and bind it to a set of <code class="literal">Environment</code> properties as explained in <a class="xref" href="#boot-features-external-config-3rd-party-configuration" title="23.7.1 Third-party configuration">Section 23.7.1, “Third-party configuration”</a>, e.g.</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@Bean</span></em> <em><span class="hl-annotation" style="color: gray">@ConfigurationProperties(prefix="datasource.mine")</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> DataSource dataSource() { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">return</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">new</span> FancyDataSource(); }</pre><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">datasource.mine.jdbcUrl</span>=jdbc:h2:mem:mydb <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">datasource.mine.user</span>=sa <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">datasource.mine.poolSize</span>=30</pre><p>See <span class="emphasis"><em><a class="xref" href="#boot-features-configure-datasource" title="28.1 Configure a DataSource">Section 28.1, “Configure a DataSource”</a></em></span> in the ‘Spring Boot features’ section and the <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java" target="_top"><code class="literal">DataSourceAutoConfiguration</code></a> class for more details.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-two-datasources" href="#howto-two-datasources"></a>67.2 Configure Two DataSources</h2></div></div></div><p>Creating more than one data source works the same as creating the first one. You might want to mark one of them as <code class="literal">@Primary</code> if you are using the default auto-configuration for JDBC or JPA (then that one will be picked up by any <code class="literal">@Autowired</code> injections).</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@Bean</span></em> <em><span class="hl-annotation" style="color: gray">@Primary</span></em> <em><span class="hl-annotation" style="color: gray">@ConfigurationProperties(prefix="datasource.primary")</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> DataSource primaryDataSource() { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">return</span> DataSourceBuilder.create().build(); } <em><span class="hl-annotation" style="color: gray">@Bean</span></em> <em><span class="hl-annotation" style="color: gray">@ConfigurationProperties(prefix="datasource.secondary")</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> DataSource secondaryDataSource() { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">return</span> DataSourceBuilder.create().build(); }</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-use-spring-data-repositories" href="#howto-use-spring-data-repositories"></a>67.3 Use Spring Data repositories</h2></div></div></div><p>Spring Data can create implementations for you of <code class="literal">@Repository</code> interfaces of various flavors. Spring Boot will handle all of that for you as long as those <code class="literal">@Repositories</code> are included in the same package (or a sub-package) of your <code class="literal">@EnableAutoConfiguration</code> class.</p><p>For many applications all you will need is to put the right Spring Data dependencies on your classpath (there is a <code class="literal">spring-boot-starter-data-jpa</code> for JPA and a <code class="literal">spring-boot-starter-data-mongodb</code> for Mongodb), create some repository interfaces to handle your <code class="literal">@Entity</code> objects. Examples are in the <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-samples/spring-boot-sample-data-jpa" target="_top">JPA sample</a> or the <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-samples/spring-boot-sample-data-mongodb" target="_top">Mongodb sample</a>.</p><p>Spring Boot tries to guess the location of your <code class="literal">@Repository</code> definitions, based on the <code class="literal">@EnableAutoConfiguration</code> it finds. To get more control, use the <code class="literal">@EnableJpaRepositories</code> annotation (from Spring Data JPA).</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-separate-entity-definitions-from-spring-configuration" href="#howto-separate-entity-definitions-from-spring-configuration"></a>67.4 Separate @Entity definitions from Spring configuration</h2></div></div></div><p>Spring Boot tries to guess the location of your <code class="literal">@Entity</code> definitions, based on the <code class="literal">@EnableAutoConfiguration</code> it finds. To get more control, you can use the <code class="literal">@EntityScan</code> annotation, e.g.</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@Configuration</span></em> <em><span class="hl-annotation" style="color: gray">@EnableAutoConfiguration</span></em> <em><span class="hl-annotation" style="color: gray">@EntityScan(basePackageClasses=City.class)</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> Application { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">//...</span> }</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-configure-jpa-properties" href="#howto-configure-jpa-properties"></a>67.5 Configure JPA properties</h2></div></div></div><p>Spring Data JPA already provides some vendor-independent configuration options (e.g. for SQL logging) and Spring Boot exposes those, and a few more for hibernate as external configuration properties. The most common options to set are:</p><pre class="screen">spring.jpa.hibernate.ddl-auto: create-drop spring.jpa.hibernate.naming_strategy: org.hibernate.cfg.ImprovedNamingStrategy spring.jpa.database: H2 spring.jpa.show-sql: true</pre><p>(Because of relaxed data binding hyphens or underscores should work equally well as property keys.) The <code class="literal">ddl-auto</code> setting is a special case in that it has different defaults depending on whether you are using an embedded database (<code class="literal">create-drop</code>) or not (<code class="literal">none</code>). In addition all properties in <code class="literal">spring.jpa.properties.*</code> are passed through as normal JPA properties (with the prefix stripped) when the local <code class="literal">EntityManagerFactory</code> is created.</p><p>See <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.java" target="_top"><code class="literal">HibernateJpaAutoConfiguration</code></a> and <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaBaseConfiguration.java" target="_top"><code class="literal">JpaBaseConfiguration</code></a> for more details.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-use-custom-entity-manager" href="#howto-use-custom-entity-manager"></a>67.6 Use a custom EntityManagerFactory</h2></div></div></div><p>To take full control of the configuration of the <code class="literal">EntityManagerFactory</code>, you need to add a <code class="literal">@Bean</code> named ‘entityManagerFactory’. Spring Boot auto-configuration switches off its entity manager based on the presence of a bean of that type.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-use-two-entity-managers" href="#howto-use-two-entity-managers"></a>67.7 Use Two EntityManagers</h2></div></div></div><p>Even if the default <code class="literal">EntityManagerFactory</code> works fine, you will need to define a new one because otherwise the presence of the second bean of that type will switch off the default. To make it easy to do that you can use the convenient <code class="literal">EntityManagerBuilder</code> provided by Spring Boot, or if you prefer you can just use the <code class="literal">LocalContainerEntityManagerFactoryBean</code> directly from Spring ORM.</p><p>Example:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// add two data sources configured as above</span> <em><span class="hl-annotation" style="color: gray">@Bean</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> LocalContainerEntityManagerFactoryBean customerEntityManagerFactory( EntityManagerFactoryBuilder builder) { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">return</span> builder .dataSource(customerDataSource()) .packages(Customer.<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span>) .persistenceUnit(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"customers"</span>) .build(); } <em><span class="hl-annotation" style="color: gray">@Bean</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> LocalContainerEntityManagerFactoryBean orderEntityManagerFactory( EntityManagerFactoryBuilder builder) { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">return</span> builder .dataSource(orderDataSource()) .packages(Order.<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span>) .persistenceUnit(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"orders"</span>) .build(); }</pre><p>The configuration above almost works on its own. To complete the picture you need to configure <code class="literal">TransactionManagers</code> for the two <code class="literal">EntityManagers</code> as well. One of them could be picked up by the default <code class="literal">JpaTransactionManager</code> in Spring Boot if you mark it as <code class="literal">@Primary</code>. The other would have to be explicitly injected into a new instance. Or you might be able to use a JTA transaction manager spanning both.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-use-traditional-persistence-xml" href="#howto-use-traditional-persistence-xml"></a>67.8 Use a traditional persistence.xml</h2></div></div></div><p>Spring doesn’t require the use of XML to configure the JPA provider, and Spring Boot assumes you want to take advantage of that feature. If you prefer to use <code class="literal">persistence.xml</code> then you need to define your own <code class="literal">@Bean</code> of type <code class="literal">LocalEntityManagerFactoryBean</code> (with id ‘entityManagerFactory’, and set the persistence unit name there.</p><p>See <a class="link" href="https://github.com/spring-projects/spring-boot/blob/master/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaBaseConfiguration.java" target="_top"><code class="literal">JpaBaseConfiguration</code></a> for the default settings.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-use-spring-data-jpa--and-mongo-repositories" href="#howto-use-spring-data-jpa--and-mongo-repositories"></a>67.9 Use Spring Data JPA and Mongo repositories</h2></div></div></div><p>Spring Data JPA and Spring Data Mongo can both create <code class="literal">Repository</code> implementations for you automatically. If they are both present on the classpath, you might have to do some extra configuration to tell Spring Boot which one (or both) you want to create repositories for you. The most explicit way to do that is to use the standard Spring Data <code class="literal">@Enable*Repositories</code> and tell it the location of your <code class="literal">Repository</code> interfaces (where ‘*’ is ‘Jpa’ or ‘Mongo’ or both).</p><p>There are also flags <code class="literal">spring.data.*.repositories.enabled</code> that you can use to switch the auto-configured repositories on and off in external configuration. This is useful for instance in case you want to switch off the Mongo repositories and still use the auto-configured <code class="literal">MongoTemplate</code>.</p><p>The same obstacle and the same features exist for other auto-configured Spring Data repository types (Elasticsearch, Solr). Just change the names of the annotations and flags respectively.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-use-exposing-spring-data-repositories-rest-endpoint" href="#howto-use-exposing-spring-data-repositories-rest-endpoint"></a>67.10 Expose Spring Data repositories as REST endpoint</h2></div></div></div><p>Spring Data REST can expose the <code class="literal">Repository</code> implementations as REST endpoints for you as long as Spring MVC has been enabled for the application.</p><p>Spring Boot exposes as set of useful properties from the <code class="literal">spring.data.rest</code> namespace that customize the <a class="link" href="http://docs.spring.io/spring-data/rest/docs/current/api/org/springframework/data/rest/core/config/RepositoryRestConfiguration.html" target="_top"><code class="literal">RepositoryRestConfiguration</code></a>. If you need to provide additional customization, you can create a <code class="literal">@Configuration</code> class that extends <code class="literal">SpringBootRepositoryRestMvcConfiguration</code>. This class supports the same functionality as <code class="literal">RepositoryRestMvcConfiguration</code>, but allows you to continue using <code class="literal">spring.data.rest.*</code> properties.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="howto-database-initialization" href="#howto-database-initialization"></a>68. Database initialization</h2></div></div></div><p>An SQL database can be initialized in different ways depending on what your stack is. Or of course you can do it manually as long as the database is a separate process.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-initialize-a-database-using-jpa" href="#howto-initialize-a-database-using-jpa"></a>68.1 Initialize a database using JPA</h2></div></div></div><p>JPA has features for DDL generation, and these can be set up to run on startup against the database. This is controlled through two external properties:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><code class="literal">spring.jpa.generate-ddl</code> (boolean) switches the feature on and off and is vendor independent.</li><li class="listitem"><code class="literal">spring.jpa.hibernate.ddl-auto</code> (enum) is a Hibernate feature that controls the behavior in a more fine-grained way. See below for more detail.</li></ul></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-initialize-a-database-using-hibernate" href="#howto-initialize-a-database-using-hibernate"></a>68.2 Initialize a database using Hibernate</h2></div></div></div><p>You can set <code class="literal">spring.jpa.hibernate.ddl-auto</code> explicitly and the standard Hibernate property values are <code class="literal">none</code>, <code class="literal">validate</code>, <code class="literal">update</code>, <code class="literal">create-drop</code>. Spring Boot chooses a default value for you based on whether it thinks your database is embedded (default <code class="literal">create-drop</code>) or not (default <code class="literal">none</code>). An embedded database is detected by looking at the <code class="literal">Connection</code> type: <code class="literal">hsqldb</code>, <code class="literal">h2</code> and <code class="literal">derby</code> are embedded, the rest are not. Be careful when switching from in-memory to a ‘real’ database that you don’t make assumptions about the existence of the tables and data in the new platform. You either have to set <code class="literal">ddl-auto</code> explicitly, or use one of the other mechanisms to initialize the database.</p><p>In addition, a file named <code class="literal">import.sql</code> in the root of the classpath will be executed on startup. This can be useful for demos and for testing if you are careful, but probably not something you want to be on the classpath in production. It is a Hibernate feature (nothing to do with Spring).</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-intialize-a-database-using-spring-jdbc" href="#howto-intialize-a-database-using-spring-jdbc"></a>68.3 Initialize a database using Spring JDBC</h2></div></div></div><p>Spring JDBC has a <code class="literal">DataSource</code> initializer feature. Spring Boot enables it by default and loads SQL from the standard locations <code class="literal">schema.sql</code> and <code class="literal">data.sql</code> (in the root of the classpath). In addition Spring Boot will load the <code class="literal">schema-${platform}.sql</code> and <code class="literal">data-${platform}.sql</code> files (if present), where <code class="literal">platform</code> is the value of <code class="literal">spring.datasource.platform</code>, e.g. you might choose to set it to the vendor name of the database (<code class="literal">hsqldb</code>, <code class="literal">h2</code>, <code class="literal">oracle</code>, <code class="literal">mysql</code>, <code class="literal">postgresql</code> etc.). Spring Boot enables the failfast feature of the Spring JDBC initializer by default, so if the scripts cause exceptions the application will fail to start. The script locations can be changed by setting <code class="literal">spring.datasource.schema</code> and <code class="literal">spring.datasource.data</code>, and neither location will be processed if <code class="literal">spring.datasource.initialize=false</code>.</p><p>To disable the failfast you can set <code class="literal">spring.datasource.continueOnError=true</code>. This can be useful once an application has matured and been deployed a few times, since the scripts can act as ‘poor man’s migrations’ — inserts that fail mean that the data is already there, so there would be no need to prevent the application from running, for instance.</p><p>If you want to use the <code class="literal">schema.sql</code> initialization in a JPA app (with Hibernate) then <code class="literal">ddl-auto=create-drop</code> will lead to errors if Hibernate tries to create the same tables. To avoid those errors set <code class="literal">ddl-auto</code> explicitly to "" (preferable) or "none". Whether or not you use <code class="literal">ddl-auto=create-drop</code> you can always use <code class="literal">data.sql</code> to initialize new data.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-initialize-a-spring-batch-database" href="#howto-initialize-a-spring-batch-database"></a>68.4 Initialize a Spring Batch database</h2></div></div></div><p>If you are using Spring Batch then it comes pre-packaged with SQL initialization scripts for most popular database platforms. Spring Boot will detect your database type, and execute those scripts by default, and in this case will switch the fail fast setting to false (errors are logged but do not prevent the application from starting). This is because the scripts are known to be reliable and generally do not contain bugs, so errors are ignorable, and ignoring them makes the scripts idempotent. You can switch off the initialization explicitly using <code class="literal">spring.batch.initializer.enabled=false</code>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-use-a-higher-level-database-migration-tool" href="#howto-use-a-higher-level-database-migration-tool"></a>68.5 Use a higher level database migration tool</h2></div></div></div><p>Spring Boot works fine with higher level migration tools <a class="link" href="http://flywaydb.org/" target="_top">Flyway</a> (SQL-based) and <a class="link" href="http://www.liquibase.org/" target="_top">Liquibase</a> (XML). In general we prefer Flyway because it is easier on the eyes, and it isn’t very common to need platform independence: usually only one or at most couple of platforms is needed.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="howto-execute-flyway-database-migrations-on-startup" href="#howto-execute-flyway-database-migrations-on-startup"></a>68.5.1 Execute Flyway database migrations on startup</h3></div></div></div><p>To automatically run Flyway database migrations on startup, add the <code class="literal">org.flywaydb:flyway-core</code> to your classpath.</p><p>The migrations are scripts in the form <code class="literal">V<VERSION>__<NAME>.sql</code> (with <code class="literal"><VERSION></code> an underscore-separated version, e.g. ‘1’ or ‘2_1’). By default they live in a folder <code class="literal">classpath:db/migration</code> but you can modify that using <code class="literal">flyway.locations</code> (a list). See the Flyway class from flyway-core for details of available settings like schemas etc. In addition Spring Boot provides a small set of properties in <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayProperties.java" target="_top"><code class="literal">FlywayProperties</code></a> that can be used to disable the migrations, or switch off the location checking.</p><p>By default Flyway will autowire the (<code class="literal">@Primary</code>) <code class="literal">DataSource</code> in your context and use that for migrations. If you like to use a different <code class="literal">DataSource</code> you can create one and mark its <code class="literal">@Bean</code> as <code class="literal">@FlywayDataSource</code> - if you do that remember to create another one and mark it as <code class="literal">@Primary</code> if you want two data sources. Or you can use Flyway’s native <code class="literal">DataSource</code> by setting <code class="literal">flyway.[url,user,password]</code> in external properties.</p><p>There is a <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-samples/spring-boot-sample-flyway" target="_top">Flyway sample</a> so you can see how to set things up.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="howto-execute-liquibase-database-migrations-on-startup" href="#howto-execute-liquibase-database-migrations-on-startup"></a>68.5.2 Execute Liquibase database migrations on startup</h3></div></div></div><p>To automatically run Liquibase database migrations on startup, add the <code class="literal">org.liquibase:liquibase-core</code> to your classpath.</p><p>The master change log is by default read from <code class="literal">db/changelog/db.changelog-master.yaml</code> but can be set using <code class="literal">liquibase.change-log</code>. See <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseProperties.java" target="_top"><code class="literal">LiquibaseProperties</code></a> for details of available settings like contexts, default schema etc.</p><p>There is a <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-samples/spring-boot-sample-liquibase" target="_top">Liquibase sample</a> so you can see how to set things up.</p></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="howto-batch-applications" href="#howto-batch-applications"></a>69. Batch applications</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-execute-spring-batch-jobs-on-startup" href="#howto-execute-spring-batch-jobs-on-startup"></a>69.1 Execute Spring Batch jobs on startup</h2></div></div></div><p>Spring Batch auto configuration is enabled by adding <code class="literal">@EnableBatchProcessing</code> (from Spring Batch) somewhere in your context.</p><p>By default it executes <span class="strong"><strong>all</strong></span> <code class="literal">Jobs</code> in the application context on startup (see <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/JobLauncherCommandLineRunner.java" target="_top">JobLauncherCommandLineRunner</a> for details). You can narrow down to a specific job or jobs by specifying <code class="literal">spring.batch.job.names</code> (comma-separated job name patterns).</p><p>If the application context includes a <code class="literal">JobRegistry</code> then the jobs in <code class="literal">spring.batch.job.names</code> are looked up in the registry instead of being autowired from the context. This is a common pattern with more complex systems where multiple jobs are defined in child contexts and registered centrally.</p><p>See <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfiguration.java" target="_top">BatchAutoConfiguration</a> and <a class="link" href="https://github.com/spring-projects/spring-batch/blob/master/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/annotation/EnableBatchProcessing.java" target="_top">@EnableBatchProcessing</a> for more details.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="howto-actuator" href="#howto-actuator"></a>70. Actuator</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-change-the-http-port-or-address-of-the-actuator-endpoints" href="#howto-change-the-http-port-or-address-of-the-actuator-endpoints"></a>70.1 Change the HTTP port or address of the actuator endpoints</h2></div></div></div><p>In a standalone application the Actuator HTTP port defaults to the same as the main HTTP port. To make the application listen on a different port set the external property <code class="literal">management.port</code>. To listen on a completely different network address (e.g. if you have an internal network for management and an external one for user applications) you can also set <code class="literal">management.address</code> to a valid IP address that the server is able to bind to.</p><p>For more detail look at the <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementServerProperties.java" target="_top"><code class="literal">ManagementServerProperties</code></a> source code and <span class="emphasis"><em><a class="xref" href="#production-ready-customizing-management-server-port" title="41.3 Customizing the management server port">Section 41.3, “Customizing the management server port”</a></em></span> in the ‘Production-ready features’ section.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-customize-the-whitelabel-error-page" href="#howto-customize-the-whitelabel-error-page"></a>70.2 Customize the ‘whitelabel’ error page</h2></div></div></div><p>Spring Boot installs a ‘whitelabel’ error page that you will see in browser client if you encounter a server error (machine clients consuming JSON and other media types should see a sensible response with the right error code). To switch it off you can set <code class="literal">error.whitelabel.enabled=false</code>, but normally in addition or alternatively to that you will want to add your own error page replacing the whitelabel one. Exactly how you do this depends on the templating technology that you are using. For example, if you are using Thymeleaf you would add an <code class="literal">error.html</code> template and if you are using FreeMarker you would add an <code class="literal">error.ftl</code> template. In general what you need is a <code class="literal">View</code> that resolves with a name of <code class="literal">error</code>, and/or a <code class="literal">@Controller</code> that handles the <code class="literal">/error</code> path. Unless you replaced some of the default configuration you should find a <code class="literal">BeanNameViewResolver</code> in your <code class="literal">ApplicationContext</code> so a <code class="literal">@Bean</code> with id <code class="literal">error</code> would be a simple way of doing that. Look at <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ErrorMvcAutoConfiguration.java" target="_top"><code class="literal">ErrorMvcAutoConfiguration</code></a> for more options.</p><p>See also the section on <a class="link" href="#boot-features-error-handling" title="26.1.6 Error Handling">Error Handling</a> for details of how to register handlers in the servlet container.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="howto-security" href="#howto-security"></a>71. Security</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-switch-off-spring-boot-security-configuration" href="#howto-switch-off-spring-boot-security-configuration"></a>71.1 Switch off the Spring Boot security configuration</h2></div></div></div><p>If you define a <code class="literal">@Configuration</code> with <code class="literal">@EnableWebSecurity</code> anywhere in your application it will switch off the default webapp security settings in Spring Boot. To tweak the defaults try setting properties in <code class="literal">security.*</code> (see <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityProperties.java" target="_top"><code class="literal">SecurityProperties</code></a> for details of available settings) and <code class="literal">SECURITY</code> section of <a class="link" href="#common-application-properties-security">Common application properties</a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-change-the-authenticationmanager-and-add-user-accounts" href="#howto-change-the-authenticationmanager-and-add-user-accounts"></a>71.2 Change the AuthenticationManager and add user accounts</h2></div></div></div><p>If you provide a <code class="literal">@Bean</code> of type <code class="literal">AuthenticationManager</code> the default one will not be created, so you have the full feature set of Spring Security available (e.g. <a class="link" href="http://docs.spring.io/spring-security/site/docs/current/reference/htmlsingle/#jc-authentication" target="_top">various authentication options</a>).</p><p>Spring Security also provides a convenient <code class="literal">AuthenticationManagerBuilder</code> which can be used to build an <code class="literal">AuthenticationManager</code> with common options. The recommended way to use this in a webapp is to inject it into a void method in a <code class="literal">WebSecurityConfigurerAdapter</code>, e.g.</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@Configuration</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> SecurityConfiguration <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">extends</span> WebSecurityConfigurerAdapter { <em><span class="hl-annotation" style="color: gray">@Autowired</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">void</span> configureGlobal(AuthenticationManagerBuilder auth) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">throws</span> Exception { auth.inMemoryAuthentication() .withUser(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"barry"</span>).password(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"password"</span>).roles(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"USER"</span>); <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// ... etc.</span> } <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// ... other stuff for application security</span> }</pre><p>You will get the best results if you put this in a nested class, or a standalone class (i.e. not mixed in with a lot of other <code class="literal">@Beans</code> that might be allowed to influence the order of instantiation). The <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-samples/spring-boot-sample-web-secure" target="_top">secure web sample</a> is a useful template to follow.</p><p>If you experience instantiation issues (e.g. using JDBC or JPA for the user detail store) it might be worth extracting the <code class="literal">AuthenticationManagerBuilder</code> callback into a <code class="literal">GlobalAuthenticationConfigurerAdapter</code> (in the <code class="literal">init()</code> method so it happens before the authentication manager is needed elsewhere), e.g.</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@Configuration</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> AuthenticationManagerConfiguration <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">extends</span> GlobalAuthenticationConfigurerAdapter { <em><span class="hl-annotation" style="color: gray">@Override</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">void</span> init(AuthenticationManagerBuilder auth) { auth.inMemoryAuthentication() <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// ... etc.</span> } }</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-enable-https" href="#howto-enable-https"></a>71.3 Enable HTTPS when running behind a proxy server</h2></div></div></div><p>Ensuring that all your main endpoints are only available over HTTPS is an important chore for any application. If you are using Tomcat as a servlet container, then Spring Boot will add Tomcat’s own <code class="literal">RemoteIpValve</code> automatically if it detects some environment settings, and you should be able to rely on the <code class="literal">HttpServletRequest</code> to report whether it is secure or not (even downstream of a proxy server that handles the real SSL termination). The standard behavior is determined by the presence or absence of certain request headers (<code class="literal">x-forwarded-for</code> and <code class="literal">x-forwarded-proto</code>), whose names are conventional, so it should work with most front end proxies. You can switch on the valve by adding some entries to <code class="literal">application.properties</code>, e.g.</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.tomcat.remote_ip_header</span>=x-forwarded-for <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.tomcat.protocol_header</span>=x-forwarded-proto</pre><p>(The presence of either of those properties will switch on the valve. Or you can add the <code class="literal">RemoteIpValve</code> yourself by adding a <code class="literal">TomcatEmbeddedServletContainerFactory</code> bean.)</p><p>Spring Security can also be configured to require a secure channel for all (or some requests). To switch that on in a Spring Boot application you just need to set <code class="literal">security.require_ssl</code> to <code class="literal">true</code> in <code class="literal">application.properties</code>.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="howto-hotswapping" href="#howto-hotswapping"></a>72. Hot swapping</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-reload-static-content" href="#howto-reload-static-content"></a>72.1 Reload static content</h2></div></div></div><p>There are several options for hot reloading. Running in an IDE (especially with debugging on) is a good way to do development (all modern IDEs allow reloading of static resources and usually also hot-swapping of Java class changes). The <a class="link" href="#build-tool-plugins" title="Part VIII. Build tool plugins">Maven and Gradle plugins</a> also support running from the command line with reloading of static files. You can use that with an external css/js compiler process if you are writing that code with higher level tools.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-reload-thymeleaf-content" href="#howto-reload-thymeleaf-content"></a>72.2 Reload Thymeleaf templates without restarting the container</h2></div></div></div><p>If you are using Thymeleaf, then set <code class="literal">spring.thymeleaf.cache</code> to <code class="literal">false</code>. See <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java" target="_top"><code class="literal">ThymeleafAutoConfiguration</code></a> for other Thymeleaf customization options.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-reload-freemarker-content" href="#howto-reload-freemarker-content"></a>72.3 Reload FreeMarker templates without restarting the container</h2></div></div></div><p>If you are using FreeMarker, then set <code class="literal">spring.freemarker.cache</code> to <code class="literal">false</code>. See <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfiguration.java" target="_top"><code class="literal">FreeMarkerAutoConfiguration</code></a> for other FreeMarker customization options.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-reload-groovy-template-content" href="#howto-reload-groovy-template-content"></a>72.4 Reload Groovy templates without restarting the container</h2></div></div></div><p>If you are using Groovy templates, then set <code class="literal">spring.groovy.template.cache</code> to <code class="literal">false</code>. See <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAutoConfiguration.java" target="_top"><code class="literal">GroovyTemplateAutoConfiguration</code></a> for other Groovy customization options.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-reload-velocity-content" href="#howto-reload-velocity-content"></a>72.5 Reload Velocity templates without restarting the container</h2></div></div></div><p>If you are using Velocity, then set <code class="literal">spring.velocity.cache</code> to <code class="literal">false</code>. See <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/velocity/VelocityAutoConfiguration.java" target="_top"><code class="literal">VelocityAutoConfiguration</code></a> for other Velocity customization options.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-reload-java-classes-without-restarting" href="#howto-reload-java-classes-without-restarting"></a>72.6 Reload Java classes without restarting the container</h2></div></div></div><p>Modern IDEs (Eclipse, IDEA, etc.) all support hot swapping of bytecode, so if you make a change that doesn’t affect class or method signatures it should reload cleanly with no side effects.</p><p><a class="link" href="https://github.com/spring-projects/spring-loaded" target="_top">Spring Loaded</a> goes a little further in that it can reload class definitions with changes in the method signatures. With some customization it can force an <code class="literal">ApplicationContext</code> to refresh itself (but there is no general mechanism to ensure that would be safe for a running application anyway, so it would only ever be a development time trick probably).</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="howto-reload-springloaded-maven" href="#howto-reload-springloaded-maven"></a>72.6.1 Configuring Spring Loaded for use with Maven</h3></div></div></div><p>To use Spring Loaded with the Maven command line, just add it as a dependency in the Spring Boot plugin declaration, e.g.</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><plugin></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.boot<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-boot-maven-plugin<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependencies></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>springloaded<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><version></span>1.2.0.RELEASE<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></version></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependencies></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></plugin></span></pre><p>This normally works pretty well with Eclipse and IntelliJ as long as they have their build configuration aligned with the Maven defaults (Eclipse m2e does this out of the box).</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="howto-reload-springloaded-gradle-and-intellij" href="#howto-reload-springloaded-gradle-and-intellij"></a>72.6.2 Configuring Spring Loaded for use with Gradle and IntelliJ</h3></div></div></div><p>You need to jump through a few hoops if you want to use Spring Loaded in combination with Gradle and IntelliJ. By default, IntelliJ will compile classes into a different location than Gradle, causing Spring Loaded monitoring to fail.</p><p>To configure IntelliJ correctly you can use the <code class="literal">idea</code> Gradle plugin:</p><pre class="programlisting">buildscript { repositories { jcenter() } dependencies { classpath <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"org.springframework.boot:spring-boot-gradle-plugin:1.2.2.RELEASE"</span> classpath <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'org.springframework:springloaded:1.2.0.RELEASE'</span> } } apply plugin: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'idea'</span> idea { module { inheritOutputDirs = false outputDir = file(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"$buildDir/classes/main/"</span>) } } <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// ...</span></pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>IntelliJ must be configured to use the same Java version as the command line Gradle task and <code class="literal">springloaded</code> <span class="strong"><strong>must</strong></span> be included as a <code class="literal">buildscript</code> dependency.</p></td></tr></tbody></table></div><p>You can also additionally enable ‘Make Project Automatically’ inside Intellij to automatically compile your code whenever a file is saved.</p></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="howto-build" href="#howto-build"></a>73. Build</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-customize-dependency-versions-with-maven" href="#howto-customize-dependency-versions-with-maven"></a>73.1 Customize dependency versions with Maven</h2></div></div></div><p>If you use a Maven build that inherits directly or indirectly from <code class="literal">spring-boot-dependencies</code> (for instance <code class="literal">spring-boot-starter-parent</code>) but you want to override a specific third-party dependency you can add appropriate <code class="literal"><properties></code> elements. Browse the <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-dependencies/pom.xml" target="_top"><code class="literal">spring-boot-dependencies</code></a> POM for a complete list of properties. For example, to pick a different <code class="literal">slf4j</code> version you would add the following:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><properties></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><slf4j.version></span>1.7.5<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><slf4j.version></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></properties></span></pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>This only works if your Maven project inherits (directly or indirectly) from <code class="literal">spring-boot-dependencies</code>. If you have added <code class="literal">spring-boot-dependencies</code> in your own <code class="literal">dependencyManagement</code> section with <code class="literal"><scope>import</scope></code> you have to redefine the artifact yourself instead of overriding the property .</p></td></tr></tbody></table></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Warning" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="Spring%20Boot%20Reference%20Guide_files/warning.png"></td><th align="left">Warning</th></tr><tr><td align="left" valign="top"><p>Each Spring Boot release is designed and tested against a specific set of third-party dependencies. Overriding versions may cause compatibility issues.</p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-create-an-executable-jar-with-maven" href="#howto-create-an-executable-jar-with-maven"></a>73.2 Create an executable JAR with Maven</h2></div></div></div><p>The <code class="literal">spring-boot-maven-plugin</code> can be used to create an executable ‘fat’ JAR. If you are using the <code class="literal">spring-boot-starter-parent</code> POM you can simply declare the plugin and your jars will be repackaged:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><build></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><plugins></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><plugin></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.boot<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-boot-maven-plugin<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></plugin></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></plugins></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></build></span></pre><p>If you are not using the parent POM you can still use the plugin, however, you must additionally add an <code class="literal"><executions></code> section:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><build></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><plugins></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><plugin></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.boot<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-boot-maven-plugin<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><version></span>1.2.2.RELEASE<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></version></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><executions></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><execution></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><goals></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><goal></span>repackage<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></goal></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></goals></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></execution></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></executions></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></plugin></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></plugins></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></build></span></pre><p>See the <a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/maven-plugin/usage.html" target="_top">plugin documentation</a> for full usage details.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-create-an-additional-executable-jar" href="#howto-create-an-additional-executable-jar"></a>73.3 Create an additional executable JAR</h2></div></div></div><p>If you want to use your project as a library jar for other projects to depend on, and in addition have an executable (e.g. demo) version of it, you will want to configure the build in a slightly different way.</p><p>For Maven the normal JAR plugin and the Spring Boot plugin both have a ‘classifier’ configuration that you can add to create an additional JAR. Example (using the Spring Boot Starter Parent to manage the plugin versions and other configuration defaults):</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><build></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><plugins></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><plugin></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.boot<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-boot-maven-plugin<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><configuration></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><classifier></span>exec<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></classifier></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></configuration></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></plugin></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></plugins></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></build></span></pre><p>Two jars are produced, the default one, and an executable one using the Boot plugin with classifier ‘exec’.</p><p>For Gradle users the steps are similar. Example:</p><pre class="programlisting">bootRepackage { classifier = <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'exec'</span> }</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-extract-specific-libraries-when-an-executable-jar-runs" href="#howto-extract-specific-libraries-when-an-executable-jar-runs"></a>73.4 Extract specific libraries when an executable jar runs</h2></div></div></div><p>Most nested libraries in an executable jar do not need to be unpacked in order to run, however, certain libraries can have problems. For example, JRuby includes its own nested jar support which assumes that the <code class="literal">jruby-complete.jar</code> is always directly available as a file in its own right.</p><p>To deal with any problematic libraries, you can flag that specific nested jars should be automatically unpacked to the ‘temp folder’ when the executable jar first runs.</p><p>For example, to indicate that JRuby should be flagged for unpack using the Maven Plugin you would add the following configuration:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><build></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><plugins></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><plugin></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.boot<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-boot-maven-plugin<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><configuration></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><requiresUnpack></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.jruby<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>jruby-complete<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></requiresUnpack></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></configuration></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></plugin></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></plugins></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></build></span></pre><p>And to do that same with Gradle:</p><pre class="programlisting">springBoot { requiresUnpack = [<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'org.jruby:jruby-complete'</span>] }</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-create-a-nonexecutable-jar" href="#howto-create-a-nonexecutable-jar"></a>73.5 Create a non-executable JAR with exclusions</h2></div></div></div><p>Often if you have an executable and a non-executable jar as build products, the executable version will have additional configuration files that are not needed in a library jar. E.g. the <code class="literal">application.yml</code> configuration file might excluded from the non-executable JAR.</p><p>Here’s how to do that in Maven:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><build></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><plugins></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><plugin></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.boot<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-boot-maven-plugin<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><configuration></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><classifier></span>exec<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></classifier></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></configuration></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></plugin></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><plugin></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>maven-jar-plugin<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><executions></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><execution></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><id></span>exec<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></id></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><phase></span>package<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></phase></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><goals></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><goal></span>jar<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></goal></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></goals></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><configuration></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><classifier></span>exec<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></classifier></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></configuration></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></execution></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><execution></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><phase></span>package<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></phase></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><goals></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><goal></span>jar<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></goal></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></goals></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><configuration></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"><!-- Need this to ensure application.yml is excluded --></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><forceCreation></span>true<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></forceCreation></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><excludes></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><exclude></span>application.yml<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></exclude></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></excludes></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></configuration></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></execution></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></executions></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></plugin></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></plugins></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></build></span></pre><p>In Gradle you can create a new JAR archive with standard task DSL features, and then have the <code class="literal">bootRepackage</code> task depend on that one using its <code class="literal">withJarTask</code> property:</p><pre class="programlisting">jar { baseName = <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'spring-boot-sample-profile'</span> version = <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'0.0.0'</span> excludes = [<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'**/application.yml'</span>] } task(<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'execJar'</span>, type:Jar, dependsOn: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'jar'</span>) { baseName = <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'spring-boot-sample-profile'</span> version = <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'0.0.0'</span> classifier = <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'exec'</span> from sourceSets.main.output } bootRepackage { withJarTask = tasks[<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'execJar'</span>] }</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-remote-debug-maven-run" href="#howto-remote-debug-maven-run"></a>73.6 Remote debug a Spring Boot application started with Maven</h2></div></div></div><p>To attach a remote debugger to a Spring Boot application started with Maven you can use the <code class="literal">jvmArguments</code> property of the <a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/maven-plugin/" target="_top">maven plugin</a>.</p><p>Check <a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/maven-plugin/examples/run-debug.html" target="_top">this example</a> for more details.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-remote-debug-gradle-run" href="#howto-remote-debug-gradle-run"></a>73.7 Remote debug a Spring Boot application started with Gradle</h2></div></div></div><p>To attach a remote debugger to a Spring Boot application started with Gradle you can use the <code class="literal">applicationDefaultJvmArgs</code> in <code class="literal">build.gradle</code> or <code class="literal">--debug-jvm</code> command line option.</p><p><code class="literal">build.gradle</code>:</p><pre class="programlisting">applicationDefaultJvmArgs = [ <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005"</span> ]</pre><p>Command line:</p><pre class="screen">$ gradle run --debug-jvm</pre><p>Check <a class="link" href="http://www.gradle.org/docs/current/userguide/application_plugin.html" target="_top">Gradle Application Plugin</a> for more details.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-build-an-executable-archive-with-ant" href="#howto-build-an-executable-archive-with-ant"></a>73.8 Build an executable archive with Ant</h2></div></div></div><p>To build with Ant you need to grab dependencies, compile and then create a jar or war archive as normal. To make it executable:</p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">Use the appropriate launcher as a <code class="literal">Main-Class</code>, e.g. <code class="literal">JarLauncher</code> for a jar file, and specify the other properties it needs as manifest entries, principally a <code class="literal">Start-Class</code>.</li><li class="listitem">Add the runtime dependencies in a nested ‘lib’ directory (for a jar) and the <code class="literal">provided</code> (embedded container) dependencies in a nested <code class="literal">lib-provided</code> directory. Remember <span class="strong"><strong>not</strong></span> to compress the entries in the archive.</li><li class="listitem">Add the <code class="literal">spring-boot-loader</code> classes at the root of the archive (so the <code class="literal">Main-Class</code> is available).</li></ol></div><p>Example:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><target</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">name</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"build"</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">depends</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"compile"</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><copy</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">todir</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"target/classes/lib"</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><fileset</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">dir</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"lib/runtime"</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"> /></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></copy></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><jar</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">destfile</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"target/spring-boot-sample-actuator-${spring-boot.version}.jar"</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">compress</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"false"</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><fileset</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">dir</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"target/classes"</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"> /></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><fileset</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">dir</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"src/main/resources"</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"> /></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><zipfileset</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">src</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"lib/loader/spring-boot-loader-jar-${spring-boot.version}.jar"</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"> /></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><manifest></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><attribute</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">name</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"Main-Class"</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">value</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"org.springframework.boot.loader.JarLauncher"</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"> /></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><attribute</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">name</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"Start-Class"</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">value</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"${start-class}"</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"> /></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></manifest></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></jar></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></target></span></pre><p>The Actuator Sample has a <code class="literal">build.xml</code> that should work if you run it with</p><pre class="screen">$ ant -lib <path_to>/ivy-2.2.jar</pre><p>after which you can run the application with</p><pre class="screen">$ java -jar target/*.jar</pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-use-java-6" href="#howto-use-java-6"></a>73.9 How to use Java 6</h2></div></div></div><p>If you want to use Spring Boot with Java 6 there are a small number of configuration changes that you will have to make. The exact changes depend on your application’s functionality.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="howto-use-java-6-embedded-container" href="#howto-use-java-6-embedded-container"></a>73.9.1 Embedded servlet container compatibility</h3></div></div></div><p>If you are using one of Boot’s embedded Servlet containers you will have to use a Java 6-compatible container. Both Tomcat 7 and Jetty 8 are Java 6 compatible. See <a class="xref" href="#howto-use-tomcat-7" title="64.15 Use Tomcat 7">Section 64.15, “Use Tomcat 7”</a> and <a class="xref" href="#howto-use-jetty-8" title="64.16 Use Jetty 8">Section 64.16, “Use Jetty 8”</a> for details.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="how-to-use-java-6-jta-api" href="#how-to-use-java-6-jta-api"></a>73.9.2 JTA API compatibility</h3></div></div></div><p>While the Java Transaction API itself doesn’t require Java 7 the official API jar contains classes that have been built to require Java 7. If you are using JTA then you will need to replace the official JTA 1.2 API jar with one that has been built to work on Java 6. To do so, exclude any transitive dependencies on <code class="literal">javax.transaction:javax.transaction-api</code> and replace them with a dependency on <code class="literal">org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:1.0.0.Final</code></p></div></div></div><div class="chapter"><div class="titlepage"><div><div><h2 class="title"><a name="howto-traditional-deployment" href="#howto-traditional-deployment"></a>74. Traditional deployment</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-create-a-deployable-war-file" href="#howto-create-a-deployable-war-file"></a>74.1 Create a deployable war file</h2></div></div></div><p>The first step in producing a deployable war file is to provide a <code class="literal">SpringBootServletInitializer</code> subclass and override its <code class="literal">configure</code> method. This makes use of Spring Framework’s Servlet 3.0 support and allows you to configure your application when it’s launched by the servlet container. Typically, you update your application’s main class to extend <code class="literal">SpringBootServletInitializer</code>:</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@SpringBootApplication</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> Application <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">extends</span> SpringBootServletInitializer { <em><span class="hl-annotation" style="color: gray">@Override</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">protected</span> SpringApplicationBuilder configure(SpringApplicationBuilder application) { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">return</span> application.sources(Application.<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span>); } <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">static</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">void</span> main(String[] args) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">throws</span> Exception { SpringApplication.run(Application.<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span>, args); } }</pre><p>The next step is to update your build configuration so that your project produces a war file rather than a jar file. If you’re using Maven and using <code class="literal">spring-boot-starter-parent</code> (which configures Maven’s war plugin for you) all you need to do is modify <code class="literal">pom.xml</code> to change the packaging to war:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><packaging></span>war<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></packaging></span></pre><p>If you’re using Gradle, you need to modify <code class="literal">build.gradle</code> to apply the war plugin to the project:</p><pre class="programlisting">apply plugin: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'war'</span></pre><p>The final step in the process is to ensure that the embedded servlet container doesn’t interfere with the servlet container to which the war file will be deployed. To do so, you need to mark the embedded servlet container dependency as provided.</p><p>If you’re using Maven:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependencies></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"><!-- … --></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.boot<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-boot-starter-tomcat<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><scope></span>provided<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></scope></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"><!-- … --></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependencies></span></pre><p>And if you’re using Gradle:</p><pre class="programlisting">dependencies { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// …</span> providedRuntime <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'org.springframework.boot:spring-boot-starter-tomcat'</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// …</span> }</pre><p>If you’re using the <a class="link" href="#build-tool-plugins" title="Part VIII. Build tool plugins">Spring Boot build tools</a>, marking the embedded servlet container dependency as provided will produce an executable war file with the provided dependencies packaged in a <code class="literal">lib-provided</code> directory. This means that, in addition to being deployable to a servlet container, you can also run your application using <code class="literal">java -jar</code> on the command line.</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Tip" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="Spring%20Boot%20Reference%20Guide_files/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>Take a look at Spring Boot’s sample applications for a <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-samples/spring-boot-sample-traditional/pom.xml" target="_top">Maven-based example</a> of the above-described configuration.</p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-create-a-deployable-war-file-for-older-containers" href="#howto-create-a-deployable-war-file-for-older-containers"></a>74.2 Create a deployable war file for older servlet containers</h2></div></div></div><p>Older Servlet containers don’t have support for the <code class="literal">ServletContextInitializer</code> bootstrap process used in Servlet 3.0. You can still use Spring and Spring Boot in these containers but you are going to need to add a <code class="literal">web.xml</code> to your application and configure it to load an <code class="literal">ApplicationContext</code> via a <code class="literal">DispatcherServlet</code>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-convert-an-existing-application-to-spring-boot" href="#howto-convert-an-existing-application-to-spring-boot"></a>74.3 Convert an existing application to Spring Boot</h2></div></div></div><p>For a non-web application it should be easy (throw away the code that creates your <code class="literal">ApplicationContext</code> and replace it with calls to <code class="literal">SpringApplication</code> or <code class="literal">SpringApplicationBuilder</code>). Spring MVC web applications are generally amenable to first creating a deployable war application, and then migrating it later to an executable war and/or jar. Useful reading is in the <a class="link" href="http://spring.io/guides/gs/convert-jar-to-war/" target="_top">Getting Started Guide on Converting a jar to a war</a>.</p><p>Create a deployable war by extending <code class="literal">SpringBootServletInitializer</code> (e.g. in a class called <code class="literal">Application</code>), and add the Spring Boot <code class="literal">@EnableAutoConfiguration</code> annotation. Example:</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@Configuration</span></em> <em><span class="hl-annotation" style="color: gray">@EnableAutoConfiguration</span></em> <em><span class="hl-annotation" style="color: gray">@ComponentScan</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> Application <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">extends</span> SpringBootServletInitializer { <em><span class="hl-annotation" style="color: gray">@Override</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">protected</span> SpringApplicationBuilder configure(SpringApplicationBuilder application) { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// Customize the application or call application.sources(...) to add sources</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// Since our example is itself a @Configuration class we actually don't</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// need to override this method.</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">return</span> application; } }</pre><p>Remember that whatever you put in the <code class="literal">sources</code> is just a Spring <code class="literal">ApplicationContext</code> and normally anything that already works should work here. There might be some beans you can remove later and let Spring Boot provide its own defaults for them, but it should be possible to get something working first.</p><p>Static resources can be moved to <code class="literal">/public</code> (or <code class="literal">/static</code> or <code class="literal">/resources</code> or <code class="literal">/META-INF/resources</code>) in the classpath root. Same for <code class="literal">messages.properties</code> (Spring Boot detects this automatically in the root of the classpath).</p><p>Vanilla usage of Spring <code class="literal">DispatcherServlet</code> and Spring Security should require no further changes. If you have other features in your application, using other servlets or filters for instance, then you may need to add some configuration to your <code class="literal">Application</code> context, replacing those elements from the <code class="literal">web.xml</code> as follows:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">A <code class="literal">@Bean</code> of type <code class="literal">Servlet</code> or <code class="literal">ServletRegistrationBean</code> installs that bean in the container as if it was a <code class="literal"><servlet/></code> and <code class="literal"><servlet-mapping/></code> in <code class="literal">web.xml</code>.</li><li class="listitem">A <code class="literal">@Bean</code> of type <code class="literal">Filter</code> or <code class="literal">FilterRegistrationBean</code> behaves similarly (like a <code class="literal"><filter/></code> and <code class="literal"><filter-mapping/></code>.</li><li class="listitem">An <code class="literal">ApplicationContext</code> in an XML file can be added to an <code class="literal">@Import</code> in your <code class="literal">Application</code>. Or simple cases where annotation configuration is heavily used already can be recreated in a few lines as <code class="literal">@Bean</code> definitions.</li></ul></div><p>Once the war is working we make it executable by adding a <code class="literal">main</code> method to our <code class="literal">Application</code>, e.g.</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">static</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">void</span> main(String[] args) { SpringApplication.run(Application.<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span>, args); }</pre><p>Applications can fall into more than one category:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Servlet 3.0+ applications with no <code class="literal">web.xml</code>.</li><li class="listitem">Applications with a <code class="literal">web.xml</code>.</li><li class="listitem">Applications with a context hierarchy.</li><li class="listitem">Applications without a context hierarchy.</li></ul></div><p>All of these should be amenable to translation, but each might require slightly different tricks.</p><p>Servlet 3.0+ applications might translate pretty easily if they already use the Spring Servlet 3.0+ initializer support classes. Normally all the code from an existing <code class="literal">WebApplicationInitializer</code> can be moved into a <code class="literal">SpringBootServletInitializer</code>. If your existing application has more than one <code class="literal">ApplicationContext</code> (e.g. if it uses <code class="literal">AbstractDispatcherServletInitializer</code>) then you might be able to squash all your context sources into a single <code class="literal">SpringApplication</code>. The main complication you might encounter is if that doesn’t work and you need to maintain the context hierarchy. See the <a class="link" href="#howto-build-an-application-context-hierarchy" title="62.3 Build an ApplicationContext hierarchy (adding a parent or root context)">entry on building a hierarchy</a> for examples. An existing parent context that contains web-specific features will usually need to be broken up so that all the <code class="literal">ServletContextAware</code> components are in the child context.</p><p>Applications that are not already Spring applications might be convertible to a Spring Boot application, and the guidance above might help, but your mileage may vary.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-weblogic" href="#howto-weblogic"></a>74.4 Deploying a WAR to Weblogic</h2></div></div></div><p>To deploy a Spring Boot application to Weblogic you must ensure that your servlet initializer <span class="strong"><strong>directly</strong></span> implements <code class="literal">WebApplicationInitializer</code> (even if you extend from a base class that already implements it).</p><p>A typical initializer for Weblogic would be something like this:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.boot.autoconfigure.SpringBootApplication; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.boot.context.web.SpringBootServletInitializer; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">import</span> org.springframework.web.WebApplicationInitializer; <em><span class="hl-annotation" style="color: gray">@SpringBootApplication</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> MyApplication <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">extends</span> SpringBootServletInitializer <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">implements</span> WebApplicationInitializer { }</pre><p>If you use logback, you will also need to tell Weblogic to prefer the packaged version rather than the version that pre-installed with the server. You can do this by adding a <code class="literal">WEB-INF/weblogic.xml</code> file with the following contents:</p><pre class="programlisting"><span class="hl-directive" style="color: maroon"><?xml version="1.0" encoding="UTF-8"?></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><wls:weblogic-web-app</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">xmlns:wls</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"http://xmlns.oracle.com/weblogic/weblogic-web-app"</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">xmlns:xsi</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"http://www.w3.org/2001/XMLSchema-instance"</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">xsi:schemaLocation</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.4/weblogic-web-app.xsd"</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><wls:container-descriptor></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><wls:prefer-application-packages></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><wls:package-name></span>org.slf4j<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></wls:package-name></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></wls:prefer-application-packages></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></wls:container-descriptor></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></wls:weblogic-web-app></span></pre></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="howto-servlet-2-5" href="#howto-servlet-2-5"></a>74.5 Deploying a WAR in an Old (Servlet 2.5) Container</h2></div></div></div><p>Spring Boot uses Servlet 3.0 APIs to initialize the <code class="literal">ServletContext</code> (register <code class="literal">Servlets</code> etc.) so you can’t use the same application out of the box in a Servlet 2.5 container. It <span class="strong"><strong>is</strong></span> however possible to run a Spring Boot application on an older container with some special tools. If you include <code class="literal">org.springframework.boot:spring-boot-legacy</code> as a dependency (<a class="link" href="https://github.com/scratches/spring-boot-legacy" target="_top">maintained separately</a> to the core of Spring Boot and currently available at 1.0.0.RELEASE), all you should need to do is create a <code class="literal">web.xml</code> and declare a context listener to create the application context and your filters and servlets. The context listener is a special purpose one for Spring Boot, but the rest of it is normal for a Spring application in Servlet 2.5. Example:</p><pre class="programlisting"><span class="hl-directive" style="color: maroon"><?xml version="1.0" encoding="UTF-8"?></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><web-app</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">version</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"2.5"</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">xmlns</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"http://java.sun.com/xml/ns/javaee"</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">xmlns:xsi</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"http://www.w3.org/2001/XMLSchema-instance"</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">xsi:schemaLocation</span>=<span xmlns:d="http://docbook.org/ns/docbook" class="hl-value">"http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag">></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><context-param></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><param-name></span>contextConfigLocation<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></param-name></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><param-value></span>demo.Application<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></param-value></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></context-param></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><listener></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><listener-class></span>org.springframework.boot.legacy.context.web.SpringBootContextLoaderListener<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></listener-class></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></listener></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><filter></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><filter-name></span>metricFilter<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></filter-name></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><filter-class></span>org.springframework.web.filter.DelegatingFilterProxy<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></filter-class></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></filter></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><filter-mapping></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><filter-name></span>metricFilter<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></filter-name></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><url-pattern></span>/*<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></url-pattern></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></filter-mapping></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><servlet></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><servlet-name></span>appServlet<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></servlet-name></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><servlet-class></span>org.springframework.web.servlet.DispatcherServlet<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></servlet-class></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><init-param></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><param-name></span>contextAttribute<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></param-name></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><param-value></span>org.springframework.web.context.WebApplicationContext.ROOT<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></param-value></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></init-param></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><load-on-startup></span>1<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></load-on-startup></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></servlet></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><servlet-mapping></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><servlet-name></span>appServlet<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></servlet-name></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><url-pattern></span>/<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></url-pattern></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></servlet-mapping></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></web-app></span></pre><p>In this example we are using a single application context (the one created by the context listener) and attaching it to the <code class="literal">DispatcherServlet</code> using an init parameter. This is normal in a Spring Boot application (you normally only have one application context).</p></div></div></div><div class="part"><div class="titlepage"><div><div><h1 class="title"><a name="appendix" href="#appendix"></a>Part X. Appendices</h1></div></div></div><div class="appendix"><div class="titlepage"><div><div><h2 class="title"><a name="common-application-properties" href="#common-application-properties"></a>Appendix A. Common application properties</h2></div></div></div><p>Various properties can be specified inside your <code class="literal">application.properties</code>/<code class="literal">application.yml</code> file or as command line switches. This section provides a list common Spring Boot properties and references to the underlying classes that consume them.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>Property contributions can come from additional jar files on your classpath so you should not consider this an exhaustive list. It is also perfectly legit to define your own properties.</p></td></tr></tbody></table></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Warning" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="Spring%20Boot%20Reference%20Guide_files/warning.png"></td><th align="left">Warning</th></tr><tr><td align="left" valign="top"><p>This sample file is meant as a guide only. Do <span class="strong"><strong>not</strong></span> copy/paste the entire content into your application; rather pick only the properties that you need.</p></td></tr></tbody></table></div><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># ===================================================================</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># COMMON SPRING BOOT PROPERTIES</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">#</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># This sample file is provided as a guideline. Do NOT copy it in its</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># entirety to your own application. ^^^</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># ===================================================================</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># ----------------------------------------</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># CORE PROPERTIES</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># ----------------------------------------</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># SPRING CONFIG (</span><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java" target="_top">ConfigFileApplicationListener</a>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.config.name</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># config file name (default to 'application')</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.config.location</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># location of config file</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># PROFILES</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.profiles.active</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># comma list of </span><a class="link" href="#howto-set-active-spring-profiles" title="63.5 Set the active Spring profiles">active profiles</a> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.profiles.include</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># unconditionally activate the specified comma separated profiles</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># APPLICATION SETTINGS (</span><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java" target="_top">SpringApplication</a>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.main.sources</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.main.web-environment</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># detect by default</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.main.show-banner</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.main....</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># see class for all properties</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># LOGGING</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">logging.path</span>=/var/logs <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">logging.file</span>=myapp.log <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">logging.config</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># location of config file (default classpath:logback.xml for logback)</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">logging.level.*</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># levels for loggers, e.g. "logging.level.org.springframework=DEBUG" (TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF)</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># IDENTITY (</span><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot/src/main/java/org/springframework/boot/context/ContextIdApplicationContextInitializer.java" target="_top">ContextIdApplicationContextInitializer</a>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.application.name</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.application.index</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># EMBEDDED SERVER CONFIGURATION (</span><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerProperties.java" target="_top">ServerProperties</a>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.port</span>=8080 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.address</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># bind to a specific NIC</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.session-timeout</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># session timeout in seconds</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.context-parameters.*</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Servlet context init parameters, e.g. server.context-parameters.a=alpha</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.context-path</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># the context path, defaults to '/'</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.servlet-path</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># the servlet path, defaults to '/'</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.ssl.enabled</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># if SSL support is enabled</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.ssl.client-auth</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># want or need</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.ssl.key-alias</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.ssl.ciphers</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># supported SSL ciphers</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.ssl.key-password</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.ssl.key-store</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.ssl.key-store-password</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.ssl.key-store-provider</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.ssl.key-store-type</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.ssl.protocol</span>=TLS <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.ssl.trust-store</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.ssl.trust-store-password</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.ssl.trust-store-provider</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.ssl.trust-store-type</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.tomcat.access-log-pattern</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># log pattern of the access log</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.tomcat.access-log-enabled</span>=false <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># is access logging enabled</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.tomcat.compression</span>=off <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># is compression enabled (off, on, or an integer content length limit)</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.tomcat.compressableMimeTypes</span>=text/html,text/xml,text/plain <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># comma-separated list of mime types that Tomcat will compress</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.tomcat.internal-proxies</span>=10\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}|\\ 192\\.168\\.\\d{1,3}\\.\\d{1,3}|\\ 169\\.254\\.\\d{1,3}\\.\\d{1,3}|\\ 127\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3} <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># regular expression matching trusted IP addresses</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.tomcat.protocol-header</span>=x-forwarded-proto <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># front end proxy forward header</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.tomcat.port-header</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># front end proxy port header</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.tomcat.remote-ip-header</span>=x-forwarded-for <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.tomcat.basedir</span>=/tmp <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># base dir (usually not needed, defaults to tmp)</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.tomcat.background-processor-delay</span>=30; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># in seconds</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.tomcat.max-http-header-size</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># maximum size in bytes of the HTTP message header</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.tomcat.max-threads </span>= 0 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># number of threads in protocol handler</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.tomcat.uri-encoding </span>= UTF-8 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># character encoding to use for URL decoding</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># SPRING MVC (</span><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebMvcProperties.java" target="_top">WebMvcProperties</a>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.mvc.locale</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># set fixed locale, e.g. en_UK</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.mvc.date-format</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># set fixed date format, e.g. dd/MM/yyyy</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.mvc.favicon.enabled</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.mvc.message-codes-resolver-format</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># PREFIX_ERROR_CODE / POSTFIX_ERROR_CODE</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.mvc.ignore-default-model-on-redirect</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># If the the content of the "default" model should be ignored redirects</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.view.prefix</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># MVC view prefix</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.view.suffix</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># ... and suffix</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># SPRING RESOURCES HANDLING (</span><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ResourceProperties.java" target="_top">ResourceProperties</a>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.resources.cache-period</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># cache timeouts in headers sent to browser</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.resources.add-mappings</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># if default mappings should be added</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># SPRING HATEOAS (</span><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/hateoas/HateoasProperties.java" target="_top">HateoasProperties</a>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.hateoas.apply-to-primary-object-mapper</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># if the primary mapper should also be configured</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># HTTP encoding (</span><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/HttpEncodingProperties.java" target="_top">HttpEncodingProperties</a>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.http.encoding.charset</span>=UTF-8 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># the encoding of HTTP requests/responses</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.http.encoding.enabled</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># enable http encoding support</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.http.encoding.force</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># force the configured encoding</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># HTTP message conversion</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.http.converters.preferred-json-mapper</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># the preferred JSON mapper to use for HTTP message conversion. Set to "gson" to force the use of Gson when both it and Jackson are on the classpath.</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># HTTP response compression ({sc-spring-boot-autoconfigure/web/GzipFilterProperties.java[GzipFilterProperties])</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.http.gzip.bufferSize</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># size of the output buffer in bytes</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.http.gzip.minGzipSize</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># minimum content length required for compression to occur</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.http.gzip.deflateCompressionLevel</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># the level used for deflate compression (0-9)</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.http.gzip.deflateNoWrap</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># noWrap setting for deflate compression (true or false)</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.http.gzip.methods</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># comma-separated list of HTTP methods for which compression is enabled</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.http.gzip.mimeTypes</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># comma-separated list of MIME types which should be compressed</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.http.gzip.excludedAgents</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># comma-separated list of user agents to exclude from compression</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.http.gzip.excludedAgentPatterns</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># comma-separated list of regular expression patterns to control user agents excluded from compression</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.http.gzip.excludedPaths</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># comma-separated list of paths to exclude from compression</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.http.gzip.excludedPathPatterns</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># comma-separated list of regular expression patterns to control the paths that are excluded from compression</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.http.gzip.vary</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Vary header to be sent on responses that may be compressed</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># JACKSON (</span><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jackson/JacksonProperties.java" target="_top">JacksonProperties</a>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jackson.date-format</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Date format string (e.g. yyyy-MM-dd HH:mm:ss), or a fully-qualified date format class name (e.g. com.fasterxml.jackson.databind.util.ISO8601DateFormat)</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jackson.property-naming-strategy</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># One of the constants on Jackson's PropertyNamingStrategy (e.g. CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES) or the fully-qualified class name of a PropertyNamingStrategy subclass</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jackson.deserialization.*</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># see Jackson's DeserializationFeature</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jackson.generator.*</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># see Jackson's JsonGenerator.Feature</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jackson.mapper.*</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># see Jackson's MapperFeature</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jackson.parser.*</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># see Jackson's JsonParser.Feature</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jackson.serialization.*</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># see Jackson's SerializationFeature</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># THYMELEAF (</span><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java" target="_top">ThymeleafAutoConfiguration</a>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.thymeleaf.check-template-location</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.thymeleaf.prefix</span>=classpath:/templates/ <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.thymeleaf.excluded-view-names</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># comma-separated list of view names that should be excluded from resolution</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.thymeleaf.view-names</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># comma-separated list of view names that can be resolved</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.thymeleaf.suffix</span>=.html <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.thymeleaf.mode</span>=HTML5 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.thymeleaf.encoding</span>=UTF-8 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.thymeleaf.content-type</span>=text/html <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># ;charset=<encoding> is added</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.thymeleaf.cache</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># set to false for hot refresh</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># FREEMARKER (</span><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfiguration.java" target="_top">FreeMarkerAutoConfiguration</a>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.freemarker.allow-request-override</span>=false <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.freemarker.cache</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.freemarker.check-template-location</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.freemarker.charset</span>=UTF-8 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.freemarker.content-type</span>=text/html <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.freemarker.expose-request-attributes</span>=false <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.freemarker.expose-session-attributes</span>=false <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.freemarker.expose-spring-macro-helpers</span>=false <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.freemarker.prefix</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.freemarker.request-context-attribute</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.freemarker.settings.*</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.freemarker.suffix</span>=.ftl <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.freemarker.template-loader-path</span>=classpath:/templates/ <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># comma-separated list</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.freemarker.view-names</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># whitelist of view names that can be resolved</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># GROOVY TEMPLATES (</span><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAutoConfiguration.java" target="_top">GroovyTemplateAutoConfiguration</a>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.groovy.template.cache</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.groovy.template.charset</span>=UTF-8 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.groovy.template.configuration.*</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># See Groovy's TemplateConfiguration</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.groovy.template.content-type</span>=text/html <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.groovy.template.prefix</span>=classpath:/templates/ <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.groovy.template.suffix</span>=.tpl <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.groovy.template.view-names</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># whitelist of view names that can be resolved</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># VELOCITY TEMPLATES (</span><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/velocity/VelocityAutoConfiguration.java" target="_top">VelocityAutoConfiguration</a>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.velocity.allow-request-override</span>=false <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.velocity.cache</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.velocity.check-template-location</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.velocity.charset</span>=UTF-8 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.velocity.content-type</span>=text/html <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.velocity.date-tool-attribute</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.velocity.expose-request-attributes</span>=false <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.velocity.expose-session-attributes</span>=false <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.velocity.expose-spring-macro-helpers</span>=false <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.velocity.number-tool-attribute</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.velocity.prefer-file-system-access</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># prefer file system access for template loading</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.velocity.prefix</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.velocity.properties.*</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.velocity.request-context-attribute</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.velocity.resource-loader-path</span>=classpath:/templates/ <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.velocity.suffix</span>=.vm <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.velocity.toolbox-config-location</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># velocity Toolbox config location, for example "/WEB-INF/toolbox.xml"</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.velocity.view-names</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># whitelist of view names that can be resolved</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># JERSEY (</span><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure%7D/jersey/JerseyProperties.java" target="_top">JerseyProperties</a>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jersey.type</span>=servlet <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># servlet or filter</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jersey.init</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># init params</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jersey.filter.order</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># INTERNATIONALIZATION (</span><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/MessageSourceAutoConfiguration.java" target="_top">MessageSourceAutoConfiguration</a>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.messages.basename</span>=messages <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.messages.cache-seconds</span>=-1 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.messages.encoding</span>=UTF-8 <a name="common-application-properties-security" href="#common-application-properties-security"></a> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># SECURITY (</span><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityProperties.java" target="_top">SecurityProperties</a>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">security.user.name</span>=user <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># login username</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">security.user.password</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># login password</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">security.user.role</span>=USER <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># role assigned to the user</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">security.require-ssl</span>=false <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># advanced settings ...</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">security.enable-csrf</span>=false <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">security.basic.enabled</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">security.basic.realm</span>=Spring <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">security.basic.path</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># /**</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">security.basic.authorize-mode</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># ROLE, AUTHENTICATED, NONE</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">security.filter-order</span>=0 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">security.headers.xss</span>=false <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">security.headers.cache</span>=false <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">security.headers.frame</span>=false <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">security.headers.content-type</span>=false <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">security.headers.hsts</span>=all <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># none / domain / all</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">security.sessions</span>=stateless <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># always / never / if_required / stateless</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">security.ignored</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Comma-separated list of paths to exclude from the default secured paths</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># DATASOURCE (</span><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java" target="_top">DataSourceAutoConfiguration</a> & <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceProperties.java" target="_top">DataSourceProperties</a>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.datasource.name</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># name of the data source</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.datasource.initialize</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># populate using data.sql</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.datasource.schema</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># a schema (DDL) script resource reference</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.datasource.data</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># a data (DML) script resource reference</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.datasource.sql-script-encoding</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># a charset for reading SQL scripts</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.datasource.platform</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># the platform to use in the schema resource (schema-${platform}.sql)</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.datasource.continue-on-error</span>=false <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># continue even if can't be initialized</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.datasource.separator</span>=; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># statement separator in SQL initialization scripts</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.datasource.driver-class-name</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># JDBC Settings...</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.datasource.url</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.datasource.username</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.datasource.password</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.datasource.jndi-name</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># For JNDI lookup (class, url, username & password are ignored when set)</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.datasource.max-active</span>=100 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Advanced configuration...</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.datasource.max-idle</span>=8 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.datasource.min-idle</span>=8 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.datasource.initial-size</span>=10 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.datasource.validation-query</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.datasource.test-on-borrow</span>=false <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.datasource.test-on-return</span>=false <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.datasource.test-while-idle</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.datasource.time-between-eviction-runs-millis</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.datasource.min-evictable-idle-time-millis</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.datasource.max-wait</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.datasource.jmx-enabled</span>=false <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Export JMX MBeans (if supported)</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># DAO (</span><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/dao/PersistenceExceptionTranslationAutoConfiguration.java" target="_top">PersistenceExceptionTranslationAutoConfiguration</a>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.dao.exceptiontranslation.enabled</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># MONGODB (</span><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoProperties.java" target="_top">MongoProperties</a>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.data.mongodb.host</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># the db host</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.data.mongodb.port</span>=27017 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># the connection port (defaults to 27107)</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.data.mongodb.uri</span>=mongodb://localhost/test <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># connection URL</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.data.mongodb.database</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.data.mongodb.authentication-database</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.data.mongodb.grid-fs-database</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.data.mongodb.username</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.data.mongodb.password</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.data.mongodb.repositories.enabled</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># if spring data repository support is enabled</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># JPA (</span><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaBaseConfiguration.java" target="_top">JpaBaseConfiguration</a>, <a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.java" target="_top">HibernateJpaAutoConfiguration</a>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jpa.properties.*</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># properties to set on the JPA connection</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jpa.open-in-view</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jpa.show-sql</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jpa.database-platform</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jpa.database</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jpa.generate-ddl</span>=false <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># ignored by Hibernate, might be useful for other vendors</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jpa.hibernate.naming-strategy</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># naming classname</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jpa.hibernate.ddl-auto</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># defaults to create-drop for embedded dbs</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.data.jpa.repositories.enabled</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># if spring data repository support is enabled</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># JTA (</span><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jta/JtaAutoConfiguration.java" target="_top">JtaAutoConfiguration</a>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.log-dir</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># transaction log dir</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.*</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># technology specific configuration</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># ATOMIKOS</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.atomikos.connectionfactory.borrow-connection-timeout</span>=30 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Timeout, in seconds, for borrowing connections from the pool</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.atomikos.connectionfactory.ignore-session-transacted-flag</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Whether or not to ignore the transacted flag when creating session</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.atomikos.connectionfactory.local-transaction-mode</span>=false <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Whether or not local transactions are desired</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.atomikos.connectionfactory.maintenance-interval</span>=60 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># The time, in seconds, between runs of the pool's maintenance thread</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.atomikos.connectionfactory.max-idle-time</span>=60 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># The time, in seconds, after which connections are cleaned up from the pool</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.atomikos.connectionfactory.max-lifetime</span>=0 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># The time, in seconds, that a connection can be pooled for before being destroyed. 0 denotes no limit.</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.atomikos.connectionfactory.max-pool-size</span>=1 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># The maximum size of the pool</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.atomikos.connectionfactory.min-pool-size</span>=1 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># The minimum size of the pool</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.atomikos.connectionfactory.reap-timeout</span>=0 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># The reap timeout, in seconds, for borrowed connections. 0 denotes no limit.</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.atomikos.connectionfactory.unique-resource-name</span>=jmsConnectionFactory <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># The unique name used to identify the resource during recovery</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.atomikos.datasource.borrow-connection-timeout</span>=30 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Timeout, in seconds, for borrowing connections from the pool</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.atomikos.datasource.default-isolation-level</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Default isolation level of connections provided by the pool</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.atomikos.datasource.login-timeout</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Timeout, in seconds, for establishing a database connection</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.atomikos.datasource.maintenance-interval</span>=60 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># The time, in seconds, between runs of the pool's maintenance thread</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.atomikos.datasource.max-idle-time</span>=60 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># The time, in seconds, after which connections are cleaned up from the pool</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.atomikos.datasource.max-lifetime</span>=0 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># The time, in seconds, that a connection can be pooled for before being destroyed. 0 denotes no limit.</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.atomikos.datasource.max-pool-size</span>=1 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># The maximum size of the pool</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.atomikos.datasource.min-pool-size</span>=1 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># The minimum size of the pool</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.atomikos.datasource.reap-timeout</span>=0 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># The reap timeout, in seconds, for borrowed connections. 0 denotes no limit.</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.atomikos.datasource.test-query</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># SQL query or statement used to validate a connection before returning it</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.atomikos.datasource.unique-resource-name</span>=dataSource <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># The unique name used to identify the resource during recovery</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># BITRONIX</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.bitronix.connectionfactory.acquire-increment</span>=1 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Number of connections to create when growing the pool</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.bitronix.connectionfactory.acquisition-interval</span>=1 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Time, in seconds, to wait before trying to acquire a connection again after an invalid connection was acquired</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.bitronix.connectionfactory.acquisition-timeout</span>=30 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Timeout, in seconds, for acquiring connections from the pool</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.bitronix.connectionfactory.allow-local-transactions</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Whether or not the transaction manager should allow mixing XA and non-XA transactions</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.bitronix.connectionfactory.apply-transaction-timeout</span>=false <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Whether or not the transaction timeout should be set on the XAResource when it is enlisted</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.bitronix.connectionfactory.automatic-enlisting-enabled</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Whether or not resources should be enlisted and delisted automatically</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.bitronix.connectionfactory.cache-producers-consumers</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Whether or not produces and consumers should be cached</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.bitronix.connectionfactory.defer-connection-release</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Whether or not the provider can run many transactions on the same connection and supports transaction interleaving</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.bitronix.connectionfactory.ignore-recovery-failures</span>=false <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Whether or not recovery failures should be ignored</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.bitronix.connectionfactory.max-idle-time</span>=60 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># The time, in seconds, after which connections are cleaned up from the pool</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.bitronix.connectionfactory.max-pool-size</span>=10 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># The maximum size of the pool. 0 denotes no limit</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.bitronix.connectionfactory.min-pool-size</span>=0 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># The minimum size of the pool</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.bitronix.connectionfactory.password</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># The password to use to connect to the JMS provider</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.bitronix.connectionfactory.share-transaction-connections</span>=false <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Whether or not connections in the ACCESSIBLE state can be shared within the context of a transaction</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.bitronix.connectionfactory.test-connections</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Whether or not connections should be tested when acquired from the pool</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.bitronix.connectionfactory.two-pc-ordering-position</span>=1 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># The postion that this resource should take during two-phase commit (always first is Integer.MIN_VALUE, always last is Integer.MAX_VALUE)</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.bitronix.connectionfactory.unique-name</span>=jmsConnectionFactory <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># The unique name used to identify the resource during recovery</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.bitronix.connectionfactory.use-tm-join</span>=true Whether or not TMJOIN should be used when starting XAResources <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.bitronix.connectionfactory.user</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># The user to use to connect to the JMS provider</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.bitronix.datasource.acquire-increment</span>=1 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Number of connections to create when growing the pool</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.bitronix.datasource.acquisition-interval</span>=1 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Time, in seconds, to wait before trying to acquire a connection again after an invalid connection was acquired</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.bitronix.datasource.acquisition-timeout</span>=30 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Timeout, in seconds, for acquiring connections from the pool</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.bitronix.datasource.allow-local-transactions</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Whether or not the transaction manager should allow mixing XA and non-XA transactions</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.bitronix.datasource.apply-transaction-timeout</span>=false <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Whether or not the transaction timeout should be set on the XAResource when it is enlisted</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.bitronix.datasource.automatic-enlisting-enabled</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Whether or not resources should be enlisted and delisted automatically</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.bitronix.datasource.cursor-holdability</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># The default cursor holdability for connections</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.bitronix.datasource.defer-connection-release</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Whether or not the database can run many transactions on the same connection and supports transaction interleaving</span> spring.jta.bitronix.datasource.enable-jdbc4-connection-test <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Whether or not Connection.isValid() is called when acquiring a connection from the pool</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.bitronix.datasource.ignore-recovery-failures</span>=false <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Whether or not recovery failures should be ignored</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.bitronix.datasource.isolation-level</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># The default isolation level for connections</span> spring.jta.bitronix.datasource.local-auto-commit <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># The default auto-commit mode for local transactions</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.bitronix.datasource.login-timeout</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Timeout, in seconds, for establishing a database connection</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.bitronix.datasource.max-idle-time</span>=60 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># The time, in seconds, after which connections are cleaned up from the pool</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.bitronix.datasource.max-pool-size</span>=10 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># The maximum size of the pool. 0 denotes no limit</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.bitronix.datasource.min-pool-size</span>=0 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># The minimum size of the pool</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.bitronix.datasource.prepared-statement-cache-size</span>=0 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># The target size of the prepared statement cache. 0 disables the cache</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.bitronix.datasource.share-transaction-connections</span>=false <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Whether or not connections in the ACCESSIBLE state can be shared within the context of a transaction</span> spring.jta.bitronix.datasource.test-query <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># SQL query or statement used to validate a connection before returning it</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.bitronix.datasource.two-pc-ordering-position</span>=1 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># The postion that this resource should take during two-phase commit (always first is Integer.MIN_VALUE, always last is Integer.MAX_VALUE)</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.bitronix.datasource.unique-name</span>=dataSource <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># The unique name used to identify the resource during recovery</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jta.bitronix.datasource.use-tm-join</span>=true Whether or not TMJOIN should be used when starting XAResources <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># SOLR (</span><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/solr/SolrProperties.java" target="_top">SolrProperties</a>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.data.solr.host</span>=http://127.0.0.1:8983/solr <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.data.solr.zk-host</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.data.solr.repositories.enabled</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># if spring data repository support is enabled</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># ELASTICSEARCH (</span><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/ElasticsearchProperties.java" target="_top">ElasticsearchProperties</a>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.data.elasticsearch.cluster-name</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># The cluster name (defaults to elasticsearch)</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.data.elasticsearch.cluster-nodes</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># The address(es) of the server node (comma-separated; if not specified starts a client node)</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.data.elasticsearch.repositories.enabled</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># if spring data repository support is enabled</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># DATA REST (</span><a class="link" href="http://docs.spring.io/spring-data/rest/docs/current/api/org/springframework/data/rest/core/config/RepositoryRestConfiguration.html" target="_top">RepositoryRestConfiguration</a>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.data.rest.base-uri</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># base URI against which the exporter should calculate its links</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># FLYWAY (</span><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayProperties.java" target="_top">FlywayProperties</a>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">flyway.check-location</span>=false <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># check that migration scripts location exists</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">flyway.locations</span>=classpath:db/migration <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># locations of migrations scripts</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">flyway.schemas</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># schemas to update</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">flyway.init-version</span>= 1 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># version to start migration</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">flyway.init-sqls</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># SQL statements to execute to initialize a connection immediately after obtaining it</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">flyway.sql-migration-prefix</span>=V <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">flyway.sql-migration-suffix</span>=.sql <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">flyway.enabled</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">flyway.url</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># JDBC url if you want Flyway to create its own DataSource</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">flyway.user</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># JDBC username if you want Flyway to create its own DataSource</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">flyway.password</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># JDBC password if you want Flyway to create its own DataSource</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># LIQUIBASE (</span><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseProperties.java" target="_top">LiquibaseProperties</a>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">liquibase.change-log</span>=classpath:/db/changelog/db.changelog-master.yaml <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">liquibase.check-change-log-location</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># check the change log location exists</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">liquibase.contexts</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># runtime contexts to use</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">liquibase.default-schema</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># default database schema to use</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">liquibase.drop-first</span>=false <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">liquibase.enabled</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">liquibase.url</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># specific JDBC url (if not set the default datasource is used)</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">liquibase.user</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># user name for liquibase.url</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">liquibase.password</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># password for liquibase.url</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># JMX</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jmx.enabled</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Expose MBeans from Spring</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># RABBIT (</span><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java" target="_top">RabbitProperties</a>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.rabbitmq.host</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># connection host</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.rabbitmq.port</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># connection port</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.rabbitmq.addresses</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># connection addresses (e.g. myhost:9999,otherhost:1111)</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.rabbitmq.username</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># login user</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.rabbitmq.password</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># login password</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.rabbitmq.virtual-host</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.rabbitmq.dynamic</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># REDIS (</span><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/redis/RedisProperties.java" target="_top">RedisProperties</a>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.redis.database</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># database name</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.redis.host</span>=localhost <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># server host</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.redis.password</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># server password</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.redis.port</span>=6379 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># connection port</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.redis.pool.max-idle</span>=8 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># pool settings ...</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.redis.pool.min-idle</span>=0 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.redis.pool.max-active</span>=8 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.redis.pool.max-wait</span>=-1 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.redis.sentinel.master</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># name of Redis server</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.redis.sentinel.nodes</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># comma-separated list of host:port pairs</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># ACTIVEMQ (</span><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQProperties.java" target="_top">ActiveMQProperties</a>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.activemq.broker-url</span>=tcp://localhost:61616 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># connection URL</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.activemq.user</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.activemq.password</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.activemq.in-memory</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># broker kind to create if no broker-url is specified</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.activemq.pooled</span>=false <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># HornetQ (</span><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/hornetq/HornetQProperties.java" target="_top">HornetQProperties</a>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.hornetq.mode</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># connection mode (native, embedded)</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.hornetq.host</span>=localhost <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># hornetQ host (native mode)</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.hornetq.port</span>=5445 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># hornetQ port (native mode)</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.hornetq.embedded.enabled</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># if the embedded server is enabled (needs hornetq-jms-server.jar)</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.hornetq.embedded.server-id</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># auto-generated id of the embedded server (integer)</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.hornetq.embedded.persistent</span>=false <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># message persistence</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.hornetq.embedded.data-directory</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># location of data content (when persistence is enabled)</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.hornetq.embedded.queues</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># comma-separated queues to create on startup</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.hornetq.embedded.topics</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># comma-separated topics to create on startup</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.hornetq.embedded.cluster-password</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># customer password (randomly generated by default)</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># JMS (</span><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JmsProperties.java" target="_top">JmsProperties</a>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jms.jndi-name</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># JNDI location of a JMS ConnectionFactory</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.jms.pub-sub-domain</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># false for queue (default), true for topic</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Email (</span><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mail/MailProperties.java" target="_top">MailProperties</a>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.mail.host</span>=smtp.acme.org <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># mail server host</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.mail.port</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># mail server port</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.mail.username</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.mail.password</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.mail.default-encoding</span>=UTF-8 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># encoding to use for MimeMessages</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.mail.properties.*</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># properties to set on the JavaMail session</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># SPRING BATCH (</span><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/BatchDatabaseInitializer.java" target="_top">BatchDatabaseInitializer</a>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.batch.job.names</span>=job1,job2 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.batch.job.enabled</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.batch.initializer.enabled</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.batch.schema</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># batch schema to load</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># AOP</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.aop.auto</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.aop.proxy-target-class</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># FILE ENCODING (</span><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot/src/main/java/org/springframework/boot/context/FileEncodingApplicationListener.java" target="_top">FileEncodingApplicationListener</a>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.mandatory-file-encoding</span>=false <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># SPRING SOCIAL (</span><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/social/SocialWebAutoConfiguration.java" target="_top">SocialWebAutoConfiguration</a>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.social.auto-connection-views</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Set to true for default connection views or false if you provide your own</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># SPRING SOCIAL FACEBOOK (</span><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/social/FacebookAutoConfiguration.java" target="_top">FacebookAutoConfiguration</a>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.social.facebook.app-id</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># your application's Facebook App ID</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.social.facebook.app-secret</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># your application's Facebook App Secret</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># SPRING SOCIAL LINKEDIN (</span><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/social/LinkedInAutoConfiguration.java" target="_top">LinkedInAutoConfiguration</a>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.social.linkedin.app-id</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># your application's LinkedIn App ID</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.social.linkedin.app-secret</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># your application's LinkedIn App Secret</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># SPRING SOCIAL TWITTER (</span><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/social/TwitterAutoConfiguration.java" target="_top">TwitterAutoConfiguration</a>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.social.twitter.app-id</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># your application's Twitter App ID</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.social.twitter.app-secret</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># your application's Twitter App Secret</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># SPRING MOBILE SITE PREFERENCE (</span><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/SitePreferenceAutoConfiguration.java" target="_top">SitePreferenceAutoConfiguration</a>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.mobile.sitepreference.enabled</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># enabled by default</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># SPRING MOBILE DEVICE VIEWS (</span><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/DeviceDelegatingViewResolverAutoConfiguration.java" target="_top">DeviceDelegatingViewResolverAutoConfiguration</a>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.mobile.devicedelegatingviewresolver.enabled</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># disabled by default</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.mobile.devicedelegatingviewresolver.normal-prefix</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.mobile.devicedelegatingviewresolver.normal-suffix</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.mobile.devicedelegatingviewresolver.mobile-prefix</span>=mobile/ <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.mobile.devicedelegatingviewresolver.mobile-suffix</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.mobile.devicedelegatingviewresolver.tablet-prefix</span>=tablet/ <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.mobile.devicedelegatingviewresolver.tablet-suffix</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># ----------------------------------------</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># ACTUATOR PROPERTIES</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># ----------------------------------------</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># MANAGEMENT HTTP SERVER (</span><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementServerProperties.java" target="_top">ManagementServerProperties</a>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">management.port</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># defaults to 'server.port'</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">management.address</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># bind to a specific NIC</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">management.context-path</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># default to '/'</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">management.add-application-context-header</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># default to true</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">management.security.enabled</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># enable security</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">management.security.role</span>=ADMIN <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># role required to access the management endpoint</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">management.security.sessions</span>=stateless <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># session creating policy to use (always, never, if_required, stateless)</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># PID FILE (</span><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/system/ApplicationPidFileWriter.java" target="_top">ApplicationPidFileWriter</a>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.pidfile</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># Location of the PID file to write</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># ENDPOINTS (</span><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/AbstractEndpoint.java" target="_top">AbstractEndpoint</a> subclasses) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.autoconfig.id</span>=autoconfig <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.autoconfig.sensitive</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.autoconfig.enabled</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.beans.id</span>=beans <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.beans.sensitive</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.beans.enabled</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.configprops.id</span>=configprops <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.configprops.sensitive</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.configprops.enabled</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.configprops.keys-to-sanitize</span>=password,secret,key <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># suffix or regex</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.dump.id</span>=dump <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.dump.sensitive</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.dump.enabled</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.env.id</span>=env <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.env.sensitive</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.env.enabled</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.env.keys-to-sanitize</span>=password,secret,key <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># suffix or regex</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.health.id</span>=health <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.health.sensitive</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.health.enabled</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.health.mapping.*</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># mapping of health statuses to HttpStatus codes</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.health.time-to-live</span>=1000 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.info.id</span>=info <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.info.sensitive</span>=false <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.info.enabled</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.mappings.enabled</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.mappings.id</span>=mappings <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.mappings.sensitive</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.metrics.id</span>=metrics <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.metrics.sensitive</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.metrics.enabled</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.shutdown.id</span>=shutdown <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.shutdown.sensitive</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.shutdown.enabled</span>=false <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.trace.id</span>=trace <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.trace.sensitive</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.trace.enabled</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># HEALTH INDICATORS (previously health.*)</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">management.health.db.enabled</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">management.health.diskspace.enabled</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">management.health.mongo.enabled</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">management.health.rabbit.enabled</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">management.health.redis.enabled</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">management.health.solr.enabled</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">management.health.diskspace.path</span>=. <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">management.health.diskspace.threshold</span>=10485760 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">management.health.status.order</span>=DOWN, OUT_OF_SERVICE, UNKNOWN, UP <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># MVC ONLY ENDPOINTS</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.jolokia.path</span>=jolokia <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.jolokia.sensitive</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.jolokia.enabled</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># when using Jolokia</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># JMX ENDPOINT (</span><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointMBeanExportProperties.java" target="_top">EndpointMBeanExportProperties</a>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.jmx.enabled</span>=true <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.jmx.domain</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># the JMX domain, defaults to 'org.springboot'</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.jmx.unique-names</span>=false <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">endpoints.jmx.static-names</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># JOLOKIA (</span><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/JolokiaProperties.java" target="_top">JolokiaProperties</a>) <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">jolokia.config.*</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># See Jolokia manual</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># REMOTE SHELL</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">shell.auth</span>=simple <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># jaas, key, simple, spring</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">shell.command-refresh-interval</span>=-1 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">shell.command-path-patterns</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># classpath*:/commands/**, classpath*:/crash/commands/**</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">shell.config-path-patterns</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># classpath*:/crash/*</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">shell.disabled-commands</span>=jpa*,jdbc*,jndi* <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># comma-separated list of commands to disable</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">shell.disabled-plugins</span>=false <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># don't expose plugins</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">shell.ssh.enabled</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># ssh settings ...</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">shell.ssh.key-path</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">shell.ssh.port</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">shell.telnet.enabled</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># telnet settings ...</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">shell.telnet.port</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">shell.auth.jaas.domain</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># authentication settings ...</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">shell.auth.key.path</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">shell.auth.simple.user.name</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">shell.auth.simple.user.password</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">shell.auth.spring.roles</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># GIT INFO</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring.git.properties</span>= <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment"># resource ref to generated git info properties file</span></pre></div><div class="appendix"><div class="titlepage"><div><div><h2 class="title"><a name="configuration-metadata" href="#configuration-metadata"></a>Appendix B. Configuration meta-data</h2></div></div></div><p>Spring Boot jars are shipped with meta-data files that provide details of all supported configuration properties. The files are designed to allow IDE developers to offer contextual help and “code completion” as users are working with <code class="literal">application.properties</code> or <code class="literal">application.yml</code> files.</p><p>The majority of the meta-data file is generated automatically at compile time by processing all items annotated with <code class="literal">@ConfigurationProperties</code>.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="configuration-metadata-format" href="#configuration-metadata-format"></a>B.1 Meta-data format</h2></div></div></div><p>Configuration meta-data files are located inside jars under <code class="literal">META-INF/spring-configuration-metadata.json</code> They use a simple JSON format with items categorized under either “groups” or “properties”:</p><pre class="programlisting">{<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"groups"</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">[</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">{</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"name"</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"server"</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"type"</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"org.springframework.boot.autoconfigure.web.ServerProperties"</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"sourceType"</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"org.springframework.boot.autoconfigure.web.ServerProperties"</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">}</span> ... ],<span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"properties"</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">[</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">{</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"name"</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"server.port"</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"type"</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"java.lang.Integer"</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"sourceType"</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"org.springframework.boot.autoconfigure.web.ServerProperties"</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">},</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">{</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"name"</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"server.servlet-path"</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"type"</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"java.lang.String"</span><span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"sourceType"</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"org.springframework.boot.autoconfigure.web.ServerProperties"</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"defaultValue"</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"/"</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">}</span> ... ]<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">}</span></pre><p>Each “property” is a configuration item that the user specifies with a given value. For example <code class="literal">server.port</code> and <code class="literal">server.servlet-path</code> might be specified in <code class="literal">application.properties</code> as follows:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.port</span>=9090 <span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">server.servlet-path</span>=/home</pre><p>The “groups” are higher level items that don’t themselves specify a value, but instead provide a contextual grouping for properties. For example the <code class="literal">server.port</code> and <code class="literal">server.servlet-path</code> properties are part of the <code class="literal">server</code> group.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>It is not required that every “property” has a “group”, some properties might just exist in their own right.</p></td></tr></tbody></table></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="configuration-metadata-group-attributes" href="#configuration-metadata-group-attributes"></a>B.1.1 Group Attributes</h3></div></div></div><p>The JSON object contained in the <code class="literal">groups</code> array can contain the following attributes:</p><div class="informaltable"><table style="border-collapse: collapse;border-top: 0.5pt solid ; border-bottom: 0.5pt solid ; border-left: 0.5pt solid ; border-right: 0.5pt solid ; "><colgroup><col class="col_1"><col class="col_2"><col class="col_3"></colgroup><thead><tr><th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top">Name</th><th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top">Type</th><th style="border-bottom: 0.5pt solid ; " align="left" valign="top">Purpose</th></tr></thead><tbody><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">name</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>String</p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>The full name of the group. This attribute is mandatory.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">type</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>String</p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>The class name of the data type of the group. For example, if the group was based on a class annotated with <code class="literal">@ConfigurationProperties</code> the attribute would contain the fully qualified name of that class. If it was based on a <code class="literal">@Bean</code> method, it would be the return type of that method. The attribute may be omitted if the type is not known.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">description</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>String</p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>A short description of the group that can be displayed to users. May be omitted if no description is available. It is recommended that descriptions are a short paragraphs, with the first line providing a concise summary. The last line in the description should end with a period (<code class="literal">.</code>).</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">sourceType</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>String</p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>The class name of the source that contributed this group. For example, if the group was based on a <code class="literal">@Bean</code> method annotated with <code class="literal">@ConfigurationProperties</code> this attribute would contain the fully qualified name of the <code class="literal">@Configuration</code> class containing the method. The attribute may be omitted if the source type is not known.</p></td></tr><tr><td style="border-right: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">sourceMethod</code></p></td><td style="border-right: 0.5pt solid ; " align="left" valign="top"><p>String</p></td><td style="" align="left" valign="top"><p>The full name of the method (include parenthesis and argument types) that contributed this group. For example, the name of a <code class="literal">@ConfigurationProperties</code> annotated <code class="literal">@Bean</code> method. May be omitted if the source method is not known.</p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="configuration-metadata-property-attributes" href="#configuration-metadata-property-attributes"></a>B.1.2 Property Attributes</h3></div></div></div><p>The JSON object contained in the <code class="literal">properties</code> array can contain the following attributes:</p><div class="informaltable"><table style="border-collapse: collapse;border-top: 0.5pt solid ; border-bottom: 0.5pt solid ; border-left: 0.5pt solid ; border-right: 0.5pt solid ; "><colgroup><col class="col_1"><col class="col_2"><col class="col_3"></colgroup><thead><tr><th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top">Name</th><th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top">Type</th><th style="border-bottom: 0.5pt solid ; " align="left" valign="top">Purpose</th></tr></thead><tbody><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">name</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>String</p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>The full name of the property. Names are in lowercase dashed form (e.g. <code class="literal">server.servlet-path</code>). This attribute is mandatory.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">type</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>String</p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>The class name of the data type of the property. For example, <code class="literal">java.lang.String</code>. This attribute can be used to guide the user as to the types of values that they can enter. For consistency, the type of a primitive is specified using its wrapper counterpart, i.e. <code class="literal">boolean</code> becomes <code class="literal">java.lang.Boolean</code>. Note that this class may be a complex type that gets converted from a String as values are bound. May be omitted if the type is not known.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">description</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>String</p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>A short description of the group that can be displayed to users. May be omitted if no description is available. It is recommended that descriptions are a short paragraphs, with the first line providing a concise summary. The last line in the description should end with a period (<code class="literal">.</code>).</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">sourceType</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>String</p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>The class name of the source that contributed this property. For example, if the property was from a class annotated with <code class="literal">@ConfigurationProperties</code> this attribute would contain the fully qualified name of that class. May be omitted if the source type is not known.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">defaultValue</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Object</p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>The default value which will be used if the property is not specified. Can also be an array of value(s) if the type of the property is an array. May be omitted if the default value is not known.</p></td></tr><tr><td style="border-right: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">deprecated</code></p></td><td style="border-right: 0.5pt solid ; " align="left" valign="top"><p>boolean</p></td><td style="" align="left" valign="top"><p>Specify if the property is deprecated. May be omitted if the field is not deprecated or if that information is not known.</p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="configuration-metadata-repeated-items" href="#configuration-metadata-repeated-items"></a>B.1.3 Repeated meta-data items</h3></div></div></div><p>It is perfectly acceptable for “property” and “group” objects with the same name to appear multiple times within a meta-data file. For example, Spring Boot binds <code class="literal">spring.datasource</code> properties to Hikari, Tomcat and DBCP classes, with each potentially offering overlap of property names. Consumers of meta-data should take care to ensure that they support such scenarios.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="configuration-metadata-annotation-processor" href="#configuration-metadata-annotation-processor"></a>B.2 Generating your own meta-data using the annotation processor</h2></div></div></div><p>You can easily generate your own configuration meta-data file from items annotated with <code class="literal">@ConfigurationProperties</code> by using the <code class="literal">spring-boot-configuration-processor</code> jar. The jar includes a Java annotation processor which is invoked as your project is compiled. To use the processor, simply include <code class="literal">spring-boot-configuration-processor</code> as an optional dependency, for example with Maven you would add:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><dependency></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><groupId></span>org.springframework.boot<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></groupId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><artifactId></span>spring-boot-configuration-processor<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></artifactId></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"><optional></span>true<span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></optional></span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-tag"></dependency></span></pre><p>With Gradle, you can use the <a class="link" href="https://github.com/spring-projects/gradle-plugins/tree/master/propdeps-plugin" target="_top">propdeps-plugin</a> and specify:</p><pre class="programlisting"> dependencies { optional <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">"org.springframework.boot:spring-boot-configuration-processor"</span> } compileJava.dependsOn(processResources) }</pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>You need to add <code class="literal">compileJava.dependsOn(processResources)</code> to your build to ensure that resources are processed before code is compiled. Without this directive any <code class="literal">additional-spring-configuration-metadata.json</code> files will not be processed.</p></td></tr></tbody></table></div><p>The processor will pickup both classes and methods that are annotated with <code class="literal">@ConfigurationProperties</code>. The Javadoc for field values within configuration classes will be used to populate the <code class="literal">description</code> attribute.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>You should only use simple text with <code class="literal">@ConfigurationProperties</code> field Javadoc since they are not processed before being added to the JSON.</p></td></tr></tbody></table></div><p>Properties are discovered via the presence of standard getters and setters with special handling for collection types (that will be detected even if only a getter is present). The annotation processor also supports the use of the <code class="literal">@Data</code>, <code class="literal">@Getter</code> and <code class="literal">@Setter</code> lombok annotations.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="configuration-metadata-nested-properties" href="#configuration-metadata-nested-properties"></a>B.2.1 Nested properties</h3></div></div></div><p>The annotation processor will automatically consider inner classes as nested properties. For example, the following class:</p><pre class="programlisting"><em><span class="hl-annotation" style="color: gray">@ConfigurationProperties(prefix="server")</span></em> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">public</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> ServerProperties { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">private</span> String name; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">private</span> Host host; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// ... getter and setters</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">private</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">static</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">class</span> Host { <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">private</span> String ip; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">private</span> <span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">int</span> port; <span xmlns:d="http://docbook.org/ns/docbook" class="hl-comment">// ... getter and setters</span> } }</pre><p>Will produce meta-data information for <code class="literal">server.name</code>, <code class="literal">server.host.ip</code> and <code class="literal">server.host.port</code> properties. You can use the <code class="literal">@NestedConfigurationProperty</code> annotation on a field to indicate that a regular (non-inner) class should be treated as if it were nested.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="configuration-metadata-additional-metadata" href="#configuration-metadata-additional-metadata"></a>B.2.2 Adding additional meta-data</h3></div></div></div><p>Spring Boot’s configuration file handling is quite flexible; and it often the case that properties may exist that are not bound to a <code class="literal">@ConfigurationProperties</code> bean. To support such cases, the annotation processor will automatically merge items from <code class="literal">META-INF/additional-spring-configuration-metadata.json</code> into the main meta-data file.</p><p>The format of the <code class="literal">additional-spring-configuration-metadata.json</code> file is exactly the same as the regular <code class="literal">spring-configuration-metadata.json</code>. The additional properties file is optional, if you don’t have any additional properties, simply don’t add it.</p></div></div></div><div class="appendix"><div class="titlepage"><div><div><h2 class="title"><a name="auto-configuration-classes" href="#auto-configuration-classes"></a>Appendix C. Auto-configuration classes</h2></div></div></div><p>Here is a list of all auto configuration classes provided by Spring Boot with links to documentation and source code. Remember to also look at the autoconfig report in your application for more details of which features are switched on. (start the app with <code class="literal">--debug</code> or <code class="literal">-Ddebug</code>, or in an Actuator application use the <code class="literal">autoconfig</code> endpoint).</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="auto-configuration-classes-from-autoconfigure-module" href="#auto-configuration-classes-from-autoconfigure-module"></a>C.1 From the “spring-boot-autoconfigure” module</h2></div></div></div><p>The following auto-configuration classes are from the <code class="literal">spring-boot-autoconfigure</code> module:</p><div class="informaltable"><table style="border-collapse: collapse;border-top: 0.5pt solid ; border-bottom: 0.5pt solid ; border-left: 0.5pt solid ; border-right: 0.5pt solid ; "><colgroup><col class="col_1"><col class="col_2"></colgroup><thead><tr><th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top">Configuration Class</th><th style="border-bottom: 0.5pt solid ; " align="left" valign="top">Links</th></tr></thead><tbody><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQAutoConfiguration.java" target="_top"><code class="literal">ActiveMQAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/jms/activemq/ActiveMQAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/aop/AopAutoConfiguration.java" target="_top"><code class="literal">AopAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/aop/AopAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/batch/BatchAutoConfiguration.java" target="_top"><code class="literal">BatchAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/batch/BatchAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/cloud/CloudAutoConfiguration.java" target="_top"><code class="literal">CloudAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/cloud/CloudAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration.java" target="_top"><code class="literal">DataSourceAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfiguration.java" target="_top"><code class="literal">DataSourceTransactionManagerAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/jdbc/DataSourceTransactionManagerAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/DeviceDelegatingViewResolverAutoConfiguration.java" target="_top"><code class="literal">DeviceDelegatingViewResolverAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/mobile/DeviceDelegatingViewResolverAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/DeviceResolverAutoConfiguration.java" target="_top"><code class="literal">DeviceResolverAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/mobile/DeviceResolverAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/DispatcherServletAutoConfiguration.java" target="_top"><code class="literal">DispatcherServletAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/web/DispatcherServletAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/ElasticsearchAutoConfiguration.java" target="_top"><code class="literal">ElasticsearchAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/elasticsearch/ElasticsearchAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/ElasticsearchDataAutoConfiguration.java" target="_top"><code class="literal">ElasticsearchDataAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/elasticsearch/ElasticsearchDataAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchRepositoriesAutoConfiguration.java" target="_top"><code class="literal">ElasticsearchRepositoriesAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchRepositoriesAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfiguration.java" target="_top"><code class="literal">EmbeddedServletContainerAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ErrorMvcAutoConfiguration.java" target="_top"><code class="literal">ErrorMvcAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/web/ErrorMvcAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/social/FacebookAutoConfiguration.java" target="_top"><code class="literal">FacebookAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/social/FacebookAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/FallbackWebSecurityAutoConfiguration.java" target="_top"><code class="literal">FallbackWebSecurityAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/security/FallbackWebSecurityAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java" target="_top"><code class="literal">FlywayAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfiguration.java" target="_top"><code class="literal">FreeMarkerAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAutoConfiguration.java" target="_top"><code class="literal">GroovyTemplateAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/groovy/template/GroovyTemplateAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/gson/GsonAutoConfiguration.java" target="_top"><code class="literal">GsonAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/gson/GsonAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/GzipFilterAutoConfiguration.java" target="_top"><code class="literal">GzipFilterAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/web/GzipFilterAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.java" target="_top"><code class="literal">HibernateJpaAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/hornetq/HornetQAutoConfiguration.java" target="_top"><code class="literal">HornetQAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/jms/hornetq/HornetQAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/HttpEncodingAutoConfiguration.java" target="_top"><code class="literal">HttpEncodingAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/web/HttpEncodingAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/HttpMessageConvertersAutoConfiguration.java" target="_top"><code class="literal">HttpMessageConvertersAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/web/HttpMessageConvertersAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/hateoas/HypermediaAutoConfiguration.java" target="_top"><code class="literal">HypermediaAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/hateoas/HypermediaAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/integration/IntegrationAutoConfiguration.java" target="_top"><code class="literal">IntegrationAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/integration/IntegrationAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfiguration.java" target="_top"><code class="literal">JacksonAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/jackson/JacksonAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfiguration.java" target="_top"><code class="literal">JerseyAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/jersey/JerseyAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JmsAutoConfiguration.java" target="_top"><code class="literal">JmsAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/jms/JmsAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jmx/JmxAutoConfiguration.java" target="_top"><code class="literal">JmxAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/jmx/JmxAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jms/JndiConnectionFactoryAutoConfiguration.java" target="_top"><code class="literal">JndiConnectionFactoryAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/jms/JndiConnectionFactoryAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/JndiDataSourceAutoConfiguration.java" target="_top"><code class="literal">JndiDataSourceAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/jdbc/JndiDataSourceAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/jpa/JpaRepositoriesAutoConfiguration.java" target="_top"><code class="literal">JpaRepositoriesAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/data/jpa/JpaRepositoriesAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jta/JtaAutoConfiguration.java" target="_top"><code class="literal">JtaAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/jta/JtaAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/social/LinkedInAutoConfiguration.java" target="_top"><code class="literal">LinkedInAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/social/LinkedInAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.java" target="_top"><code class="literal">LiquibaseAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/liquibase/LiquibaseAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mail/MailSenderAutoConfiguration.java" target="_top"><code class="literal">MailSenderAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/mail/MailSenderAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/MessageSourceAutoConfiguration.java" target="_top"><code class="literal">MessageSourceAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/MessageSourceAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoAutoConfiguration.java" target="_top"><code class="literal">MongoAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/mongo/MongoAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mongo/MongoDataAutoConfiguration.java" target="_top"><code class="literal">MongoDataAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/mongo/MongoDataAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/mongo/MongoRepositoriesAutoConfiguration.java" target="_top"><code class="literal">MongoRepositoriesAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/data/mongo/MongoRepositoriesAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/MultipartAutoConfiguration.java" target="_top"><code class="literal">MultipartAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/web/MultipartAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/MustacheAutoConfiguration.java" target="_top"><code class="literal">MustacheAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/mustache/MustacheAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/dao/PersistenceExceptionTranslationAutoConfiguration.java" target="_top"><code class="literal">PersistenceExceptionTranslationAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/dao/PersistenceExceptionTranslationAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/PropertyPlaceholderAutoConfiguration.java" target="_top"><code class="literal">PropertyPlaceholderAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/PropertyPlaceholderAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfiguration.java" target="_top"><code class="literal">RabbitAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/reactor/ReactorAutoConfiguration.java" target="_top"><code class="literal">ReactorAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/reactor/ReactorAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/redis/RedisAutoConfiguration.java" target="_top"><code class="literal">RedisAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/redis/RedisAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/rest/RepositoryRestMvcAutoConfiguration.java" target="_top"><code class="literal">RepositoryRestMvcAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/data/rest/RepositoryRestMvcAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityAutoConfiguration.java" target="_top"><code class="literal">SecurityAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/security/SecurityAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ServerPropertiesAutoConfiguration.java" target="_top"><code class="literal">ServerPropertiesAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/web/ServerPropertiesAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/SitePreferenceAutoConfiguration.java" target="_top"><code class="literal">SitePreferenceAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/mobile/SitePreferenceAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/social/SocialWebAutoConfiguration.java" target="_top"><code class="literal">SocialWebAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/social/SocialWebAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/solr/SolrAutoConfiguration.java" target="_top"><code class="literal">SolrAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/solr/SolrAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/solr/SolrRepositoriesAutoConfiguration.java" target="_top"><code class="literal">SolrRepositoriesAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/data/solr/SolrRepositoriesAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/web/SpringDataWebAutoConfiguration.java" target="_top"><code class="literal">SpringDataWebAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/data/web/SpringDataWebAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java" target="_top"><code class="literal">ThymeleafAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/social/TwitterAutoConfiguration.java" target="_top"><code class="literal">TwitterAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/social/TwitterAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/velocity/VelocityAutoConfiguration.java" target="_top"><code class="literal">VelocityAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/velocity/VelocityAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.java" target="_top"><code class="literal">WebMvcAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/websocket/WebSocketAutoConfiguration.java" target="_top"><code class="literal">WebSocketAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/websocket/WebSocketAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/XADataSourceAutoConfiguration.java" target="_top"><code class="literal">XADataSourceAutoConfiguration</code></a></p></td><td style="" align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/autoconfigure/jdbc/XADataSourceAutoConfiguration.html" target="_top">javadoc</a></p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="auto-configuration-classes-from-actuator" href="#auto-configuration-classes-from-actuator"></a>C.2 From the “spring-boot-actuator” module</h2></div></div></div><p>The following auto-configuration classes are from the <code class="literal">spring-boot-actuator</code> module:</p><div class="informaltable"><table style="border-collapse: collapse;border-top: 0.5pt solid ; border-bottom: 0.5pt solid ; border-left: 0.5pt solid ; border-right: 0.5pt solid ; "><colgroup><col class="col_1"><col class="col_2"></colgroup><thead><tr><th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top">Configuration Class</th><th style="border-bottom: 0.5pt solid ; " align="left" valign="top">Links</th></tr></thead><tbody><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/AuditAutoConfiguration.java" target="_top"><code class="literal">AuditAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/actuate/autoconfigure/AuditAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/CrshAutoConfiguration.java" target="_top"><code class="literal">CrshAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/actuate/autoconfigure/CrshAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfiguration.java" target="_top"><code class="literal">EndpointAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/actuate/autoconfigure/EndpointAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointMBeanExportAutoConfiguration.java" target="_top"><code class="literal">EndpointMBeanExportAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/actuate/autoconfigure/EndpointMBeanExportAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.java" target="_top"><code class="literal">EndpointWebMvcAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfiguration.java" target="_top"><code class="literal">HealthIndicatorAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/actuate/autoconfigure/HealthIndicatorAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/JolokiaAutoConfiguration.java" target="_top"><code class="literal">JolokiaAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/actuate/autoconfigure/JolokiaAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementSecurityAutoConfiguration.java" target="_top"><code class="literal">ManagementSecurityAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/actuate/autoconfigure/ManagementSecurityAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementServerPropertiesAutoConfiguration.java" target="_top"><code class="literal">ManagementServerPropertiesAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/actuate/autoconfigure/ManagementServerPropertiesAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricFilterAutoConfiguration.java" target="_top"><code class="literal">MetricFilterAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/actuate/autoconfigure/MetricFilterAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricRepositoryAutoConfiguration.java" target="_top"><code class="literal">MetricRepositoryAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/actuate/autoconfigure/MetricRepositoryAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/PublicMetricsAutoConfiguration.java" target="_top"><code class="literal">PublicMetricsAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/actuate/autoconfigure/PublicMetricsAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/TraceRepositoryAutoConfiguration.java" target="_top"><code class="literal">TraceRepositoryAutoConfiguration</code></a></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/actuate/autoconfigure/TraceRepositoryAutoConfiguration.html" target="_top">javadoc</a></p></td></tr><tr><td style="border-right: 0.5pt solid ; " align="left" valign="top"><p><a class="link" href="http://github.com/spring-projects/spring-boot/tree/v1.2.2.RELEASE/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/TraceWebFilterAutoConfiguration.java" target="_top"><code class="literal">TraceWebFilterAutoConfiguration</code></a></p></td><td style="" align="left" valign="top"><p><a class="link" href="http://docs.spring.io/spring-boot/docs/1.2.2.RELEASE/api/org/springframework/boot/actuate/autoconfigure/TraceWebFilterAutoConfiguration.html" target="_top">javadoc</a></p></td></tr></tbody></table></div></div></div><div class="appendix"><div class="titlepage"><div><div><h2 class="title"><a name="executable-jar" href="#executable-jar"></a>Appendix D. The executable jar format</h2></div></div></div><p>The <code class="literal">spring-boot-loader</code> modules allows Spring Boot to support executable jar and war files. If you’re using the Maven or Gradle plugin, executable jars are automatically generated and you generally won’t need to know the details of how they work.</p><p>If you need to create executable jars from a different build system, or if you are just curious about the underlying technology, this section provides some background.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="executable-jar-nested-jars" href="#executable-jar-nested-jars"></a>D.1 Nested JARs</h2></div></div></div><p>Java does not provide any standard way to load nested jar files (i.e. jar files that are themselves contained within a jar). This can be problematic if you are looking to distribute a self-contained application that you can just run from the command line without unpacking.</p><p>To solve this problem, many developers use “shaded” jars. A shaded jar simply packages all classes, from all jars, into a single 'uber jar'. The problem with shaded jars is that it becomes hard to see which libraries you are actually using in your application. It can also be problematic if the the same filename is used (but with different content) in multiple jars. Spring Boot takes a different approach and allows you to actually nest jars directly.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="executable-jar-jar-file-structure" href="#executable-jar-jar-file-structure"></a>D.1.1 The executable jar file structure</h3></div></div></div><p>Spring Boot Loader compatible jar files should be structured in the following way:</p><pre class="screen">example.jar | +-META-INF | +-MANIFEST.MF +-org | +-springframework | +-boot | +-loader | +-<spring boot loader classes> +-com | +-mycompany | + project | +-YouClasses.class +-lib +-dependency1.jar +-dependency2.jar</pre><p>Dependencies should be placed in a nested <code class="literal">lib</code> directory.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="executable-jar-war-file-structure" href="#executable-jar-war-file-structure"></a>D.1.2 The executable war file structure</h3></div></div></div><p>Spring Boot Loader compatible war files should be structured in the following way:</p><pre class="screen">example.jar | +-META-INF | +-MANIFEST.MF +-org | +-springframework | +-boot | +-loader | +-<spring boot loader classes> +-WEB-INF +-classes | +-com | +-mycompany | +-project | +-YouClasses.class +-lib | +-dependency1.jar | +-dependency2.jar +-lib-provided +-servlet-api.jar +-dependency3.jar</pre><p>Dependencies should be placed in a nested <code class="literal">WEB-INF/lib</code> directory. Any dependencies that are required when running embedded but are not required when deploying to a traditional web container should be placed in <code class="literal">WEB-INF/lib-provided</code>.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="executable-jar-jarfile" href="#executable-jar-jarfile"></a>D.2 Spring Boot’s “JarFile” class</h2></div></div></div><p>The core class used to support loading nested jars is <code class="literal">org.springframework.boot.loader.jar.JarFile</code>. It allows you load jar content from a standard jar file, or from nested child jar data. When first loaded, the location of each <code class="literal">JarEntry</code> is mapped to a physical file offset of the outer jar:</p><pre class="screen">myapp.jar +---------+---------------------+ | | /lib/mylib.jar | | A.class |+---------+---------+| | || B.class | B.class || | |+---------+---------+| +---------+---------------------+ ^ ^ ^ 0063 3452 3980</pre><p>The example above shows how <code class="literal">A.class</code> can be found in <code class="literal">myapp.jar</code> position <code class="literal">0063</code>. <code class="literal">B.class</code> from the nested jar can actually be found in <code class="literal">myapp.jar</code> position <code class="literal">3452</code> and <code class="literal">B.class</code> is at position <code class="literal">3980</code>.</p><p>Armed with this information, we can load specific nested entries by simply seeking to appropriate part if the outer jar. We don’t need to unpack the archive and we don’t need to read all entry data into memory.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="executable-jar-jarfile-compatibility" href="#executable-jar-jarfile-compatibility"></a>D.2.1 Compatibility with the standard Java “JarFile”</h3></div></div></div><p>Spring Boot Loader strives to remain compatible with existing code and libraries. <code class="literal">org.springframework.boot.loader.jar.JarFile</code> extends from <code class="literal">java.util.jar.JarFile</code> and should work as a drop-in replacement. The <code class="literal">RandomAccessJarFile.getURL()</code> method will return a <code class="literal">URL</code> that opens a <code class="literal">java.net.JarURLConnection</code> compatible connection. <code class="literal">RandomAccessJarFile</code> URLs can be used with Java’s <code class="literal">URLClassLoader</code>.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="executable-jar-launching" href="#executable-jar-launching"></a>D.3 Launching executable jars</h2></div></div></div><p>The <code class="literal">org.springframework.boot.loader.Launcher</code> class is a special bootstrap class that is used as an executable jars main entry point. It is the actual <code class="literal">Main-Class</code> in your jar file and it’s used to setup an appropriate <code class="literal">URLClassLoader</code> and ultimately call your <code class="literal">main()</code> method.</p><p>There are 3 launcher subclasses (<code class="literal">JarLauncher</code>, <code class="literal">WarLauncher</code> and <code class="literal">PropertiesLauncher</code>). Their purpose is to load resources (<code class="literal">.class</code> files etc.) from nested jar files or war files in directories (as opposed to explicitly on the classpath). In the case of the <code class="literal">[Jar|War]Launcher</code> the nested paths are fixed (<code class="literal">lib/*.jar</code> and <code class="literal">lib-provided/*.jar</code> for the war case) so you just add extra jars in those locations if you want more. The <code class="literal">PropertiesLauncher</code> looks in <code class="literal">lib/</code> in your application archive by default, but you can add additional locations by setting an environment variable <code class="literal">LOADER_PATH</code> or <code class="literal">loader.path</code> in <code class="literal">application.properties</code> (comma-separated list of directories or archives).</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="executable-jar-launcher-manifest" href="#executable-jar-launcher-manifest"></a>D.3.1 Launcher manifest</h3></div></div></div><p>You need to specify an appropriate <code class="literal">Launcher</code> as the <code class="literal">Main-Class</code> attribute of <code class="literal">META-INF/MANIFEST.MF</code>. The actual class that you want to launch (i.e. the class that you wrote that contains a <code class="literal">main</code> method) should be specified in the <code class="literal">Start-Class</code> attribute.</p><p>For example, here is a typical <code class="literal">MANIFEST.MF</code> for an executable jar file:</p><pre class="screen">Main-Class: org.springframework.boot.loader.JarLauncher Start-Class: com.mycompany.project.MyApplication</pre><p>For a war file, it would be:</p><pre class="screen">Main-Class: org.springframework.boot.loader.WarLauncher Start-Class: com.mycompany.project.MyApplication</pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table summary="Note" border="0"><tbody><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="Spring%20Boot%20Reference%20Guide_files/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>You do not need to specify <code class="literal">Class-Path</code> entries in your manifest file, the classpath will be deduced from the nested jars.</p></td></tr></tbody></table></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="executable-jar-exploded-archives" href="#executable-jar-exploded-archives"></a>D.3.2 Exploded archives</h3></div></div></div><p>Certain PaaS implementations may choose to unpack archives before they run. For example, Cloud Foundry operates in this way. You can run an unpacked archive by simply starting the appropriate launcher:</p><pre class="screen">$ unzip -q myapp.jar $ java org.springframework.boot.loader.JarLauncher</pre></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="executable-jar-property-launcher-features" href="#executable-jar-property-launcher-features"></a>D.4 PropertiesLauncher Features</h2></div></div></div><p><code class="literal">PropertiesLauncher</code> has a few special features that can be enabled with external properties (System properties, environment variables, manifest entries or <code class="literal">application.properties</code>).</p><div class="informaltable"><table style="border-collapse: collapse;border-top: 0.5pt solid ; border-bottom: 0.5pt solid ; border-left: 0.5pt solid ; border-right: 0.5pt solid ; "><colgroup><col class="col_1"><col class="col_2"></colgroup><thead><tr><th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top">Key</th><th style="border-bottom: 0.5pt solid ; " align="left" valign="top">Purpose</th></tr></thead><tbody><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">loader.path</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Comma-separated Classpath, e.g. <code class="literal">lib:${HOME}/app/lib</code>.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">loader.home</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Location of additional properties file, e.g. <code class="literal"><a class="link" href="file:///opt/app" target="_top">/opt/app</a></code> (defaults to <code class="literal">${user.dir}</code>)</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">loader.args</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Default arguments for the main method (space separated)</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">loader.main</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Name of main class to launch, e.g. <code class="literal">com.app.Application</code>.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">loader.config.name</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Name of properties file, e.g. <code class="literal">loader</code> (defaults to <code class="literal">application</code>).</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">loader.config.location</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Path to properties file, e.g. <code class="literal">classpath:loader.properties</code> (defaults to <code class="literal">application.properties</code>).</p></td></tr><tr><td style="border-right: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">loader.system</code></p></td><td style="" align="left" valign="top"><p>Boolean flag to indicate that all properties should be added to System properties (defaults to <code class="literal">false</code>)</p></td></tr></tbody></table></div><p>Manifest entry keys are formed by capitalizing initial letters of words and changing the separator to “-” from “.” (e.g. <code class="literal">Loader-Path</code>). The exception is <code class="literal">loader.main</code> which is looked up as <code class="literal">Start-Class</code> in the manifest for compatibility with <code class="literal">JarLauncher</code>).</p><p>Environment variables can be capitalized with underscore separators instead of periods.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><code class="literal">loader.home</code> is the directory location of an additional properties file (overriding the default) as long as <code class="literal">loader.config.location</code> is not specified.</li><li class="listitem"><code class="literal">loader.path</code> can contain directories (scanned recursively for jar and zip files), archive paths, or wildcard patterns (for the default JVM behavior).</li><li class="listitem">Placeholder replacement is done from System and environment variables plus the properties file itself on all values before use.</li></ul></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="executable-jar-restrictions" href="#executable-jar-restrictions"></a>D.5 Executable jar restrictions</h2></div></div></div><p>There are a number of restrictions that you need to consider when working with a Spring Boot Loader packaged application.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="executable-jar-zip-entry-compression" href="#executable-jar-zip-entry-compression"></a>D.5.1 Zip entry compression</h3></div></div></div><p>The <code class="literal">ZipEntry</code> for a nested jar must be saved using the <code class="literal">ZipEntry.STORED</code> method. This is required so that we can seek directly to individual content within the nested jar. The content of the nested jar file itself can still be compressed, as can any other entries in the outer jar.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="executable-jar-system-classloader" href="#executable-jar-system-classloader"></a>D.5.2 System ClassLoader</h3></div></div></div><p>Launched applications should use <code class="literal">Thread.getContextClassLoader()</code> when loading classes (most libraries and frameworks will do this by default). Trying to load nested jar classes via <code class="literal">ClassLoader.getSystemClassLoader()</code> will fail. Please be aware that <code class="literal">java.util.Logging</code> always uses the system classloader, for this reason you should consider a different logging implementation.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="executable-jar-alternatives" href="#executable-jar-alternatives"></a>D.6 Alternative single jar solutions</h2></div></div></div><p>If the above restrictions mean that you cannot use Spring Boot Loader the following alternatives could be considered:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="link" href="http://maven.apache.org/plugins/maven-shade-plugin/" target="_top">Maven Shade Plugin</a></li><li class="listitem"><a class="link" href="http://www.jdotsoft.com/JarClassLoader.php" target="_top">JarClassLoader</a></li><li class="listitem"><a class="link" href="http://one-jar.sourceforge.net/" target="_top">OneJar</a></li></ul></div></div></div><div class="appendix"><div class="titlepage"><div><div><h2 class="title"><a name="appendix-dependency-versions" href="#appendix-dependency-versions"></a>Appendix E. Dependency versions</h2></div></div></div><p>The table below provides details of all of the dependency versions that are provided by Spring Boot in its CLI, Maven dependency management and Gradle plugin. When you declare a dependency on one of these artifacts without declaring a version the version that is listed in the table will be used.</p><div class="informaltable"><table style="border-collapse: collapse;border-top: 0.5pt solid ; border-bottom: 0.5pt solid ; border-left: 0.5pt solid ; border-right: 0.5pt solid ; "><colgroup><col class="col_1"><col class="col_2"><col class="col_3"></colgroup><thead><tr><th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top">Group ID</th><th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top">Artifact ID</th><th style="border-bottom: 0.5pt solid ; " align="left" valign="top">Version</th></tr></thead><tbody><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">ch.qos.logback</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">logback-classic</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.1.2</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">com.atomikos</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">transactions-jdbc</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>3.9.3</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">com.atomikos</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">transactions-jms</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>3.9.3</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">com.atomikos</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">transactions-jta</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>3.9.3</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">com.fasterxml.jackson.core</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">jackson-annotations</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.4.5</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">com.fasterxml.jackson.core</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">jackson-core</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.4.5</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">com.fasterxml.jackson.core</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">jackson-databind</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.4.5</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">com.fasterxml.jackson.dataformat</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">jackson-dataformat-xml</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.4.5</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">com.fasterxml.jackson.dataformat</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">jackson-dataformat-yaml</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.4.5</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">com.fasterxml.jackson.datatype</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">jackson-datatype-jdk8</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.4.5</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">com.fasterxml.jackson.datatype</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">jackson-datatype-joda</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.4.5</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">com.fasterxml.jackson.datatype</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">jackson-datatype-jsr310</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.4.5</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">com.gemstone.gemfire</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">gemfire</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>7.0.2</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">com.github.mxab.thymeleaf.extras</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">thymeleaf-extras-data-attribute</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.3</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">com.google.code.gson</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">gson</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.3.1</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">com.googlecode.json-simple</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">json-simple</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.1.1</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">com.h2database</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">h2</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.4.185</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">com.jayway.jsonpath</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">json-path</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>0.9.1</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">com.samskivert</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">jmustache</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.10</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">com.sun.mail</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">javax.mail</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.5.2</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">com.zaxxer</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">HikariCP</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.2.5</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">com.zaxxer</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">HikariCP-java6</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.2.5</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">commons-beanutils</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">commons-beanutils</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.9.2</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">commons-collections</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">commons-collections</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>3.2.1</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">commons-dbcp</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">commons-dbcp</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.4</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">commons-digester</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">commons-digester</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.1</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">commons-pool</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">commons-pool</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.6</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">io.dropwizard.metrics</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">metrics-core</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>3.1.0</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">io.dropwizard.metrics</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">metrics-ganglia</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>3.1.0</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">io.dropwizard.metrics</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">metrics-graphite</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>3.1.0</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">io.dropwizard.metrics</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">metrics-servlets</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>3.1.0</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">io.undertow</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">undertow-core</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.1.1.Final</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">io.undertow</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">undertow-servlet</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.1.1.Final</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">io.undertow</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">undertow-websockets-jsr</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.1.1.Final</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">javax.cache</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">cache-api</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.0.0</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">javax.jms</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">jms-api</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.1-rev-1</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">javax.mail</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">javax.mail-api</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.5.2</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">javax.servlet</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">javax.servlet-api</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>3.1.0</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">javax.servlet</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">jstl</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">javax.transaction</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">javax.transaction-api</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">jaxen</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">jaxen</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.1.6</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">joda-time</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">joda-time</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.5</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">junit</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">junit</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.12</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">log4j</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">log4j</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.17</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">mysql</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">mysql-connector-java</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>5.1.34</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">nz.net.ultraq.thymeleaf</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">thymeleaf-layout-dialect</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.7</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.apache.activemq</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">activemq-broker</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>5.10.1</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.apache.activemq</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">activemq-client</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>5.10.1</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.apache.activemq</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">activemq-jms-pool</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>5.10.1</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.apache.activemq</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">activemq-pool</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>5.10.1</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.apache.commons</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">commons-dbcp2</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.0.1</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.apache.commons</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">commons-pool2</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.2</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.apache.derby</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">derby</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>10.10.2.0</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.apache.httpcomponents</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">httpasyncclient</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.0.2</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.apache.httpcomponents</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">httpclient</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.3.6</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.apache.httpcomponents</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">httpmime</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.3.6</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.apache.logging.log4j</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">log4j-api</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.1</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.apache.logging.log4j</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">log4j-core</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.1</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.apache.logging.log4j</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">log4j-slf4j-impl</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.1</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.apache.solr</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">solr-solrj</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.7.2</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.apache.tomcat</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">tomcat-jdbc</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>8.0.20</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.apache.tomcat</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">tomcat-jsp-api</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>8.0.20</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.apache.tomcat.embed</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">tomcat-embed-core</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>8.0.20</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.apache.tomcat.embed</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">tomcat-embed-el</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>8.0.20</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.apache.tomcat.embed</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">tomcat-embed-jasper</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>8.0.20</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.apache.tomcat.embed</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">tomcat-embed-logging-juli</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>8.0.20</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.apache.tomcat.embed</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">tomcat-embed-websocket</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>8.0.20</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.apache.velocity</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">velocity</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.7</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.apache.velocity</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">velocity-tools</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.0</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.aspectj</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">aspectjrt</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.8.5</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.aspectj</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">aspectjtools</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.8.5</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.aspectj</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">aspectjweaver</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.8.5</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.codehaus.btm</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">btm</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.1.4</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.codehaus.groovy</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">groovy</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.3.10</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.codehaus.groovy</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">groovy-all</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.3.10</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.codehaus.groovy</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">groovy-ant</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.3.10</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.codehaus.groovy</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">groovy-bsf</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.3.10</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.codehaus.groovy</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">groovy-console</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.3.10</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.codehaus.groovy</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">groovy-docgenerator</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.3.10</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.codehaus.groovy</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">groovy-groovydoc</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.3.10</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.codehaus.groovy</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">groovy-groovysh</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.3.10</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.codehaus.groovy</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">groovy-jmx</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.3.10</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.codehaus.groovy</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">groovy-json</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.3.10</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.codehaus.groovy</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">groovy-jsr223</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.3.10</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.codehaus.groovy</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">groovy-nio</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.3.10</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.codehaus.groovy</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">groovy-servlet</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.3.10</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.codehaus.groovy</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">groovy-sql</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.3.10</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.codehaus.groovy</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">groovy-swing</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.3.10</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.codehaus.groovy</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">groovy-templates</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.3.10</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.codehaus.groovy</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">groovy-test</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.3.10</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.codehaus.groovy</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">groovy-testng</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.3.10</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.codehaus.groovy</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">groovy-xml</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.3.10</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.codehaus.janino</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">janino</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.6.1</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.crashub</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">crash.cli</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.3.1</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.crashub</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">crash.connectors.ssh</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.3.1</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.crashub</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">crash.connectors.telnet</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.3.1</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.crashub</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">crash.embed.spring</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.3.1</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.crashub</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">crash.plugins.cron</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.3.1</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.crashub</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">crash.plugins.mail</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.3.1</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.crashub</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">crash.shell</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.3.1</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.eclipse.jetty</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">jetty-annotations</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>9.2.9.v20150224</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.eclipse.jetty</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">jetty-continuation</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>9.2.9.v20150224</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.eclipse.jetty</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">jetty-deploy</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>9.2.9.v20150224</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.eclipse.jetty</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">jetty-http</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>9.2.9.v20150224</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.eclipse.jetty</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">jetty-io</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>9.2.9.v20150224</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.eclipse.jetty</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">jetty-jmx</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>9.2.9.v20150224</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.eclipse.jetty</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">jetty-jsp</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>9.2.9.v20150224</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.eclipse.jetty</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">jetty-plus</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>9.2.9.v20150224</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.eclipse.jetty</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">jetty-security</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>9.2.9.v20150224</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.eclipse.jetty</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">jetty-server</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>9.2.9.v20150224</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.eclipse.jetty</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">jetty-servlet</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>9.2.9.v20150224</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.eclipse.jetty</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">jetty-servlets</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>9.2.9.v20150224</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.eclipse.jetty</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">jetty-util</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>9.2.9.v20150224</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.eclipse.jetty</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">jetty-webapp</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>9.2.9.v20150224</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.eclipse.jetty</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">jetty-xml</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>9.2.9.v20150224</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.eclipse.jetty.orbit</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">javax.servlet.jsp</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.2.0.v201112011158</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.eclipse.jetty.websocket</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">javax-websocket-server-impl</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>9.2.9.v20150224</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.eclipse.jetty.websocket</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">websocket-server</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>9.2.9.v20150224</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.flywaydb</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">flyway-core</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>3.1</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.freemarker</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">freemarker</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.3.21</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.glassfish</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">javax.el</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>3.0.0</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.glassfish.jersey.containers</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">jersey-container-servlet</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.14</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.glassfish.jersey.containers</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">jersey-container-servlet-core</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.14</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.glassfish.jersey.core</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">jersey-server</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.14</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.glassfish.jersey.ext</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">jersey-bean-validation</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.14</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.glassfish.jersey.ext</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">jersey-spring3</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.14</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.glassfish.jersey.media</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">jersey-media-json-jackson</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.14</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.hamcrest</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">hamcrest-core</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.3</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.hamcrest</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">hamcrest-library</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.3</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.hibernate</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">hibernate-ehcache</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.3.8.Final</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.hibernate</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">hibernate-entitymanager</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.3.8.Final</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.hibernate</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">hibernate-envers</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.3.8.Final</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.hibernate</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">hibernate-jpamodelgen</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.3.8.Final</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.hibernate</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">hibernate-validator</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>5.1.3.Final</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.hornetq</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">hornetq-jms-client</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.4.5.Final</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.hornetq</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">hornetq-jms-server</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.4.5.Final</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.hsqldb</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">hsqldb</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.3.2</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.javassist</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">javassist</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>3.18.1-GA</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.jdom</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">jdom2</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.0.6</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.jolokia</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">jolokia-core</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.3</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.liquibase</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">liquibase-core</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>3.3.2</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.mockito</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">mockito-core</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.10.19</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.mongodb</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">mongo-java-driver</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.12.5</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.projectreactor</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">reactor-core</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.1.5.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.projectreactor</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">reactor-groovy</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.1.5.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.projectreactor</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">reactor-groovy-extensions</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.1.5.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.projectreactor</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">reactor-logback</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.1.5.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.projectreactor</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">reactor-net</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.1.5.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.projectreactor.spring</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">reactor-spring-context</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.1.3.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.projectreactor.spring</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">reactor-spring-core</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.1.3.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.projectreactor.spring</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">reactor-spring-messaging</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.1.3.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.projectreactor.spring</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">reactor-spring-webmvc</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.1.3.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.slf4j</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">jcl-over-slf4j</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.7.10</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.slf4j</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">jul-to-slf4j</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.7.10</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.slf4j</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">log4j-over-slf4j</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.7.10</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.slf4j</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">slf4j-api</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.7.10</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.slf4j</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">slf4j-jdk14</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.7.10</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.slf4j</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">slf4j-log4j12</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.7.10</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.spockframework</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spock-core</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>0.7-groovy-2.0</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.spockframework</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spock-spring</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>0.7-groovy-2.0</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-aop</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.5.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-aspects</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.5.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-beans</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.5.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-context</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.5.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-context-support</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.5.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-core</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.5.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-expression</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.5.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-instrument</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.5.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-instrument-tomcat</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.5.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-jdbc</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.5.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-jms</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.5.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">springloaded</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.1.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-messaging</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.5.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-orm</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.5.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-oxm</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.5.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-test</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.5.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-tx</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.5.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-web</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.5.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-webmvc</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.5.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-webmvc-portlet</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.5.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-websocket</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.5.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.amqp</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-amqp</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.4.3.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.amqp</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-erlang</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.4.3.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.amqp</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-rabbit</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.4.3.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.batch</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-batch-core</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>3.0.3.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.batch</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-batch-infrastructure</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>3.0.3.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.batch</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-batch-integration</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>3.0.3.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.batch</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-batch-test</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>3.0.3.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-actuator</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-autoconfigure</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-configuration-processor</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-dependency-tools</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-loader</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-loader-tools</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-actuator</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-amqp</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-aop</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-batch</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-cloud-connectors</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-data-elasticsearch</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-data-gemfire</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-data-jpa</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-data-mongodb</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-data-rest</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-data-solr</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-freemarker</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-groovy-templates</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-hateoas</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-hornetq</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-integration</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-jdbc</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-jersey</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-jetty</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-jta-atomikos</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-jta-bitronix</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-log4j</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-log4j2</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-logging</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-mail</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-mobile</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-mustache</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-redis</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-remote-shell</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-security</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-social-facebook</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-social-linkedin</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-social-twitter</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-test</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-thymeleaf</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-tomcat</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-undertow</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-velocity</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-web</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-websocket</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.boot</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-boot-starter-ws</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.cloud</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-cloud-cloudfoundry-connector</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.1.1.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.cloud</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-cloud-core</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.1.1.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.cloud</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-cloud-heroku-connector</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.1.1.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.cloud</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-cloud-localconfig-connector</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.1.1.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.cloud</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-cloud-spring-service-connector</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.1.1.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.data</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-cql</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.1.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.data</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-data-cassandra</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.1.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.data</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-data-commons</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.9.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.data</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-data-couchbase</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.data</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-data-elasticsearch</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.1.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.data</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-data-gemfire</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.5.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.data</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-data-jpa</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.7.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.data</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-data-mongodb</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.6.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.data</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-data-mongodb-cross-store</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.6.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.data</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-data-mongodb-log4j</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.6.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.data</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-data-neo4j</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>3.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.data</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-data-redis</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.4.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.data</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-data-rest-core</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.data</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-data-rest-webmvc</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.2.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.data</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-data-solr</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.3.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.hateoas</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-hateoas</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>0.16.0.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.integration</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-integration-amqp</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.integration</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-integration-core</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.integration</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-integration-event</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.integration</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-integration-feed</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.integration</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-integration-file</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.integration</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-integration-ftp</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.integration</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-integration-gemfire</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.integration</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-integration-groovy</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.integration</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-integration-http</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.integration</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-integration-ip</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.integration</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-integration-jdbc</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.integration</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-integration-jms</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.integration</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-integration-jmx</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.integration</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-integration-jpa</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.integration</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-integration-mail</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.integration</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-integration-mongodb</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.integration</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-integration-mqtt</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.integration</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-integration-redis</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.integration</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-integration-rmi</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.integration</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-integration-scripting</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.integration</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-integration-security</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.integration</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-integration-sftp</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.integration</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-integration-stream</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.integration</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-integration-syslog</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.integration</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-integration-test</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.integration</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-integration-twitter</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.integration</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-integration-websocket</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.integration</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-integration-ws</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.integration</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-integration-xml</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.integration</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-integration-xmpp</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>4.1.2.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.mobile</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-mobile-device</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.1.3.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.plugin</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-plugin-core</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.1.0.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.security</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-security-acl</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>3.2.6.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.security</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-security-aspects</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>3.2.6.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.security</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-security-cas</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>3.2.6.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.security</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-security-config</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>3.2.6.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.security</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-security-core</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>3.2.6.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.security</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-security-crypto</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>3.2.6.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.security</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-security-jwt</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.0.3.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.security</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-security-ldap</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>3.2.6.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.security</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-security-openid</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>3.2.6.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.security</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-security-remoting</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>3.2.6.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.security</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-security-taglibs</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>3.2.6.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.security</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-security-web</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>3.2.6.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.social</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-social-config</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.1.0.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.social</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-social-core</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.1.0.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.social</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-social-facebook</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.1.1.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.social</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-social-facebook-web</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.1.1.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.social</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-social-linkedin</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.0.1.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.social</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-social-security</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.1.0.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.social</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-social-twitter</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.1.0.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.social</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-social-web</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.1.0.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.ws</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-ws-core</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.2.0.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.ws</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-ws-security</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.2.0.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.ws</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-ws-support</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.2.0.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.springframework.ws</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">spring-ws-test</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.2.0.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.thymeleaf</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">thymeleaf</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.1.4.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.thymeleaf</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">thymeleaf-spring4</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.1.4.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.thymeleaf.extras</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">thymeleaf-extras-conditionalcomments</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.1.1.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.thymeleaf.extras</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">thymeleaf-extras-springsecurity3</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.1.1.RELEASE</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">org.yaml</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">snakeyaml</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>1.14</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">redis.clients</code></p></td><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">jedis</code></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>2.5.2</p></td></tr><tr><td style="border-right: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">wsdl4j</code></p></td><td style="border-right: 0.5pt solid ; " align="left" valign="top"><p><code class="literal">wsdl4j</code></p></td><td style="" align="left" valign="top"><p>1.6.3</p></td></tr></tbody></table></div></div></div></div><!-- Begin new Google code - a mod --> <script type="text/javascript"> var _gaq = _gaq || []; var pluginUrl = '//www.google-analytics.com/plugins/ga/inpage_linkid.js'; _gaq.push( ['_require', 'inpage_linkid', pluginUrl], ['_setAccount', 'UA-2728886-23'], ['_trackPageview'], ['b._require', 'inpage_linkid', pluginUrl], ['b._setAccount', 'UA-2728886-19'], ['b._trackPageview'] ); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> <!-- End 2nd Google code --> <script type="text/javascript"> function detectLastFrame() { var thisF = this.window; var allF = parent.top.frames; return allF[allF.length - 1] == thisF; } // Only inject the following code if this is a normal page or the last // frame of a frameset. if (parent.top.frames.length == 0 || detectLastFrame()) { // Inject the SpringSource search widget too. document.write(unescape("%3Cscript src='http://search.springsource.org/widget/searchtool.js' type='text/javascript'%3E%3C/script%3E")); // Inject the Eloqua code //document.write(unescape("%3Cscript src='/elqNow/elqCfg.js' type='text/javascript'%3E%3C/script%3E")); //document.write(unescape("%3Cscript src='/elqNow/elqImg.js' type='text/javascript'%3E%3C/script%3E")); } </script><script src="Spring%20Boot%20Reference%20Guide_files/searchtool.js" type="text/javascript"></script> <div id="bodyEmptyFiller"> </div><div style="left: 0px;" id="searchBar"> <div class="barOpen" style="left:-1px;bottom:1px;" id="collapseLink"><a href="javascript:void(0);"><img class="springClass" src="Spring%20Boot%20Reference%20Guide_files/ArrowLeft_spring.png" border="0"></a></div> <div id="logoSpan" class="springClass"><a target="_new" href="http://spring.io/"><img class="springClass" src="Spring%20Boot%20Reference%20Guide_files/Logo_spring_SearchBar.png" border="0"></a></div> <div id="searchFields"> <input style="color: rgb(204, 204, 204);" name="searchKeys" id="searchKeys" value="Search Documentation" type="text"> <select name="searchWhat" id="searchWhat"><option selected="selected" value="all">all</option><option value="Spring">Spring</option><option value="Grails">Grails</option><option value="Gemstone">Gemstone</option><option value="RabbitMQ">RabbitMQ</option></select> <img title="Search Documentation" src="Spring%20Boot%20Reference%20Guide_files/Btn_Search_spring.png" id="searchLens"> </div> <div id="resultsDiv"></div> <div id="daAd"> <script type="text/javascript"> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','gaPiAd'); gaPiAd('create', 'UA-42481901-1', 'none'); gaPiAd('send', 'event', 'Impression', 'Core Spring 4.0 - 15 Jun 2015 - ONLINE', location.href); var gaPiAdClick_54e438a4e5de88118c000006 = function() { gaPiAd('send', 'event', 'Click', 'Core Spring 4.0 - 15 Jun 2015 - ONLINE', location.href) }; </script><div class="PivotalAdBannerDiv"> <style> /* custom banner style placeholder */ /* #gaPiAdDivId_54e438a4e5de88118c000006 { } */ </style> <a style="text-decoration:none;" onclick="gaPiAdClick_54e438a4e5de88118c000006();" href="http://mylearn.vmware.com/gateway/?credits=0&course=255400" target="_new"> <div id="gaPiAdDivId_54e438a4e5de88118c000006" class="S2UniGeoipBanner"> <span class="S2GPcourse_name">Core Spring 4.0</span> <span class="S2GPcity">ONLINE, </span> <span class="S2GPstart_date">15 Jun 2015</span> <span class="learn-more-button">Learn More</span> </div></a> </div> </div></div></body></html>