Commit 073f8c4b authored by Phillip Webb's avatar Phillip Webb

Polish spring-boot-docs

See gh-25089
parent 2a854273
...@@ -95,7 +95,7 @@ For instance, the following example loads a YAML configuration file from the cla ...@@ -95,7 +95,7 @@ For instance, the following example loads a YAML configuration file from the cla
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-howto}/springbootapplication/ExampleEnvironmentPostProcessor.java[tag=*] include::{include-howto}/springbootapplication/MyEnvironmentPostProcessor.java[tag=*]
---- ----
TIP: The `Environment` has already been prepared with all the usual property sources that Spring Boot loads by default. TIP: The `Environment` has already been prepared with all the usual property sources that Spring Boot loads by default.
......
...@@ -463,7 +463,7 @@ The following example exposes a read operation that returns a custom object: ...@@ -463,7 +463,7 @@ The following example exposes a read operation that returns a custom object:
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-productionreadyfeatures}/endpoints/CustomEndpointExample.java[tag=read] include::{include-productionreadyfeatures}/endpoints/CustomEndpoint.java[tag=read]
---- ----
You can also write technology-specific endpoints by using `@JmxEndpoint` or `@WebEndpoint`. You can also write technology-specific endpoints by using `@JmxEndpoint` or `@WebEndpoint`.
...@@ -500,7 +500,7 @@ This can be used to invoke a write operation that takes `String name` and `int c ...@@ -500,7 +500,7 @@ This can be used to invoke a write operation that takes `String name` and `int c
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-productionreadyfeatures}/endpoints/CustomEndpointExample.java[tag=write] include::{include-productionreadyfeatures}/endpoints/CustomEndpoint.java[tag=write]
---- ----
TIP: Because endpoints are technology agnostic, only simple types can be specified in the method signature. TIP: Because endpoints are technology agnostic, only simple types can be specified in the method signature.
......
...@@ -436,7 +436,7 @@ This exit code can then be passed to `System.exit()` to return it as a status co ...@@ -436,7 +436,7 @@ This exit code can then be passed to `System.exit()` to return it as a status co
[source,java,indent=0] [source,java,indent=0]
---- ----
include::{include-springbootfeatures}/springapplication/ExitCodeExample.java[tag=*] include::{include-springbootfeatures}/springapplication/exitcode/MyApplication.java[tag=*]
---- ----
Also, the `ExitCodeGenerator` interface may be implemented by exceptions. Also, the `ExitCodeGenerator` interface may be implemented by exceptions.
......
...@@ -28,7 +28,7 @@ import org.springframework.core.io.ClassPathResource; ...@@ -28,7 +28,7 @@ import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import org.springframework.util.Assert; import org.springframework.util.Assert;
public class ExampleEnvironmentPostProcessor implements EnvironmentPostProcessor { public class MyEnvironmentPostProcessor implements EnvironmentPostProcessor {
private final YamlPropertySourceLoader loader = new YamlPropertySourceLoader(); private final YamlPropertySourceLoader loader = new YamlPropertySourceLoader();
......
...@@ -21,7 +21,7 @@ import org.springframework.boot.actuate.endpoint.annotation.ReadOperation; ...@@ -21,7 +21,7 @@ import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
import org.springframework.boot.actuate.endpoint.annotation.WriteOperation; import org.springframework.boot.actuate.endpoint.annotation.WriteOperation;
@Endpoint(id = "custom") @Endpoint(id = "custom")
public class CustomEndpointExample { public class CustomEndpoint {
// tag::read[] // tag::read[]
@ReadOperation @ReadOperation
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.docs.springbootfeatures.springapplication; package org.springframework.boot.docs.springbootfeatures.springapplication.exitcode;
// tag::code[] // tag::code[]
import org.springframework.boot.ExitCodeGenerator; import org.springframework.boot.ExitCodeGenerator;
...@@ -23,7 +23,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; ...@@ -23,7 +23,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
@SpringBootApplication @SpringBootApplication
public class ExitCodeExample { public class MyApplication {
@Bean @Bean
public ExitCodeGenerator exitCodeGenerator() { public ExitCodeGenerator exitCodeGenerator() {
...@@ -31,7 +31,7 @@ public class ExitCodeExample { ...@@ -31,7 +31,7 @@ public class ExitCodeExample {
} }
public static void main(String[] args) { public static void main(String[] args) {
System.exit(SpringApplication.exit(SpringApplication.run(ExitCodeExample.class, args))); System.exit(SpringApplication.exit(SpringApplication.run(MyApplication.class, args)));
} }
} }
......
...@@ -24,18 +24,18 @@ import org.springframework.core.env.StandardEnvironment; ...@@ -24,18 +24,18 @@ import org.springframework.core.env.StandardEnvironment;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
/** /**
* Tests for {@link ExampleEnvironmentPostProcessor}. * Tests for {@link MyEnvironmentPostProcessor}.
* *
* @author Stephane Nicoll * @author Stephane Nicoll
*/ */
class ExampleEnvironmentPostProcessorTests { class MyEnvironmentPostProcessorTests {
private final StandardEnvironment environment = new StandardEnvironment(); private final StandardEnvironment environment = new StandardEnvironment();
@Test @Test
void applyEnvironmentPostProcessor() { void applyEnvironmentPostProcessor() {
assertThat(this.environment.containsProperty("test.foo.bar")).isFalse(); assertThat(this.environment.containsProperty("test.foo.bar")).isFalse();
new ExampleEnvironmentPostProcessor().postProcessEnvironment(this.environment, new SpringApplication()); new MyEnvironmentPostProcessor().postProcessEnvironment(this.environment, new SpringApplication());
assertThat(this.environment.containsProperty("test.foo.bar")).isTrue(); assertThat(this.environment.containsProperty("test.foo.bar")).isTrue();
assertThat(this.environment.getProperty("test.foo.bar")).isEqualTo("value"); assertThat(this.environment.getProperty("test.foo.bar")).isEqualTo("value");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment