Polish docs

Minoir polish for wrapping at 90 and tabs instead of spaces.
This commit is contained in:
Phillip Webb 2014-03-18 09:41:12 -07:00
parent 5ce1bdfb7f
commit 5cb8e4100c
3 changed files with 60 additions and 64 deletions

View File

@ -125,8 +125,8 @@ To build and run a project artifact, you can type the following:
$ java -jar target/mymodule-0.0.1-SNAPSHOT.jar
----
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.
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:
[source,xml,indent=0,subs="verbatim,attributes"]
----
@ -136,7 +136,7 @@ you need to mark the embedded container dependencies as "provided", e.g.
<!-- ... -->
<packaging>war</packaging>
<!-- ... -->
<dependencies>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
@ -147,11 +147,12 @@ you need to mark the embedded container dependencies as "provided", e.g.
<scope>provided</scope>
</dependency>
<!-- ... -->
</dependencies>
</dependencies>
</project>
----
[[build-tool-plugins-maven-packaging-configuration]]
=== Repackage configuration
The following configuration options are available for the `spring-boot:repackage` goal:
@ -373,33 +374,33 @@ To build and run a project artifact, you can type the following:
----
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.
you need to mark the embedded container dependencies as belonging to a configuration
named "providedRuntime", e.g:
[source,groovy,indent=0,subs="verbatim,attributes"]
----
...
apply plugin: 'war'
...
apply plugin: 'war'
war {
baseName = 'myapp'
version = '0.5.0'
}
war {
baseName = 'myapp'
version = '0.5.0'
}
repositories {
mavenCentral()
maven { url "http://repo.spring.io/libs-snapshot" }
}
repositories {
mavenCentral()
maven { url "http://repo.spring.io/libs-snapshot" }
}
configurations {
providedRuntime
}
configurations {
providedRuntime
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
providedRuntime("org.springframework.boot:spring-boot-starter-tomcat")
...
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
providedRuntime("org.springframework.boot:spring-boot-starter-tomcat")
...
}
----

View File

@ -355,30 +355,29 @@ that and be sure that it has initialized is to add a `@Bean` of type
`ApplicationListener<EmbeddedServletContainerInitializedEvent>` and pull the container
out of the event when it is published.
A really useful thing to do in is to autowire the
`EmbeddedWebApplicationContext` into a test case and use it to
discover the port that the app is running on. In that way you can use
a test profile that chooses a random port (`server.port=0`) and make
your test suite independent of its environment. Example:
A really useful thing to do in is to autowire the `EmbeddedWebApplicationContext` into a
test case and use it to discover the port that the app is running on. In that way you can
use a test profile that chooses a random port (`server.port=0`) and make your test suite
independent of its environment. Example:
[source,java,indent=0,subs="verbatim,quotes,attributes"]
----
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = SampleDataJpaApplication.class)
@WebApplication
@IntegrationTest
@ActiveProfiles("test")
@WebApplication
@IntegrationTest
@ActiveProfiles("test")
public class CityRepositoryIntegrationTests {
@Autowired
EmbeddedWebApplicationContext server;
int port;
int port;
@Before
public void init() {
port = server.getEmbeddedServletContainer().getPort();
}
@Before
public void init() {
port = server.getEmbeddedServletContainer().getPort();
}
// ...

View File

@ -1430,38 +1430,35 @@ For example:
}
----
TIP: The context loader guesses whether you want to test a web application or not (e.g. with
`MockMVC`) by looking for the `@WebAppConfiguration` annotation. (`MockMVC` and
TIP: The context loader guesses whether you want to test a web application or not (e.g.
with `MockMVC`) by looking for the `@WebAppConfiguration` annotation. (`MockMVC` and
`@WebAppConfiguration` are part of `spring-test`).
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 `RestTemplate`)
annotate your test class (or one of its superclasses)
`@IntegrationTest`. 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. Example:
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 `RestTemplate`), annotate your test class (or one of its
superclasses) with `@IntegrationTest`. 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:
[source,java,indent=0,subs="verbatim,quotes,attributes"]
----
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = SampleDataJpaApplication.class)
@WebApplication
@IntegrationTest
@WebApplication
@IntegrationTest
public class CityRepositoryIntegrationTests {
@Autowired
CityRepository repository;
RestTemplate restTemplate = RestTemplates.get();
RestTemplate restTemplate = RestTemplates.get();
// ... interact with the running server
}
----
[[boot-features-test-utilities]]
=== Test utilities
A few test utility classes are packaged as part of `spring-boot` that are generally
@ -1528,26 +1525,24 @@ public class MyTest {
[[boot-features-rest-templates-test-utility]]
==== RestTemplates
`RestTemplates` is a static convenience factory for instances of
`RestTemplate` that are useful in integration tests. You can get a
vanilla template or one that sends Basic HTTP authentication (with a
username and password). And in either case the template will behave in
a friendly way for testing, 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
`RestTemplates` will respond by configuring the client appropriately.
`RestTemplates` is a static convenience factory for instances of `RestTemplate` that are
useful in integration tests. You can get a vanilla template or one that sends Basic HTTP
authentication (with a username and password). And in either case the template will behave
in a friendly way for testing, 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 `RestTemplates` will
respond by configuring the client appropriately.
[source,java,indent=0]
[source,java,indent=0]
----
public class MyTest {
RestTemplate template = RestTemplates.get();
RestTemplate template = RestTemplates.get();
@Test
public void testRequest() throws Exception {
HttpHeaders headers = template.getForEntity("http://myhost.com", String.class).getHeaders();
HttpHeaders headers = template.getForEntity("http://myhost.com", String.class).getHeaders();
assertThat(headers.getLocation().toString(), containsString("myotherhost"));
}
@ -1555,6 +1550,7 @@ public class MyTest {
----
[[boot-features-developing-auto-configuration]]
== Developing auto-configuration and using conditions
If you work in a company that develops shared libraries, or if you work on an open-source