mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Add properties syntax highlighting for docs
Fixes gh-495
This commit is contained in:
parent
545f046745
commit
947b4f9d8f
@ -37,7 +37,7 @@ spring.profiles= # comma list of active profiles
|
||||
spring.main.sources=
|
||||
spring.main.web-environment= # detect by default
|
||||
spring.main.show-bannder=true
|
||||
spring.main.... # see class for all properties
|
||||
spring.main....= # see class for all properties
|
||||
|
||||
# LOGGING
|
||||
logging.path=/var/logs
|
||||
@ -66,7 +66,7 @@ server.tomcat.max-threads = 0 # number of threads in protocol handler
|
||||
http.mappers.json-pretty-print=false # pretty print JSON
|
||||
spring.view.prefix= # MVC view prefix
|
||||
spring.view.suffix= # ... and suffix
|
||||
spring.resources.cache-period # cache timeouts in headers sent to browser
|
||||
spring.resources.cache-period= # cache timeouts in headers sent to browser
|
||||
|
||||
# THYMELEAF (ThymeleafAutoConfiguration)
|
||||
spring.thymeleaf.prefix="classpath:/templates/"
|
||||
@ -109,7 +109,7 @@ spring.datasource.max-active=100 # Advanced configuration...
|
||||
spring.datasource.max-idle=8
|
||||
spring.datasource.min-idle=8
|
||||
spring.datasource.initial-size=10
|
||||
spring.datasource.validation-query
|
||||
spring.datasource.validation-query=
|
||||
spring.datasource.test-on-borrow=false
|
||||
spring.datasource.test-on-return=false
|
||||
|
||||
|
@ -146,7 +146,7 @@ The following configuration options are available for the `spring-boot:repackage
|
||||
|Name of the generated archive (defaults to `${project.build.finalName}`).
|
||||
|===
|
||||
|
||||
|==
|
||||
|
||||
|
||||
[[build-tool-plugins-maven-packaging-optional-params]]
|
||||
==== Optional parameters
|
||||
|
@ -120,10 +120,10 @@ you create the application to modify its behavior. Or you can externalize the
|
||||
configuration using properties in `spring.main.*`. E.g. in `application.properties` you
|
||||
might have.
|
||||
|
||||
[indent=0,subs="verbatim,quotes,attributes"]
|
||||
[source,properties,indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
spring.main.web_environment: false
|
||||
spring.main.show_banner: false
|
||||
spring.main.web_environment=false
|
||||
spring.main.show_banner=false
|
||||
----
|
||||
|
||||
and then the Spring Boot banner will not be printed on startup, and the application will
|
||||
@ -167,9 +167,9 @@ Some people like to use (for example) `--port=9000` instead of `--server.port=90
|
||||
set configuration properties on the command line. You can easily enable this by using
|
||||
placeholders in `application.properties`, e.g.
|
||||
|
||||
[indent=0,subs="verbatim,quotes,attributes"]
|
||||
[source,properties,indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
server.port: ${port:8080}
|
||||
server.port=${port:8080}
|
||||
----
|
||||
|
||||
NOTE: In this specific case the port binding will work in a PaaS environment like Heroku
|
||||
@ -204,12 +204,12 @@ is 1-level deep and has period-separated keys, a lot like people are used to wit
|
||||
|
||||
The example YAML above corresponds to an `application.properties` file
|
||||
|
||||
[indent=0,subs="verbatim,quotes,attributes"]
|
||||
[source,properties,indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
spring.application.name: cruncher
|
||||
spring.datasource.driverClassName: com.mysql.jdbc.Driver
|
||||
spring.datasource.url: jdbc:mysql://localhost/test
|
||||
server.port: 9000
|
||||
spring.application.name=cruncher
|
||||
spring.datasource.driverClassName=com.mysql.jdbc.Driver
|
||||
spring.datasource.url=jdbc:mysql://localhost/test
|
||||
server.port=9000
|
||||
----
|
||||
|
||||
See ``<<spring-boot-features.adoc#boot-features-external-config-yaml>>'' in
|
||||
@ -230,7 +230,7 @@ or jar archive):
|
||||
|
||||
In Spring Boot you can also set the active profile in `application.properties`, e.g.
|
||||
|
||||
[indent=0,subs="verbatim,quotes,attributes"]
|
||||
[source,properties,indent=0,subs="verbatim,quotes,attributes"]
|
||||
----
|
||||
spring.profiles.active=production
|
||||
----
|
||||
@ -1085,10 +1085,10 @@ standard behavior is determined by the presence or absence of certain request he
|
||||
work with most front end proxies. You switch on the valve by adding some entries to
|
||||
`application.properties`, e.g.
|
||||
|
||||
[indent=0]
|
||||
[source,properties,indent=0]
|
||||
----
|
||||
server.tomcat.remote_ip_header: x-forwarded-for
|
||||
server.tomcat.protocol_header: x-forwarded-proto
|
||||
server.tomcat.remote_ip_header=x-forwarded-for
|
||||
server.tomcat.protocol_header=x-forwarded-proto
|
||||
----
|
||||
|
||||
(The presence of either of those properties will switch on the valve. Or you can add the
|
||||
|
@ -124,7 +124,7 @@ Endpoints can be customized using Spring properties. You can change if an endpoi
|
||||
For example, here is an `application.properties` that changes the sensitivity and id
|
||||
of the `beans` endpoint and also enables `shutdown`.
|
||||
|
||||
[indent=0]
|
||||
[source,properties,indent=0]
|
||||
----
|
||||
endpoints.beans.id=springbeans
|
||||
endpoints.beans.sensitive=false
|
||||
@ -174,11 +174,11 @@ You can customize the data exposed by the `info` endpoint by settings `info.*` S
|
||||
properties. All `Environment` properties under the info key will be automatically
|
||||
exposed. For example, you could add the following to your `application.properties`:
|
||||
|
||||
[indent=0]
|
||||
[source,properties,indent=0]
|
||||
----
|
||||
info.app.name: MyService
|
||||
info.app.description: My awesome service
|
||||
info.app.version: 1.0.0
|
||||
info.app.name=MyService
|
||||
info.app.description=My awesome service
|
||||
info.app.version=1.0.0
|
||||
----
|
||||
|
||||
If you are using Maven, you can automatically expand info properties from the Maven
|
||||
@ -197,16 +197,16 @@ element):
|
||||
|
||||
You can then refer to your Maven ``project properties'' via placeholders, e.g.
|
||||
|
||||
[indent=0]
|
||||
[source,properties,indent=0]
|
||||
----
|
||||
project.artifactId: myproject
|
||||
project.name: Demo
|
||||
project.version: X.X.X.X
|
||||
project.description: Demo project for info endpoint
|
||||
info.build.artifact: ${project.artifactId}
|
||||
info.build.name: ${project.name}
|
||||
info.build.description: ${project.description}
|
||||
info.build.version: ${project.version}
|
||||
project.artifactId=myproject
|
||||
project.name=Demo
|
||||
project.version=X.X.X.X
|
||||
project.description=Demo project for info endpoint
|
||||
info.build.artifact=${project.artifactId}
|
||||
info.build.name=${project.name}
|
||||
info.build.description=${project.description}
|
||||
info.build.version=${project.version}
|
||||
----
|
||||
|
||||
NOTE: In the above example we used `project.*` to set some values to be used as
|
||||
@ -262,7 +262,7 @@ You can use Spring properties to change the username and passsword and to change
|
||||
security role required to access the endpoints. For example, you might set the following
|
||||
in your `application.properties`:
|
||||
|
||||
[indent=0]
|
||||
[source,properties,indent=0]
|
||||
----
|
||||
security.user.name=admin
|
||||
security.user.password=secret
|
||||
@ -277,7 +277,7 @@ Sometimes it is useful to group all management endpoints under a single path. Fo
|
||||
your application might already use `/info` for another purpose. You can use the
|
||||
`management.contextPath` property to set a prefix for your manangement endpoint:
|
||||
|
||||
[indent=0]
|
||||
[source,properties,indent=0]
|
||||
----
|
||||
management.contextpath=/manage
|
||||
----
|
||||
@ -297,7 +297,7 @@ The `management.port` property can be used to change the HTTP port. Since your m
|
||||
port is often protected by a firewall, and not exposed to the public, you might also
|
||||
want to disable management security:
|
||||
|
||||
[indent=0]
|
||||
[source,properties,indent=0]
|
||||
----
|
||||
management.port=8081
|
||||
management.security.enabled=false
|
||||
@ -318,7 +318,7 @@ main server port.
|
||||
Here is an example `application.properties` that will not allow remote management
|
||||
connections:
|
||||
|
||||
[indent=0]
|
||||
[source,properties,indent=0]
|
||||
----
|
||||
management.port=8081
|
||||
management.address=127.0.0.1
|
||||
@ -330,7 +330,7 @@ connections:
|
||||
=== Disabling HTTP endpoints
|
||||
If you don't want to expose endpoints over HTTP you can set the management port to `-1`:
|
||||
|
||||
[indent=0]
|
||||
[source,properties,indent=0]
|
||||
----
|
||||
management.port=-1
|
||||
----
|
||||
@ -357,7 +357,7 @@ to `true` so that MBean names are always unique.
|
||||
You can also customize the JMX domain under which endpoints are exposed. Here is an
|
||||
example `application.properties`:
|
||||
|
||||
[indent=0]
|
||||
[source,properties,indent=0]
|
||||
----
|
||||
endpoints.jmx.domain=myapp
|
||||
endpoints.jmx.uniqueNames=true
|
||||
@ -370,7 +370,7 @@ example `application.properties`:
|
||||
If you don't want to expose endpoints over JMX you can set the `spring.jmx.enabled`
|
||||
property to `false`:
|
||||
|
||||
[indent=0]
|
||||
[source,properties,indent=0]
|
||||
----
|
||||
spring.jmx.enabled=false
|
||||
----
|
||||
@ -401,7 +401,7 @@ Jolokia has a number of settings that you would traditionally configure using se
|
||||
parameters. With Spring Boot you can use your `application.properties`, simply prefix the
|
||||
parameter with `jolokia.config.`:
|
||||
|
||||
[indent=0]
|
||||
[source,properties,indent=0]
|
||||
----
|
||||
jolokia.config.debug=true
|
||||
----
|
||||
@ -413,7 +413,7 @@ parameter with `jolokia.config.`:
|
||||
If you are using Jolokia but you don't want Spring Boot to configure it, simply set the
|
||||
`endpoints.jolokia.enabled` property to `false`:
|
||||
|
||||
[indent=0]
|
||||
[source,properties,indent=0]
|
||||
----
|
||||
jolokia.config.enabled=false
|
||||
----
|
||||
|
@ -284,10 +284,10 @@ The values in `application.properties` are filtered through the existing `Enviro
|
||||
when they are used so you can refer back to previously defined values (e.g. from System
|
||||
properties).
|
||||
|
||||
[indent=0]
|
||||
[source,properties,indent=0]
|
||||
----
|
||||
app.name: MyApp
|
||||
app.description: ${app.name} is a Spring Boot application
|
||||
app.name=MyApp
|
||||
app.description=${app.name} is a Spring Boot application
|
||||
----
|
||||
|
||||
TIP: You can also use this technique to create ``short'' variants of existing Spring Boot
|
||||
@ -328,7 +328,7 @@ For example, the following YAML document:
|
||||
|
||||
Would be transformed into these properties:
|
||||
|
||||
[indent=0]
|
||||
[source,properties,indent=0]
|
||||
----
|
||||
environments.dev.url=http://dev.bar.com
|
||||
environments.dev.name=Developer Setup
|
||||
@ -348,7 +348,7 @@ and also as property keys with `[index]` dereferencers, for example this YAML:
|
||||
|
||||
Would be transformed into these properties:
|
||||
|
||||
[indent=0]
|
||||
[source,properties,indent=0]
|
||||
----
|
||||
servers=dev.bar.com,foo.bar.com
|
||||
servers[0]=dev.bar.com
|
||||
@ -532,7 +532,7 @@ Spring Boot takes this a stage further, in that you can use a `spring.profiles.a
|
||||
in any of the usual ways, for example you could include it in your
|
||||
`application.properties`:
|
||||
|
||||
[indent=0]
|
||||
[source,properties,indent=0]
|
||||
----
|
||||
spring.profiles.active=dev,hsqldb
|
||||
----
|
||||
@ -1036,12 +1036,12 @@ DataSource configuration is controlled by external configuration properties in
|
||||
`spring.datasource.*`. For example, you might declare the following section
|
||||
in `application.properties`:
|
||||
|
||||
[indent=0]
|
||||
[source,properties,indent=0]
|
||||
----
|
||||
spring.datasource.url: jdbc:mysql://localhost/test
|
||||
spring.datasource.username: dbuser
|
||||
spring.datasource.password: dbpass
|
||||
spring.datasource.driverClassName: com.mysql.jdbc.Driver
|
||||
spring.datasource.url=jdbc:mysql://localhost/test
|
||||
spring.datasource.username=dbuser
|
||||
spring.datasource.password=dbpass
|
||||
spring.datasource.driverClassName=com.mysql.jdbc.Driver
|
||||
----
|
||||
|
||||
See {sc-spring-boot-autoconfigure}/jdbc/AbstractDataSourceConfiguration.{sc-ext}[`AbstractDataSourceConfiguration`]
|
||||
@ -1268,10 +1268,10 @@ You can set `spring.data.mongodb.url` property to change the `url`, or alternati
|
||||
specify a `host`/`port`. For example, you might declare the following in your
|
||||
`application.properties`:
|
||||
|
||||
[indent=0]
|
||||
[source,properties,indent=0]
|
||||
----
|
||||
spring.data.mongodb.host = mongoserver
|
||||
spring.data.mongodb.port = 27017
|
||||
spring.data.mongodb.host=mongoserver
|
||||
spring.data.mongodb.port=27017
|
||||
----
|
||||
|
||||
TIP: If `spring.data.mongodb.port` is not specified the default of `27017` is used. You
|
||||
|
@ -16,5 +16,6 @@
|
||||
<highlighter id="css" file="./xslthl/css-hl.xml" />
|
||||
<highlighter id="sql" file="./xslthl/sql2003-hl.xml" />
|
||||
<highlighter id="asciidoc" file="./xslthl/asciidoc-hl.xml" />
|
||||
<highlighter id="properties" file="./xslthl/properties-hl.xml" />
|
||||
<namespace prefix="xslthl" uri="http://xslthl.sf.net" />
|
||||
</xslthl-config>
|
||||
|
@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Syntax highlighting definition for Java
|
||||
|
||||
xslthl - XSLT Syntax Highlighting
|
||||
http://sourceforge.net/projects/xslthl/
|
||||
Copyright (C) 2005-2008 Michal Molhanec, Jirka Kosek, Michiel Hendriks
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Michal Molhanec <mol1111 at users.sourceforge.net>
|
||||
Jirka Kosek <kosek at users.sourceforge.net>
|
||||
Michiel Hendriks <elmuerte at users.sourceforge.net>
|
||||
|
||||
-->
|
||||
<highlighters>
|
||||
<highlighter type="oneline-comment">#</highlighter>
|
||||
<highlighter type="regex">
|
||||
<pattern>^(.+)(?==|:)</pattern>
|
||||
<style>attribute</style>
|
||||
<flags>MULTILINE</flags>
|
||||
</highlighter>
|
||||
</highlighters>
|
Loading…
Reference in New Issue
Block a user