mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Polish
Closes gh-4572
This commit is contained in:
parent
31d7ebc96e
commit
8ec00c35bf
@ -60,7 +60,7 @@ added after the original pull request but before a merge.
|
|||||||
If you don't have an IDE preference we would recommend that you use
|
If you don't have an IDE preference we would recommend that you use
|
||||||
http://www.springsource.com/developer/sts[Spring Tools Suite] or
|
http://www.springsource.com/developer/sts[Spring Tools Suite] or
|
||||||
http://eclipse.org[Eclipse] when working with the code. We use the
|
http://eclipse.org[Eclipse] when working with the code. We use the
|
||||||
http://eclipse.org/m2e/[m2eclipe] eclipse plugin for maven support. Other IDEs and tools
|
http://eclipse.org/m2e/[M2Eclipse] eclipse plugin for maven support. Other IDEs and tools
|
||||||
should also work without issue.
|
should also work without issue.
|
||||||
|
|
||||||
|
|
||||||
@ -168,7 +168,7 @@ easier to navigate.
|
|||||||
|
|
||||||
==== Manual installation with m2eclipse
|
==== Manual installation with m2eclipse
|
||||||
If you prefer to install Eclipse yourself we recommend that you use the
|
If you prefer to install Eclipse yourself we recommend that you use the
|
||||||
http://eclipse.org/m2e/[m2eclipe] eclipse plugin. If you don't already have m2eclipse
|
http://eclipse.org/m2e/[M2Eclipse] eclipse plugin. If you don't already have m2eclipse
|
||||||
installed it is available from the "Eclipse marketplace".
|
installed it is available from the "Eclipse marketplace".
|
||||||
|
|
||||||
Spring Boot includes project specific source formatting settings, in order to have these
|
Spring Boot includes project specific source formatting settings, in order to have these
|
||||||
|
@ -72,7 +72,7 @@ Having trouble with Spring Boot? We'd like to help!
|
|||||||
|
|
||||||
== Reporting Issues
|
== Reporting Issues
|
||||||
Spring Boot uses GitHub's integrated issue tracking system to record bugs and feature
|
Spring Boot uses GitHub's integrated issue tracking system to record bugs and feature
|
||||||
requests. If you want to raise an issue, please follow the recommendations bellow:
|
requests. If you want to raise an issue, please follow the recommendations below:
|
||||||
|
|
||||||
* Before you log a bug, please https://github.com/spring-projects/spring-boot/search?type=Issues[search the issue tracker]
|
* Before you log a bug, please https://github.com/spring-projects/spring-boot/search?type=Issues[search the issue tracker]
|
||||||
to see if someone has already reported the problem.
|
to see if someone has already reported the problem.
|
||||||
|
@ -55,9 +55,9 @@ public class Log4J2RestartListener implements RestartListener {
|
|||||||
"hooks");
|
"hooks");
|
||||||
ReflectionUtils.makeAccessible(hooksField);
|
ReflectionUtils.makeAccessible(hooksField);
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
Collection<Cancellable> state = (Collection<Cancellable>) ReflectionUtils
|
Collection<Cancellable> hooks = (Collection<Cancellable>) ReflectionUtils
|
||||||
.getField(hooksField, shutdownCallbackRegistry);
|
.getField(hooksField, shutdownCallbackRegistry);
|
||||||
state.clear();
|
hooks.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ public class LocalDevToolsAutoConfigurationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void liveReloadTriggerdOnClassPathChangeWithoutRestart() throws Exception {
|
public void liveReloadTriggeredOnClassPathChangeWithoutRestart() throws Exception {
|
||||||
this.context = initializeAndRun(ConfigWithMockLiveReload.class);
|
this.context = initializeAndRun(ConfigWithMockLiveReload.class);
|
||||||
LiveReloadServer server = this.context.getBean(LiveReloadServer.class);
|
LiveReloadServer server = this.context.getBean(LiveReloadServer.class);
|
||||||
reset(server);
|
reset(server);
|
||||||
@ -150,7 +150,7 @@ public class LocalDevToolsAutoConfigurationTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void liveReloadNotTriggerdOnClassPathChangeWithRestart() throws Exception {
|
public void liveReloadNotTriggeredOnClassPathChangeWithRestart() throws Exception {
|
||||||
this.context = initializeAndRun(ConfigWithMockLiveReload.class);
|
this.context = initializeAndRun(ConfigWithMockLiveReload.class);
|
||||||
LiveReloadServer server = this.context.getBean(LiveReloadServer.class);
|
LiveReloadServer server = this.context.getBean(LiveReloadServer.class);
|
||||||
reset(server);
|
reset(server);
|
||||||
|
@ -94,12 +94,12 @@ public class ClassPathFileSystemWatcherTests {
|
|||||||
public static class Config {
|
public static class Config {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public Environment environemnt;
|
public Environment environment;
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public ClassPathFileSystemWatcher watcher() {
|
public ClassPathFileSystemWatcher watcher() {
|
||||||
FileSystemWatcher watcher = new FileSystemWatcher(false, 100, 10);
|
FileSystemWatcher watcher = new FileSystemWatcher(false, 100, 10);
|
||||||
URL[] urls = this.environemnt.getProperty("urls", URL[].class);
|
URL[] urls = this.environment.getProperty("urls", URL[].class);
|
||||||
return new ClassPathFileSystemWatcher(
|
return new ClassPathFileSystemWatcher(
|
||||||
new MockFileSystemWatcherFactory(watcher), restartStrategy(), urls);
|
new MockFileSystemWatcherFactory(watcher), restartStrategy(), urls);
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ public class ClassLoaderFilesTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void serialzie() throws Exception {
|
public void serialize() throws Exception {
|
||||||
ClassLoaderFile file = new ClassLoaderFile(Kind.ADDED, new byte[10]);
|
ClassLoaderFile file = new ClassLoaderFile(Kind.ADDED, new byte[10]);
|
||||||
this.files.addFile("myfile", file);
|
this.files.addFile("myfile", file);
|
||||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||||
|
@ -58,7 +58,7 @@ public class HttpTunnelConnectionTests {
|
|||||||
|
|
||||||
private String url;
|
private String url;
|
||||||
|
|
||||||
private ByteArrayOutputStream incommingData;
|
private ByteArrayOutputStream incomingData;
|
||||||
|
|
||||||
private WritableByteChannel incomingChannel;
|
private WritableByteChannel incomingChannel;
|
||||||
|
|
||||||
@ -71,8 +71,8 @@ public class HttpTunnelConnectionTests {
|
|||||||
public void setup() {
|
public void setup() {
|
||||||
MockitoAnnotations.initMocks(this);
|
MockitoAnnotations.initMocks(this);
|
||||||
this.url = "http://localhost:" + this.port;
|
this.url = "http://localhost:" + this.port;
|
||||||
this.incommingData = new ByteArrayOutputStream();
|
this.incomingData = new ByteArrayOutputStream();
|
||||||
this.incomingChannel = Channels.newChannel(this.incommingData);
|
this.incomingChannel = Channels.newChannel(this.incomingData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -129,7 +129,7 @@ public class HttpTunnelConnectionTests {
|
|||||||
write(channel, "hello");
|
write(channel, "hello");
|
||||||
write(channel, "1+1");
|
write(channel, "1+1");
|
||||||
write(channel, "1+2");
|
write(channel, "1+2");
|
||||||
assertThat(this.incommingData.toString(), equalTo("hi=2=3"));
|
assertThat(this.incomingData.toString(), equalTo("hi=2=3"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -140,7 +140,7 @@ public class HttpTunnelConnectionTests {
|
|||||||
this.requestFactory.willRespond("hi");
|
this.requestFactory.willRespond("hi");
|
||||||
TunnelChannel channel = openTunnel(true);
|
TunnelChannel channel = openTunnel(true);
|
||||||
write(channel, "hello");
|
write(channel, "hello");
|
||||||
assertThat(this.incommingData.toString(), equalTo("hi"));
|
assertThat(this.incomingData.toString(), equalTo("hi"));
|
||||||
assertThat(this.requestFactory.getExecutedRequests().size(), greaterThan(10));
|
assertThat(this.requestFactory.getExecutedRequests().size(), greaterThan(10));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ public class HttpTunnelServerTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void intialRequestIsUsedForFirstServerResponse() throws Exception {
|
public void initialRequestIsUsedForFirstServerResponse() throws Exception {
|
||||||
this.servletRequest.addHeader(SEQ_HEADER, "1");
|
this.servletRequest.addHeader(SEQ_HEADER, "1");
|
||||||
this.servletRequest.setContent("hello".getBytes());
|
this.servletRequest.setContent("hello".getBytes());
|
||||||
this.server.handle(this.request, this.response);
|
this.server.handle(this.request, this.response);
|
||||||
@ -167,7 +167,7 @@ public class HttpTunnelServerTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void typicalReqestResponseTraffic() throws Exception {
|
public void typicalRequestResponseTraffic() throws Exception {
|
||||||
MockHttpConnection h1 = new MockHttpConnection();
|
MockHttpConnection h1 = new MockHttpConnection();
|
||||||
this.server.handle(h1);
|
this.server.handle(h1);
|
||||||
MockHttpConnection h2 = new MockHttpConnection("hello server", 1);
|
MockHttpConnection h2 = new MockHttpConnection("hello server", 1);
|
||||||
|
@ -34,7 +34,7 @@ public class StaticPortProviderTests {
|
|||||||
public ExpectedException thrown = ExpectedException.none();
|
public ExpectedException thrown = ExpectedException.none();
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void portMustBePostive() throws Exception {
|
public void portMustBePositive() throws Exception {
|
||||||
this.thrown.expect(IllegalArgumentException.class);
|
this.thrown.expect(IllegalArgumentException.class);
|
||||||
this.thrown.expectMessage("Port must be positive");
|
this.thrown.expectMessage("Port must be positive");
|
||||||
new StaticPortProvider(0);
|
new StaticPortProvider(0);
|
||||||
|
@ -572,7 +572,7 @@ Spring Boot application can be started as Windows service using
|
|||||||
https://github.com/kohsuke/winsw[`winsw`].
|
https://github.com/kohsuke/winsw[`winsw`].
|
||||||
|
|
||||||
A sample https://github.com/snicoll-scratches/spring-boot-daemon[maintained separately]
|
A sample https://github.com/snicoll-scratches/spring-boot-daemon[maintained separately]
|
||||||
to the core of Spring Boot describes steps by steps how you can create a Windows service for
|
to the core of Spring Boot describes step by step how you can create a Windows service for
|
||||||
your Spring Boot application.
|
your Spring Boot application.
|
||||||
|
|
||||||
|
|
||||||
|
@ -913,7 +913,7 @@ dependencies out-of-the-box so you may want to have a look to the
|
|||||||
{propdeps-plugin}[`propdeps-plugin`] in the meantime.
|
{propdeps-plugin}[`propdeps-plugin`] in the meantime.
|
||||||
|
|
||||||
TIP: If you want to ensure that devtools is never included in a production build, you can
|
TIP: If you want to ensure that devtools is never included in a production build, you can
|
||||||
use set the `excludeDevtools` build property to completely remove the JAR. The property is
|
use the `excludeDevtools` build property to completely remove the JAR. The property is
|
||||||
supported with both the Maven and Gradle plugins.
|
supported with both the Maven and Gradle plugins.
|
||||||
|
|
||||||
|
|
||||||
@ -1058,7 +1058,7 @@ in the same way.
|
|||||||
==== Customizing the restart classloader
|
==== Customizing the restart classloader
|
||||||
As described in the <<using-spring-boot-restart-vs-reload>> section above, restart
|
As described in the <<using-spring-boot-restart-vs-reload>> section above, restart
|
||||||
functionality is implemented by using two classloaders. For most applications this
|
functionality is implemented by using two classloaders. For most applications this
|
||||||
approach works well, however, sometimes in can cause classloading issues.
|
approach works well, however, sometimes it can cause classloading issues.
|
||||||
|
|
||||||
By default, any open project in your IDE will be loaded using the "`restart`" classloader,
|
By default, any open project in your IDE will be loaded using the "`restart`" classloader,
|
||||||
and any regular `.jar` file will be loaded using the "`base`" classloader. If you work on
|
and any regular `.jar` file will be loaded using the "`base`" classloader. If you work on
|
||||||
@ -1067,7 +1067,7 @@ customize things. To do this you can create a `META-INF/spring-devtools.properti
|
|||||||
|
|
||||||
The `spring-devtools.properties` file can contain `restart.exclude.` and
|
The `spring-devtools.properties` file can contain `restart.exclude.` and
|
||||||
`restart.include.` prefixed properties. The `include` elements are items that should be
|
`restart.include.` prefixed properties. The `include` elements are items that should be
|
||||||
pulled-up into the "`restart`" classloader, and the `exclude` elements are items that
|
pulled up into the "`restart`" classloader, and the `exclude` elements are items that
|
||||||
should be pushed down into the "`base`" classloader. The value of the property is a regex
|
should be pushed down into the "`base`" classloader. The value of the property is a regex
|
||||||
pattern that will be applied to the classpath.
|
pattern that will be applied to the classpath.
|
||||||
|
|
||||||
|
@ -51,8 +51,8 @@ public final class Versions {
|
|||||||
|
|
||||||
private static String evaluateExpression(String expression) {
|
private static String evaluateExpression(String expression) {
|
||||||
try {
|
try {
|
||||||
XPathFactory xPathfactory = XPathFactory.newInstance();
|
XPathFactory xPathFactory = XPathFactory.newInstance();
|
||||||
XPath xpath = xPathfactory.newXPath();
|
XPath xpath = xPathFactory.newXPath();
|
||||||
XPathExpression expr = xpath.compile(expression);
|
XPathExpression expr = xpath.compile(expression);
|
||||||
String version = expr.evaluate(
|
String version = expr.evaluate(
|
||||||
new InputSource(new FileReader("target/dependencies-pom.xml")));
|
new InputSource(new FileReader("target/dependencies-pom.xml")));
|
||||||
|
@ -72,13 +72,13 @@ public class WarPackagingTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void onlyTomcatIsPackackedInWebInfLibProvided() throws IOException {
|
public void onlyTomcatIsPackagedInWebInfLibProvided() throws IOException {
|
||||||
checkWebInfEntriesForServletContainer("tomcat",
|
checkWebInfEntriesForServletContainer("tomcat",
|
||||||
TOMCAT_EXPECTED_IN_WEB_INF_LIB_PROVIDED);
|
TOMCAT_EXPECTED_IN_WEB_INF_LIB_PROVIDED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void onlyJettyIsPackackedInWebInfLibProvided() throws IOException {
|
public void onlyJettyIsPackagedInWebInfLibProvided() throws IOException {
|
||||||
checkWebInfEntriesForServletContainer("jetty",
|
checkWebInfEntriesForServletContainer("jetty",
|
||||||
JETTY_EXPECTED_IN_WEB_INF_LIB_PROVIDED);
|
JETTY_EXPECTED_IN_WEB_INF_LIB_PROVIDED);
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ public class SampleActuatorUiApplication {
|
|||||||
@Bean
|
@Bean
|
||||||
public SecurityProperties securityProperties() {
|
public SecurityProperties securityProperties() {
|
||||||
SecurityProperties security = new SecurityProperties();
|
SecurityProperties security = new SecurityProperties();
|
||||||
security.getBasic().setPath(""); // empty so home page is unsecured
|
security.getBasic().setPath(""); // empty so home page is insecured
|
||||||
return security;
|
return security;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ import static org.junit.Assert.assertFalse;
|
|||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Integration tests for unsecured service endpoints (even with Spring Security on
|
* Integration tests for insecured service endpoints (even with Spring Security on
|
||||||
* classpath).
|
* classpath).
|
||||||
*
|
*
|
||||||
* @author Dave Syer
|
* @author Dave Syer
|
||||||
@ -46,7 +46,7 @@ import static org.junit.Assert.assertTrue;
|
|||||||
@WebIntegrationTest(value = { "management.security.enabled:false" }, randomPort = true)
|
@WebIntegrationTest(value = { "management.security.enabled:false" }, randomPort = true)
|
||||||
@DirtiesContext
|
@DirtiesContext
|
||||||
@ActiveProfiles("unsecure-management")
|
@ActiveProfiles("unsecure-management")
|
||||||
public class UnsecureManagementSampleActuatorApplicationTests {
|
public class InsecureManagementSampleActuatorApplicationTests {
|
||||||
|
|
||||||
@Value("${local.server.port}")
|
@Value("${local.server.port}")
|
||||||
private int port;
|
private int port;
|
@ -34,7 +34,7 @@ import static org.junit.Assert.assertEquals;
|
|||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Integration tests for unsecured service endpoints (even with Spring Security on
|
* Integration tests for insecured service endpoints (even with Spring Security on
|
||||||
* classpath).
|
* classpath).
|
||||||
*
|
*
|
||||||
* @author Dave Syer
|
* @author Dave Syer
|
||||||
@ -43,7 +43,7 @@ import static org.junit.Assert.assertFalse;
|
|||||||
@SpringApplicationConfiguration(SampleActuatorApplication.class)
|
@SpringApplicationConfiguration(SampleActuatorApplication.class)
|
||||||
@WebIntegrationTest(value = { "security.basic.enabled:false" }, randomPort = true)
|
@WebIntegrationTest(value = { "security.basic.enabled:false" }, randomPort = true)
|
||||||
@DirtiesContext
|
@DirtiesContext
|
||||||
public class UnsecureSampleActuatorApplicationTests {
|
public class InsecureSampleActuatorApplicationTests {
|
||||||
|
|
||||||
@Value("${local.server.port}")
|
@Value("${local.server.port}")
|
||||||
private int port;
|
private int port;
|
@ -34,7 +34,7 @@ import static org.junit.Assert.assertEquals;
|
|||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Integration tests for unsecured service endpoints (even with Spring Security on
|
* Integration tests for insecured service endpoints (even with Spring Security on
|
||||||
* classpath).
|
* classpath).
|
||||||
*
|
*
|
||||||
* @author Dave Syer
|
* @author Dave Syer
|
||||||
@ -44,7 +44,7 @@ import static org.junit.Assert.assertFalse;
|
|||||||
@WebIntegrationTest(value = { "security.basic.enabled:false",
|
@WebIntegrationTest(value = { "security.basic.enabled:false",
|
||||||
"server.servletPath:/spring" }, randomPort = true)
|
"server.servletPath:/spring" }, randomPort = true)
|
||||||
@DirtiesContext
|
@DirtiesContext
|
||||||
public class ServletPathUnsecureSampleActuatorApplicationTests {
|
public class ServletPathInsecureSampleActuatorApplicationTests {
|
||||||
|
|
||||||
@Value("${local.server.port}")
|
@Value("${local.server.port}")
|
||||||
private int port;
|
private int port;
|
@ -24,7 +24,7 @@ import org.springframework.data.repository.PagingAndSortingRepository;
|
|||||||
import org.springframework.data.repository.query.Param;
|
import org.springframework.data.repository.query.Param;
|
||||||
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
|
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
|
||||||
|
|
||||||
@RepositoryRestResource(collectionResourceRel = "citys", path = "cities")
|
@RepositoryRestResource(collectionResourceRel = "cities", path = "cities")
|
||||||
interface CityRepository extends PagingAndSortingRepository<City, Long> {
|
interface CityRepository extends PagingAndSortingRepository<City, Long> {
|
||||||
|
|
||||||
Page<City> findByNameContainingAndCountryContainingAllIgnoringCase(
|
Page<City> findByNameContainingAndCountryContainingAllIgnoringCase(
|
||||||
|
@ -83,6 +83,6 @@ public class SampleDataRestApplicationTests {
|
|||||||
this.mvc.perform(
|
this.mvc.perform(
|
||||||
get("/api/cities/search/findByNameContainingAndCountryContainingAllIgnoringCase?name=&country=UK"))
|
get("/api/cities/search/findByNameContainingAndCountryContainingAllIgnoringCase?name=&country=UK"))
|
||||||
.andExpect(status().isOk())
|
.andExpect(status().isOk())
|
||||||
.andExpect(jsonPath("_embedded.citys", hasSize(3)));
|
.andExpect(jsonPath("_embedded.cities", hasSize(3)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ public class SampleSolrApplication implements CommandLineRunner {
|
|||||||
System.out.println();
|
System.out.println();
|
||||||
|
|
||||||
// fetch a single product
|
// fetch a single product
|
||||||
System.out.println("Products founds with findByNameStartingWith('So'):");
|
System.out.println("Products found with findByNameStartingWith('So'):");
|
||||||
System.out.println("--------------------------------");
|
System.out.println("--------------------------------");
|
||||||
for (Product product : this.repository.findByNameStartingWith("So")) {
|
for (Product product : this.repository.findByNameStartingWith("So")) {
|
||||||
System.out.println(product);
|
System.out.println(product);
|
||||||
|
@ -8,7 +8,7 @@ $ docker-compose up
|
|||||||
----
|
----
|
||||||
|
|
||||||
Run the app and ping the home page (http://localhost:8080) a few times. Go and look at
|
Run the app and ping the home page (http://localhost:8080) a few times. Go and look at
|
||||||
the result in the TDB UI, e.g.
|
the result in the TSD UI, e.g.
|
||||||
|
|
||||||
[source,indent=0]
|
[source,indent=0]
|
||||||
----
|
----
|
||||||
|
@ -20,7 +20,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
import java.util.concurrent.ConcurrentMap;
|
import java.util.concurrent.ConcurrentMap;
|
||||||
import java.util.concurrent.atomic.AtomicLong;
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
|
||||||
public class InMemoryMessageRespository implements MessageRepository {
|
public class InMemoryMessageRepository implements MessageRepository {
|
||||||
|
|
||||||
private static AtomicLong counter = new AtomicLong();
|
private static AtomicLong counter = new AtomicLong();
|
||||||
|
|
@ -26,7 +26,7 @@ public class SampleGroovyTemplateApplication {
|
|||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public MessageRepository messageRepository() {
|
public MessageRepository messageRepository() {
|
||||||
return new InMemoryMessageRespository();
|
return new InMemoryMessageRepository();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
@ -71,17 +71,17 @@ public final class ConfigurationMetadataRepositoryJsonBuilder {
|
|||||||
* ignored.
|
* ignored.
|
||||||
* <p>
|
* <p>
|
||||||
* Leaves the stream open when done.
|
* Leaves the stream open when done.
|
||||||
* @param inputstream the source input stream
|
* @param inputStream the source input stream
|
||||||
* @param charset the charset of the input
|
* @param charset the charset of the input
|
||||||
* @return this builder
|
* @return this builder
|
||||||
* @throws IOException in case of I/O errors
|
* @throws IOException in case of I/O errors
|
||||||
*/
|
*/
|
||||||
public ConfigurationMetadataRepositoryJsonBuilder withJsonResource(
|
public ConfigurationMetadataRepositoryJsonBuilder withJsonResource(
|
||||||
InputStream inputstream, Charset charset) throws IOException {
|
InputStream inputStream, Charset charset) throws IOException {
|
||||||
if (inputstream == null) {
|
if (inputStream == null) {
|
||||||
throw new IllegalArgumentException("InputStream must not be null.");
|
throw new IllegalArgumentException("InputStream must not be null.");
|
||||||
}
|
}
|
||||||
this.repositories.add(add(inputstream, charset));
|
this.repositories.add(add(inputStream, charset));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ public class JsonMarshaller {
|
|||||||
}
|
}
|
||||||
ItemDeprecation deprecation = item.getDeprecation();
|
ItemDeprecation deprecation = item.getDeprecation();
|
||||||
if (deprecation != null) {
|
if (deprecation != null) {
|
||||||
jsonObject.put("deprecated", true); // backward compat
|
jsonObject.put("deprecated", true); // backward compatibility
|
||||||
JSONObject deprecationJsonObject = new JSONObject();
|
JSONObject deprecationJsonObject = new JSONObject();
|
||||||
if (deprecation.getReason() != null) {
|
if (deprecation.getReason() != null) {
|
||||||
deprecationJsonObject.put("reason", deprecation.getReason());
|
deprecationJsonObject.put("reason", deprecation.getReason());
|
||||||
|
@ -188,7 +188,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void singleDeprecatedProprety() throws Exception {
|
public void singleDeprecatedProperty() throws Exception {
|
||||||
Class<?> type = DeprecatedSingleProperty.class;
|
Class<?> type = DeprecatedSingleProperty.class;
|
||||||
ConfigurationMetadata metadata = compile(type);
|
ConfigurationMetadata metadata = compile(type);
|
||||||
assertThat(metadata, containsGroup("singledeprecated").fromSource(type));
|
assertThat(metadata, containsGroup("singledeprecated").fromSource(type));
|
||||||
|
@ -34,12 +34,12 @@ public class ConfigurationMetadataTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void toDashedCaseWordsUnderScore() {
|
public void toDashedCaseWordsUnderscore() {
|
||||||
assertThat(toDashedCase("Word_With_underscore"), is("word_with_underscore"));
|
assertThat(toDashedCase("Word_With_underscore"), is("word_with_underscore"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void toDashedCaseWordsSeveralUnderScores() {
|
public void toDashedCaseWordsSeveralUnderscores() {
|
||||||
assertThat(toDashedCase("Word___With__underscore"),
|
assertThat(toDashedCase("Word___With__underscore"),
|
||||||
is("word___with__underscore"));
|
is("word___with__underscore"));
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ import org.springframework.boot.gradle.SpringBootPluginExtension;
|
|||||||
*/
|
*/
|
||||||
public class AgentTasksEnhancer implements Action<Project> {
|
public class AgentTasksEnhancer implements Action<Project> {
|
||||||
|
|
||||||
private static final String SPRING_LOADED_AGENT_CLASSNAME = "org.springsource.loaded.agent.SpringLoadedAgent";
|
private static final String SPRING_LOADED_AGENT_CLASS_NAME = "org.springsource.loaded.agent.SpringLoadedAgent";
|
||||||
|
|
||||||
private File agent;
|
private File agent;
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ public class AgentTasksEnhancer implements Action<Project> {
|
|||||||
|
|
||||||
private File getSpringLoadedAgent() {
|
private File getSpringLoadedAgent() {
|
||||||
try {
|
try {
|
||||||
Class<?> loaded = Class.forName(SPRING_LOADED_AGENT_CLASSNAME);
|
Class<?> loaded = Class.forName(SPRING_LOADED_AGENT_CLASS_NAME);
|
||||||
if (loaded != null) {
|
if (loaded != null) {
|
||||||
CodeSource source = loaded.getProtectionDomain().getCodeSource();
|
CodeSource source = loaded.getProtectionDomain().getCodeSource();
|
||||||
if (source != null) {
|
if (source != null) {
|
||||||
|
@ -28,14 +28,14 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public abstract class AgentAttacher {
|
public abstract class AgentAttacher {
|
||||||
|
|
||||||
private static final String VIRTUAL_MACHINE_CLASSNAME = "com.sun.tools.attach.VirtualMachine";
|
private static final String VIRTUAL_MACHINE_CLASS_NAME = "com.sun.tools.attach.VirtualMachine";
|
||||||
|
|
||||||
public static void attach(File agent) {
|
public static void attach(File agent) {
|
||||||
try {
|
try {
|
||||||
String name = ManagementFactory.getRuntimeMXBean().getName();
|
String name = ManagementFactory.getRuntimeMXBean().getName();
|
||||||
String pid = name.substring(0, name.indexOf('@'));
|
String pid = name.substring(0, name.indexOf('@'));
|
||||||
ClassLoader classLoader = JvmUtils.getToolsClassLoader();
|
ClassLoader classLoader = JvmUtils.getToolsClassLoader();
|
||||||
Class<?> vmClass = classLoader.loadClass(VIRTUAL_MACHINE_CLASSNAME);
|
Class<?> vmClass = classLoader.loadClass(VIRTUAL_MACHINE_CLASS_NAME);
|
||||||
Method attachMethod = vmClass.getDeclaredMethod("attach", String.class);
|
Method attachMethod = vmClass.getDeclaredMethod("attach", String.class);
|
||||||
Object vm = attachMethod.invoke(null, pid);
|
Object vm = attachMethod.invoke(null, pid);
|
||||||
Method loadAgentMethod = vmClass.getDeclaredMethod("loadAgent", String.class);
|
Method loadAgentMethod = vmClass.getDeclaredMethod("loadAgent", String.class);
|
||||||
|
@ -34,7 +34,7 @@ import static org.junit.Assert.assertThat;
|
|||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests fir {@link FileUtils}.
|
* Tests for {@link FileUtils}.
|
||||||
*
|
*
|
||||||
* @author Dave Syer
|
* @author Dave Syer
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
|
@ -28,7 +28,7 @@ import java.io.InputStream;
|
|||||||
public interface RandomAccessData {
|
public interface RandomAccessData {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an {@link InputStream} that can be used to read the underling data. The
|
* Returns an {@link InputStream} that can be used to read the underlying data. The
|
||||||
* caller is responsible close the underlying stream.
|
* caller is responsible close the underlying stream.
|
||||||
* @param access hint indicating how the underlying data should be accessed
|
* @param access hint indicating how the underlying data should be accessed
|
||||||
* @return a new input stream that can be used to read the underlying data.
|
* @return a new input stream that can be used to read the underlying data.
|
||||||
|
@ -87,7 +87,7 @@ public class RandomAccessDataFile implements RandomAccessData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the underling File.
|
* Returns the underlying File.
|
||||||
* @return the underlying file
|
* @return the underlying file
|
||||||
*/
|
*/
|
||||||
public File getFile() {
|
public File getFile() {
|
||||||
|
@ -155,7 +155,7 @@ public final class JarEntryData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decode MSDOS Date Time details. See
|
* Decode MS-DOS Date Time details. See
|
||||||
* <a href="http://mindprod.com/jgloss/zip.html">mindprod.com/jgloss/zip.html</a> for
|
* <a href="http://mindprod.com/jgloss/zip.html">mindprod.com/jgloss/zip.html</a> for
|
||||||
* more details of the format.
|
* more details of the format.
|
||||||
* @param date the date part
|
* @param date the date part
|
||||||
|
@ -145,7 +145,7 @@ public class RandomAccessDataFileTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void inputSteamReadOffsetBytes() throws Exception {
|
public void inputStreamReadOffsetBytes() throws Exception {
|
||||||
byte[] b = new byte[7];
|
byte[] b = new byte[7];
|
||||||
this.inputStream.skip(1);
|
this.inputStream.skip(1);
|
||||||
int amountRead = this.inputStream.read(b, 2, 3);
|
int amountRead = this.inputStream.read(b, 2, 3);
|
||||||
|
@ -52,7 +52,7 @@ import org.springframework.boot.loader.tools.MainClassFinder;
|
|||||||
*/
|
*/
|
||||||
public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
|
public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
|
||||||
|
|
||||||
private static final String SPRING_LOADED_AGENT_CLASSNAME = "org.springsource.loaded.agent.SpringLoadedAgent";
|
private static final String SPRING_LOADED_AGENT_CLASS_NAME = "org.springsource.loaded.agent.SpringLoadedAgent";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Maven project.
|
* The Maven project.
|
||||||
@ -177,7 +177,7 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
|
|||||||
private void findAgent() {
|
private void findAgent() {
|
||||||
try {
|
try {
|
||||||
if (this.agent == null || this.agent.length == 0) {
|
if (this.agent == null || this.agent.length == 0) {
|
||||||
Class<?> loaded = Class.forName(SPRING_LOADED_AGENT_CLASSNAME);
|
Class<?> loaded = Class.forName(SPRING_LOADED_AGENT_CLASS_NAME);
|
||||||
if (loaded != null) {
|
if (loaded != null) {
|
||||||
if (this.noverify == null) {
|
if (this.noverify == null) {
|
||||||
this.noverify = true;
|
this.noverify = true;
|
||||||
@ -434,7 +434,7 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
|
|||||||
public synchronized void rethrowUncaughtException()
|
public synchronized void rethrowUncaughtException()
|
||||||
throws MojoExecutionException {
|
throws MojoExecutionException {
|
||||||
if (this.exception != null) {
|
if (this.exception != null) {
|
||||||
throw new MojoExecutionException("An exception occured while running. "
|
throw new MojoExecutionException("An exception occurred while running. "
|
||||||
+ this.exception.getMessage(), this.exception);
|
+ this.exception.getMessage(), this.exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
There are tree ways one can exclude a dependency from being packaged/used at runtime
|
There are tree ways one can exclude a dependency from being packaged/used at runtime
|
||||||
|
|
||||||
* Exclude a specific artifact identified by <<<groupId>>> and <<<artifactId>>>
|
* Exclude a specific artifact identified by <<<groupId>>> and <<<artifactId>>>
|
||||||
(optionnaly with a <<<classifier>>> if needed)
|
(optionally with a <<<classifier>>> if needed)
|
||||||
|
|
||||||
* Exclude any artifact matching a given <<<artifactId>>>
|
* Exclude any artifact matching a given <<<artifactId>>>
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ Usage
|
|||||||
The plugin provides several goals to work with a Spring Boot application:
|
The plugin provides several goals to work with a Spring Boot application:
|
||||||
|
|
||||||
* <<<repackage>>>: create a jar or war file that is auto-executable. It can replace the regular artifact or can be
|
* <<<repackage>>>: create a jar or war file that is auto-executable. It can replace the regular artifact or can be
|
||||||
attached to the build lifecyle with a separate <<classifier>>.
|
attached to the build lifecycle with a separate <<classifier>>.
|
||||||
|
|
||||||
* <<<run>>>: run your Spring Boot application with several options to pass parameters to it.
|
* <<<run>>>: run your Spring Boot application with several options to pass parameters to it.
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ Usage
|
|||||||
need to be excluded, you can use one of the exclude options,
|
need to be excluded, you can use one of the exclude options,
|
||||||
see {{{./examples/exclude-dependency.html}Exclude a dependency}} for more details.
|
see {{{./examples/exclude-dependency.html}Exclude a dependency}} for more details.
|
||||||
|
|
||||||
The original (i.e. non exectuable) artifact is renamed to <<<.original>>> by default but it is also
|
The original (i.e. non executable) artifact is renamed to <<<.original>>> by default but it is also
|
||||||
possible to keep the original artifact using a custom classifier.
|
possible to keep the original artifact using a custom classifier.
|
||||||
|
|
||||||
The plugin rewrites your manifest, and in particular it manages the <<Main-Class>> and <<Start-Class>>
|
The plugin rewrites your manifest, and in particular it manages the <<Main-Class>> and <<Start-Class>>
|
||||||
@ -116,7 +116,7 @@ mvn spring-boot:run
|
|||||||
|
|
||||||
If you need to specify some JVM arguments (i.e. for debugging purposes), you can use
|
If you need to specify some JVM arguments (i.e. for debugging purposes), you can use
|
||||||
the <<<jvmArguments>>> parameter, see {{{./examples/run-debug.html}Debug the application}}
|
the <<<jvmArguments>>> parameter, see {{{./examples/run-debug.html}Debug the application}}
|
||||||
for more details. As a convenience, the profiles to enable are handed by a specific
|
for more details. As a convenience, the profiles to enable are handled by a specific
|
||||||
property (<<<profiles>>>), see {{{./examples/run-profiles.html}Specify active profiles}}.
|
property (<<<profiles>>>), see {{{./examples/run-profiles.html}Specify active profiles}}.
|
||||||
|
|
||||||
Spring Boot 1.3 has introduced <<<devtools>>>, a module to improve the development-time
|
Spring Boot 1.3 has introduced <<<devtools>>>, a module to improve the development-time
|
||||||
@ -135,7 +135,7 @@ mvn spring-boot:run
|
|||||||
---
|
---
|
||||||
|
|
||||||
When <<<devtools>>> is running, it detects change when you recompile your application and
|
When <<<devtools>>> is running, it detects change when you recompile your application and
|
||||||
automatically refreshes it. This not only work for resources but code as well. It also
|
automatically refreshes it. This works for not only resources but code as well. It also
|
||||||
provides a LiveReload server so that it can automatically trigger a browser refresh whenever
|
provides a LiveReload server so that it can automatically trigger a browser refresh whenever
|
||||||
things change.
|
things change.
|
||||||
|
|
||||||
@ -148,7 +148,7 @@ spring.devtools.remote.restart.enabled=false
|
|||||||
---
|
---
|
||||||
|
|
||||||
Prior to <<<devtools>>>, the plugin supported hot refreshing of resources by default which has
|
Prior to <<<devtools>>>, the plugin supported hot refreshing of resources by default which has
|
||||||
now be disabled in favor of the solution desribed above. You can restore it at any time by
|
now be disabled in favor of the solution described above. You can restore it at any time by
|
||||||
configuring your project:
|
configuring your project:
|
||||||
|
|
||||||
---
|
---
|
||||||
@ -173,7 +173,7 @@ spring.devtools.remote.restart.enabled=false
|
|||||||
When <<<addResources>>> is enabled, any <<src/main/resources>> folder will be added to
|
When <<<addResources>>> is enabled, any <<src/main/resources>> folder will be added to
|
||||||
the application classpath when you run the application and any duplicate found in
|
the application classpath when you run the application and any duplicate found in
|
||||||
<<target/classes>> will be removed. This allows hot refreshing of resources which can be very
|
<<target/classes>> will be removed. This allows hot refreshing of resources which can be very
|
||||||
useful when developing web applications. For example, you can work on HTML, CSS or JavaScipt
|
useful when developing web applications. For example, you can work on HTML, CSS or JavaScript
|
||||||
files and see your changes immediately without recompiling your application. It is also a helpful
|
files and see your changes immediately without recompiling your application. It is also a helpful
|
||||||
way of allowing your front end developers to work without needing to download and install a Java
|
way of allowing your front end developers to work without needing to download and install a Java
|
||||||
IDE.
|
IDE.
|
||||||
@ -196,7 +196,7 @@ spring.devtools.remote.restart.enabled=false
|
|||||||
While you may start your Spring Boot application very easily from your test (or test suite) itself,
|
While you may start your Spring Boot application very easily from your test (or test suite) itself,
|
||||||
it may be desirable to handle that in the build itself. To make sure that the lifecycle of you Spring
|
it may be desirable to handle that in the build itself. To make sure that the lifecycle of you Spring
|
||||||
Boot application is properly managed <around> your integration tests, you can use the <<<start>>> and
|
Boot application is properly managed <around> your integration tests, you can use the <<<start>>> and
|
||||||
<<<stop>>> goals as desribed below:
|
<<<stop>>> goals as described below:
|
||||||
|
|
||||||
---
|
---
|
||||||
<build>
|
<build>
|
||||||
|
@ -40,7 +40,7 @@ import org.springframework.web.context.support.StandardServletEnvironment;
|
|||||||
/**
|
/**
|
||||||
* An {@link EnvironmentPostProcessor} that parses JSON from
|
* An {@link EnvironmentPostProcessor} that parses JSON from
|
||||||
* {@code spring.application.json} or equivalently
|
* {@code spring.application.json} or equivalently
|
||||||
* {@link SpringApplicationJsonEnvironmentPostProcessor} and adds it as a map property
|
* {@code SPRING_APPLICATION_JSON} and adds it as a map property
|
||||||
* source to the {@link Environment}. The new properties are added with higher priority
|
* source to the {@link Environment}. The new properties are added with higher priority
|
||||||
* than the system properties.
|
* than the system properties.
|
||||||
*
|
*
|
||||||
|
@ -186,7 +186,7 @@ public class LogbackLoggingSystemTests extends AbstractLoggingSystemTests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void loggingLevelIsPropagatedToJulI() {
|
public void loggingLevelIsPropagatedToJul() {
|
||||||
this.loggingSystem.beforeInitialize();
|
this.loggingSystem.beforeInitialize();
|
||||||
this.loggingSystem.initialize(this.initializationContext, null, null);
|
this.loggingSystem.initialize(this.initializationContext, null, null);
|
||||||
this.loggingSystem.setLogLevel(getClass().getName(), LogLevel.DEBUG);
|
this.loggingSystem.setLogLevel(getClass().getName(), LogLevel.DEBUG);
|
||||||
|
Loading…
Reference in New Issue
Block a user