Polish
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.actuate.audit;
|
||||
|
||||
import java.util.Collections;
|
||||
@@ -26,7 +27,6 @@ import java.util.Map;
|
||||
* such an event.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class AuditEvent {
|
||||
|
||||
|
||||
@@ -13,14 +13,16 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.actuate.audit;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
* Repository for {@link AuditEvent}s.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*/
|
||||
public interface AuditEventRepository {
|
||||
|
||||
|
||||
@@ -23,8 +23,9 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
* In-memory {@link AuditEventRepository} implementation.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*/
|
||||
public class InMemoryAuditEventRepository implements AuditEventRepository {
|
||||
|
||||
|
||||
@@ -13,14 +13,16 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.actuate.audit.listener;
|
||||
|
||||
import org.springframework.bootstrap.actuate.audit.AuditEvent;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
* {@link ApplicationEvent} to encapsulate {@link AuditEvent}s.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*/
|
||||
public class AuditApplicationEvent extends ApplicationEvent {
|
||||
|
||||
|
||||
@@ -13,16 +13,19 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.actuate.audit.listener;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.bootstrap.actuate.audit.AuditEvent;
|
||||
import org.springframework.bootstrap.actuate.audit.AuditEventRepository;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
* {@link ApplicationListener} for {@link AuditEvent}s.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*/
|
||||
public class AuditListener implements ApplicationListener<AuditApplicationEvent> {
|
||||
|
||||
@@ -40,4 +43,4 @@ public class AuditListener implements ApplicationListener<AuditApplicationEvent>
|
||||
this.auditEventRepository.add(event.getAuditEvent());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,10 +36,9 @@ import org.springframework.context.annotation.Import;
|
||||
MetricFilterConfiguration.class, AuditConfiguration.class })
|
||||
public class ActuatorAutoConfiguration {
|
||||
|
||||
/*
|
||||
* ServerProperties has to be declared in a non-conditional bean, so that it gets
|
||||
* added to the context early enough
|
||||
*/
|
||||
// ServerProperties has to be declared in a non-conditional bean, so that it gets
|
||||
// added to the context early enough
|
||||
|
||||
@EnableConfigurationProperties
|
||||
public static class ServerPropertiesConfiguration {
|
||||
|
||||
|
||||
@@ -13,12 +13,14 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.actuate.autoconfigure;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.Servlet;
|
||||
|
||||
import org.springframework.bootstrap.autoconfigure.web.WebMvcAutoConfiguration.WebMvcConfiguration;
|
||||
import org.springframework.bootstrap.context.annotation.ConditionalOnClass;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
@@ -29,8 +31,9 @@ import org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfigu
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
* {@link WebMvcConfiguration} for actuator.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*/
|
||||
@ConditionalOnClass({ Servlet.class, DispatcherServlet.class })
|
||||
@Configuration
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.actuate.autoconfigure;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -28,7 +29,6 @@ import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
public class AuditConfiguration {
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.actuate.autoconfigure;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
@@ -31,7 +32,6 @@ import org.springframework.context.annotation.Conditional;
|
||||
* endpoints.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
@Conditional(OnManagementContextCondition.class)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.actuate.autoconfigure;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -46,7 +47,6 @@ import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
@Conditional(RememberManagementConfiguration.class)
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.actuate.autoconfigure;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -23,7 +24,6 @@ import org.springframework.context.annotation.Import;
|
||||
* management context whether it is a child context or not).
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnManagementContext
|
||||
@@ -31,4 +31,4 @@ import org.springframework.context.annotation.Import;
|
||||
ShutdownConfiguration.class, TraceConfiguration.class, BeansConfiguration.class })
|
||||
public class ManagementEndpointsRegistration {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.actuate.autoconfigure;
|
||||
|
||||
import org.springframework.bootstrap.actuate.metrics.CounterService;
|
||||
@@ -30,7 +31,6 @@ import org.springframework.context.annotation.Configuration;
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for metrics services.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
public class MetricRepositoryConfiguration {
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.actuate.autoconfigure;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -35,7 +36,6 @@ import org.springframework.core.type.AnnotationMetadata;
|
||||
* @author Dave Syer
|
||||
*
|
||||
* @see ConditionalOnManagementContext
|
||||
*
|
||||
*/
|
||||
public class OnManagementContextCondition implements Condition {
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.actuate.endpoint.shutdown;
|
||||
|
||||
import java.util.Collections;
|
||||
@@ -35,7 +36,6 @@ import org.springframework.web.context.support.ServletRequestHandledEvent;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
public class ShutdownEndpoint implements ApplicationContextAware,
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.actuate.endpoint.trace;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -41,7 +42,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class WebRequestLoggingFilter implements Filter, Ordered {
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.actuate.properties;
|
||||
|
||||
import javax.validation.Valid;
|
||||
@@ -25,7 +26,6 @@ import org.springframework.bootstrap.context.annotation.ConfigurationProperties;
|
||||
* Externalized configuration for endpoints (e.g. paths)
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
@ConfigurationProperties(name = "endpoints", ignoreUnknownFields = false)
|
||||
public class EndpointsProperties {
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.actuate.security;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -29,7 +30,6 @@ import org.springframework.security.web.authentication.switchuser.Authentication
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class AuthenticationAuditListener implements
|
||||
ApplicationListener<AbstractAuthenticationEvent>, ApplicationEventPublisherAware {
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.actuate.security;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -29,7 +30,6 @@ import org.springframework.security.access.event.AuthorizationFailureEvent;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class AuthorizationAuditListener implements
|
||||
ApplicationListener<AbstractAuthorizationEvent>, ApplicationEventPublisherAware {
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.actuate.trace;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -23,7 +24,6 @@ import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class InMemoryTraceRepository implements TraceRepository {
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.actuate.trace;
|
||||
|
||||
import java.util.Date;
|
||||
@@ -20,7 +21,6 @@ import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class Trace {
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.actuate.trace;
|
||||
|
||||
import java.util.List;
|
||||
@@ -23,7 +24,6 @@ import java.util.Map;
|
||||
* be used for analysing contextual information like HTTP headers.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public interface TraceRepository {
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.springframework.bootstrap.cli;
|
||||
|
||||
|
||||
/**
|
||||
* A single command that can be run from the CLI.
|
||||
*
|
||||
|
||||
@@ -13,16 +13,24 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.cli;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.ServiceLoader;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
* Factory used to create CLI {@link Command}s. Intended for use with a Java
|
||||
* {@link ServiceLoader}.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*/
|
||||
public interface CommandFactory {
|
||||
|
||||
/**
|
||||
* Returns the CLI {@link Command}s.
|
||||
* @return The commands
|
||||
*/
|
||||
Collection<Command> getCommands();
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.cli.command;
|
||||
|
||||
import java.io.File;
|
||||
@@ -30,7 +31,6 @@ import org.springframework.bootstrap.cli.Command;
|
||||
* download on the next attempt to resolve.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class CleanCommand extends OptionParsingCommand {
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.cli.command;
|
||||
|
||||
import java.util.Arrays;
|
||||
@@ -23,8 +24,9 @@ import org.springframework.bootstrap.cli.Command;
|
||||
import org.springframework.bootstrap.cli.CommandFactory;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
* Default implementation of {@link CommandFactory}.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*/
|
||||
public class DefaultCommandFactory implements CommandFactory {
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.cli.command;
|
||||
|
||||
import groovy.lang.Closure;
|
||||
@@ -27,12 +28,15 @@ import joptsimple.OptionSet;
|
||||
import joptsimple.OptionSpecBuilder;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
* A handler that parses and handles options.
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @see OptionParsingCommand
|
||||
*/
|
||||
public class OptionHandler {
|
||||
|
||||
private OptionParser parser;
|
||||
|
||||
private Closure<Void> closure;
|
||||
|
||||
public OptionSpecBuilder option(String name, String description) {
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.springframework.bootstrap.cli.command;
|
||||
import org.springframework.bootstrap.cli.Command;
|
||||
|
||||
/**
|
||||
* Base class for a {@link Command} that uses an {@link OptionHandler}.
|
||||
* Base class for a {@link Command} that pare options using an {@link OptionHandler}.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @author Dave Syer
|
||||
|
||||
@@ -36,7 +36,6 @@ import static java.util.Arrays.asList;
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @author Dave Syer
|
||||
*
|
||||
* @see BootstrapRunner
|
||||
*/
|
||||
public class RunCommand extends OptionParsingCommand {
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.cli.command;
|
||||
|
||||
import groovy.lang.Closure;
|
||||
@@ -37,7 +38,6 @@ import org.springframework.bootstrap.cli.compiler.GroovyCompilerConfiguration;
|
||||
* {@link Command} to run a Groovy script.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class ScriptCommand implements Command {
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.cli.command;
|
||||
|
||||
import groovy.lang.Mixin;
|
||||
@@ -50,7 +51,6 @@ import org.springframework.bootstrap.cli.Command;
|
||||
* Customizer for the compilation of CLI commands.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class ScriptCompilationCustomizer extends CompilationCustomizer {
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.cli.template;
|
||||
|
||||
import groovy.text.GStringTemplateEngine;
|
||||
@@ -28,10 +29,11 @@ import org.codehaus.groovy.control.CompilationFailedException;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class GroovyTemplate {
|
||||
|
||||
// FIXME is this used?
|
||||
|
||||
public static String template(String name) throws IOException,
|
||||
CompilationFailedException, ClassNotFoundException {
|
||||
return template(name, Collections.<String, Object> emptyMap());
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.cli;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@@ -27,6 +28,7 @@ import org.apache.ivy.util.FileUtil;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.springframework.bootstrap.cli.command.RunCommand;
|
||||
|
||||
@@ -35,7 +37,6 @@ import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class SampleIntegrationTests {
|
||||
|
||||
@@ -128,7 +129,11 @@ public class SampleIntegrationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void uiSample() throws Exception {
|
||||
|
||||
// FIXME Failing on OSX
|
||||
|
||||
// To run this one from the command line you need to add target/test-classes to
|
||||
// CLASSPATH
|
||||
start("samples/ui.groovy");
|
||||
|
||||
@@ -55,7 +55,7 @@ import org.springframework.bootstrap.launcher.data.RandomAccessDataFile;
|
||||
* <li>A nested {@link JarFile} can be
|
||||
* {@link #getNestedJarFile(ZipEntry, JarEntryFilter...) obtained} for embedded JAR files
|
||||
* (as long as their entry is not compressed).</li>
|
||||
* <li>Entry data can be {@link #getData(ZipEntry) accessed} as {@link RandomAccessData}.</li>
|
||||
* <li>Entry data can be accessed as {@link RandomAccessData}.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Phillip Webb
|
||||
@@ -154,7 +154,7 @@ public class RandomAccessJarFile extends JarFile {
|
||||
}
|
||||
|
||||
protected final RandomAccessDataFile getRootJarFile() {
|
||||
return rootJarFile;
|
||||
return this.rootJarFile;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -270,8 +270,7 @@ public class RandomAccessJarFile extends JarFile {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a URL that can be used to access this JAR file. The returned URL will
|
||||
* connect using a {@link RandomAccessJarURLConnection}. NOTE: the specified URL
|
||||
* Return a URL that can be used to access this JAR file. NOTE: the specified URL
|
||||
* cannot be serialized and or cloned.
|
||||
* @return the URL
|
||||
* @throws MalformedURLException
|
||||
@@ -425,9 +424,9 @@ public class RandomAccessJarFile extends JarFile {
|
||||
// supported
|
||||
this.contentType = (this.jarEntryName == null ? "x-java/jar" : null);
|
||||
this.contentType = (this.contentType == null ? guessContentTypeFromName(this.jarEntryName)
|
||||
: contentType);
|
||||
: this.contentType);
|
||||
this.contentType = (this.contentType == null ? "content/unknown"
|
||||
: contentType);
|
||||
: this.contentType);
|
||||
}
|
||||
return this.contentType;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.service;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -10,7 +26,7 @@ public class HelloWorldService {
|
||||
private ServiceProperties configuration;
|
||||
|
||||
public String getHelloMessage() {
|
||||
return "Hello " + configuration.getName();
|
||||
return "Hello " + this.configuration.getName();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.service;
|
||||
|
||||
import java.util.Collections;
|
||||
@@ -17,7 +33,8 @@ public class SampleController {
|
||||
@RequestMapping("/")
|
||||
@ResponseBody
|
||||
public Map<String, String> helloWorld() {
|
||||
return Collections.singletonMap("message", helloWorldService.getHelloMessage());
|
||||
return Collections.singletonMap("message",
|
||||
this.helloWorldService.getHelloMessage());
|
||||
}
|
||||
|
||||
@RequestMapping("/foo")
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.service;
|
||||
|
||||
import org.springframework.bootstrap.SpringApplication;
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.service;
|
||||
|
||||
import org.springframework.bootstrap.context.annotation.ConfigurationProperties;
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.batch;
|
||||
|
||||
import org.springframework.batch.core.Job;
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.data;
|
||||
|
||||
import org.springframework.bootstrap.SpringApplication;
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.data.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.data.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.data.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.data.domain;
|
||||
|
||||
public enum Rating {
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.data.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.data.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.data.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.data.domain;
|
||||
|
||||
public enum TripType {
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.data.domain.repository;
|
||||
|
||||
import org.springframework.bootstrap.sample.data.domain.City;
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.data.domain.repository;
|
||||
|
||||
import org.springframework.bootstrap.sample.data.domain.City;
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.data.domain.repository;
|
||||
|
||||
import java.util.List;
|
||||
@@ -40,12 +56,12 @@ public class HotelSummaryRepository {
|
||||
StringBuilder queryString = new StringBuilder(FIND_BY_CITY_QUERY);
|
||||
applySorting(queryString, pageable == null ? null : pageable.getSort());
|
||||
|
||||
Query query = entityManager.createQuery(queryString.toString());
|
||||
Query query = this.entityManager.createQuery(queryString.toString());
|
||||
query.setParameter(1, city);
|
||||
query.setFirstResult(pageable.getOffset());
|
||||
query.setMaxResults(pageable.getPageSize());
|
||||
|
||||
Query countQuery = entityManager.createQuery(FIND_BY_CITY_COUNT_QUERY);
|
||||
Query countQuery = this.entityManager.createQuery(FIND_BY_CITY_COUNT_QUERY);
|
||||
countQuery.setParameter(1, city);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@@ -58,7 +74,7 @@ public class HotelSummaryRepository {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<RatingCount> findRatingCounts(Hotel hotel) {
|
||||
Query query = entityManager.createQuery(FIND_RATING_COUNTS_QUERY);
|
||||
Query query = this.entityManager.createQuery(FIND_RATING_COUNTS_QUERY);
|
||||
query.setParameter(1, hotel);
|
||||
return query.getResultList();
|
||||
}
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.data.domain.repository;
|
||||
|
||||
import org.springframework.bootstrap.sample.data.domain.Hotel;
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.data.service;
|
||||
|
||||
import java.io.Serializable;
|
||||
@@ -19,7 +35,7 @@ public class CitySearchCriteria implements Serializable {
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.data.service;
|
||||
|
||||
import org.springframework.bootstrap.sample.data.domain.City;
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.data.service;
|
||||
|
||||
import org.springframework.bootstrap.sample.data.domain.City;
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.data.service;
|
||||
|
||||
import org.springframework.bootstrap.sample.data.domain.Rating;
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.data.service.impl;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.data.service.impl;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.data.web;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -15,6 +31,6 @@ public class SampleController {
|
||||
@RequestMapping("/")
|
||||
@ResponseBody
|
||||
public String helloWorld() {
|
||||
return cityService.getCity("Bath", "UK").getName();
|
||||
return this.cityService.getCity("Bath", "UK").getName();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.consumer;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.consumer;
|
||||
|
||||
import org.springframework.bootstrap.SpringApplication;
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.consumer;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.consumer;
|
||||
|
||||
import org.springframework.bootstrap.context.annotation.ConfigurationProperties;
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.jetty;
|
||||
|
||||
import org.springframework.bootstrap.SpringApplication;
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.jetty.service;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@@ -10,7 +26,7 @@ public class HelloWorldService {
|
||||
private String name;
|
||||
|
||||
public String getHelloMessage() {
|
||||
return "Hello " + name;
|
||||
return "Hello " + this.name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.jetty.web;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -15,6 +31,6 @@ public class SampleController {
|
||||
@RequestMapping("/")
|
||||
@ResponseBody
|
||||
public String helloWorld() {
|
||||
return helloWorldService.getHelloMessage();
|
||||
return this.helloWorldService.getHelloMessage();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.simple;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.simple.service;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@@ -13,7 +29,7 @@ public class GoodbyeWorldService implements MessageService {
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "Goodbye " + name;
|
||||
return "Goodbye " + this.name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.simple.service;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@@ -13,7 +29,7 @@ public class HelloWorldService implements MessageService {
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "Hello " + name;
|
||||
return "Hello " + this.name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,14 +13,14 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.simple.service;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public interface MessageService {
|
||||
|
||||
String getMessage();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.simple;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.simple.service;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@@ -10,7 +26,7 @@ public class HelloWorldService {
|
||||
private String name;
|
||||
|
||||
public String getHelloMessage() {
|
||||
return "Hello " + name;
|
||||
return "Hello " + this.name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.tomcat;
|
||||
|
||||
import org.springframework.bootstrap.SpringApplication;
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.tomcat.service;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@@ -10,7 +26,7 @@ public class HelloWorldService {
|
||||
private String name;
|
||||
|
||||
public String getHelloMessage() {
|
||||
return "Hello " + name;
|
||||
return "Hello " + this.name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.tomcat.web;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -15,6 +31,6 @@ public class SampleController {
|
||||
@RequestMapping("/")
|
||||
@ResponseBody
|
||||
public String helloWorld() {
|
||||
return helloWorldService.getHelloMessage();
|
||||
return this.helloWorldService.getHelloMessage();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.trad;
|
||||
|
||||
import org.springframework.bootstrap.SpringApplication;
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.trad.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.ui;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@@ -21,7 +22,6 @@ import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class InMemoryMessageRespository implements MessageRepository {
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.ui;
|
||||
|
||||
import java.util.Calendar;
|
||||
@@ -17,9 +18,7 @@ import java.util.Calendar;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Rob Winch
|
||||
*
|
||||
*/
|
||||
public class Message {
|
||||
|
||||
|
||||
@@ -10,12 +10,11 @@
|
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.ui;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Rob Winch
|
||||
*
|
||||
*/
|
||||
public interface MessageRepository {
|
||||
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.ui;
|
||||
|
||||
import org.springframework.bootstrap.SpringApplication;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.ui.mvc;
|
||||
|
||||
import javax.validation.Valid;
|
||||
@@ -27,56 +28,42 @@ import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Rob Winch
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/")
|
||||
public class MessageController {
|
||||
private MessageRepository messageRepository;
|
||||
private MessageRepository messageRepository;
|
||||
|
||||
@Autowired
|
||||
public MessageController(MessageRepository messageRepository) {
|
||||
this.messageRepository = messageRepository;
|
||||
}
|
||||
@Autowired
|
||||
public MessageController(MessageRepository messageRepository) {
|
||||
this.messageRepository = messageRepository;
|
||||
}
|
||||
|
||||
@RequestMapping
|
||||
public ModelAndView list() {
|
||||
Iterable<Message> messages = messageRepository.findAll();
|
||||
return new ModelAndView("messages/list", "messages", messages);
|
||||
}
|
||||
@RequestMapping
|
||||
public ModelAndView list() {
|
||||
Iterable<Message> messages = this.messageRepository.findAll();
|
||||
return new ModelAndView("messages/list", "messages", messages);
|
||||
}
|
||||
|
||||
@RequestMapping("{id}")
|
||||
public ModelAndView view(@PathVariable("id")
|
||||
Message message) {
|
||||
return new ModelAndView("messages/view", "message", message);
|
||||
}
|
||||
@RequestMapping("{id}")
|
||||
public ModelAndView view(@PathVariable("id") Message message) {
|
||||
return new ModelAndView("messages/view", "message", message);
|
||||
}
|
||||
|
||||
@RequestMapping(params = "form", method = RequestMethod.GET)
|
||||
public String createForm(@ModelAttribute
|
||||
Message message) {
|
||||
return "messages/form";
|
||||
}
|
||||
@RequestMapping(params = "form", method = RequestMethod.GET)
|
||||
public String createForm(@ModelAttribute Message message) {
|
||||
return "messages/form";
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST)
|
||||
public ModelAndView create(@Valid
|
||||
Message message, BindingResult result, RedirectAttributes redirect) {
|
||||
if (result.hasErrors()) {
|
||||
return new ModelAndView("messages/form", "formErrors",
|
||||
result.getAllErrors());
|
||||
}
|
||||
message = messageRepository.save(message);
|
||||
redirect.addFlashAttribute("globalMessage",
|
||||
"Successfully created a new message");
|
||||
return new ModelAndView("redirect:/{message.id}",
|
||||
"message.id", message.getId());
|
||||
}
|
||||
@RequestMapping(method = RequestMethod.POST)
|
||||
public ModelAndView create(@Valid Message message, BindingResult result,
|
||||
RedirectAttributes redirect) {
|
||||
if (result.hasErrors()) {
|
||||
return new ModelAndView("messages/form", "formErrors", result.getAllErrors());
|
||||
}
|
||||
message = this.messageRepository.save(message);
|
||||
redirect.addFlashAttribute("globalMessage", "Successfully created a new message");
|
||||
return new ModelAndView("redirect:/{message.id}", "message.id", message.getId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.xml;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.sample.xml.service;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@@ -10,7 +26,7 @@ public class HelloWorldService {
|
||||
private String name;
|
||||
|
||||
public String getHelloMessage() {
|
||||
return "Hello " + name;
|
||||
return "Hello " + this.name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -38,12 +38,12 @@ abstract class Banner {
|
||||
* @param printStream the output print stream
|
||||
*/
|
||||
public static void write(PrintStream printStream) {
|
||||
System.out.println();
|
||||
printStream.println();
|
||||
for (String line : BANNER) {
|
||||
printStream.println(line);
|
||||
}
|
||||
System.out.println();
|
||||
System.out.println();
|
||||
printStream.println();
|
||||
printStream.println();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,14 +13,23 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
* Interface used to generate an 'exit code' from a running command line
|
||||
* {@link SpringApplication}.
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @see SpringApplication#exit(org.springframework.context.ApplicationContext,
|
||||
* ExitCodeGenerator...)
|
||||
*/
|
||||
public interface ExitCodeGenerator {
|
||||
|
||||
/**
|
||||
* Returns the exit code that should be returned from the application.
|
||||
* @return the exit code.
|
||||
*/
|
||||
int getExitCode();
|
||||
|
||||
}
|
||||
|
||||
@@ -42,15 +42,15 @@ public class BatchAutoConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean({ CommandLineRunner.class })
|
||||
@ConditionalOnBean({ JobLauncher.class })
|
||||
@ConditionalOnMissingBean(CommandLineRunner.class)
|
||||
@ConditionalOnBean(JobLauncher.class)
|
||||
public JobLauncherCommandLineRunner jobLauncherCommandLineRunner() {
|
||||
return new JobLauncherCommandLineRunner();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean({ ExitCodeGenerator.class })
|
||||
@ConditionalOnBean({ JobLauncher.class })
|
||||
@ConditionalOnMissingBean(ExitCodeGenerator.class)
|
||||
@ConditionalOnBean(JobLauncher.class)
|
||||
public ExitCodeGenerator jobExecutionExitCodeGenerator() {
|
||||
return new JobExecutionExitCodeGenerator();
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.autoconfigure.batch;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
@@ -30,7 +31,6 @@ import org.springframework.stereotype.Component;
|
||||
* Initialize the Spring Batch schema (ignoring errors, so should be idempotent).
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
public class BatchDatabaseInitializer {
|
||||
@@ -57,4 +57,4 @@ public class BatchDatabaseInitializer {
|
||||
populator.setContinueOnError(true);
|
||||
DatabasePopulatorUtils.execute(populator, this.dataSource);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,14 +13,16 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.autoconfigure.batch;
|
||||
|
||||
import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
* Spring {@link ApplicationEvent} encapsulating a {@link JobExecution}.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*/
|
||||
public class JobExecutionEvent extends ApplicationEvent {
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.autoconfigure.batch;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -23,8 +24,9 @@ import org.springframework.bootstrap.ExitCodeGenerator;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
* {@link ExitCodeGenerator} for {@link JobExecutionEvent}s.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*/
|
||||
public class JobExecutionExitCodeGenerator implements
|
||||
ApplicationListener<JobExecutionEvent>, ExitCodeGenerator {
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.autoconfigure.batch;
|
||||
|
||||
import java.util.Arrays;
|
||||
@@ -35,6 +36,11 @@ import org.springframework.context.ApplicationEventPublisherAware;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* {@link CommandLineRunner} to {@link JobLauncher launch} Spring Batch jobs.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*/
|
||||
@Component
|
||||
public class JobLauncherCommandLineRunner implements CommandLineRunner,
|
||||
ApplicationEventPublisherAware {
|
||||
@@ -72,4 +78,4 @@ public class JobLauncherCommandLineRunner implements CommandLineRunner,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.autoconfigure.jdbc;
|
||||
|
||||
import org.springframework.beans.factory.BeanCreationException;
|
||||
@@ -24,7 +25,6 @@ import org.springframework.util.StringUtils;
|
||||
* Base class for configuration of a database pool.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class AbstractDataSourceConfiguration {
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.autoconfigure.jdbc;
|
||||
|
||||
import java.sql.SQLException;
|
||||
@@ -32,17 +33,18 @@ import org.springframework.dao.DataAccessResourceFailureException;
|
||||
* recommended in high volume environments (the Tomcat DataSource is more reliable).
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
public class BasicDataSourceConfiguration extends AbstractDataSourceConfiguration {
|
||||
|
||||
private static Log logger = LogFactory.getLog(BasicDataSourceConfiguration.class);
|
||||
|
||||
private BasicDataSource pool;
|
||||
|
||||
@Bean
|
||||
public DataSource dataSource() {
|
||||
logger.info("Hint: using Commons DBCP BasicDataSource. It's going to work, but the Tomcat DataSource is more reliable.");
|
||||
logger.info("Hint: using Commons DBCP BasicDataSource. It's going to work, "
|
||||
+ "but the Tomcat DataSource is more reliable.");
|
||||
this.pool = new BasicDataSource();
|
||||
this.pool.setDriverClassName(getDriverClassName());
|
||||
this.pool.setUrl(getUrl());
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.autoconfigure.jdbc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -30,6 +31,7 @@ import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.bootstrap.context.annotation.ConditionLogUtils;
|
||||
import org.springframework.bootstrap.context.annotation.ConditionalOnClass;
|
||||
import org.springframework.bootstrap.context.annotation.ConditionalOnMissingBean;
|
||||
import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Condition;
|
||||
@@ -50,14 +52,17 @@ import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for {@link DataSource}.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnClass(EmbeddedDatabaseType.class /* Spring JDBC */)
|
||||
// @ConditionalOnMissingBean(DataSource.class)
|
||||
public class DataSourceAutoConfiguration {
|
||||
|
||||
// FIXME see above
|
||||
|
||||
private static Log logger = LogFactory.getLog(DataSourceAutoConfiguration.class);
|
||||
|
||||
@Autowired(required = false)
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.autoconfigure.jdbc;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
@@ -21,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.bootstrap.context.annotation.ConditionalOnBean;
|
||||
import org.springframework.bootstrap.context.annotation.ConditionalOnClass;
|
||||
import org.springframework.bootstrap.context.annotation.ConditionalOnMissingBean;
|
||||
import org.springframework.bootstrap.context.annotation.EnableAutoConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.Ordered;
|
||||
@@ -29,8 +31,10 @@ import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for
|
||||
* {@link DataSourceTransactionManager}.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnClass({ JdbcTemplate.class, PlatformTransactionManager.class })
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.autoconfigure.jdbc;
|
||||
|
||||
import javax.annotation.PreDestroy;
|
||||
@@ -26,7 +27,6 @@ import org.springframework.context.annotation.Configuration;
|
||||
* and tends not to deadlock in high volume environments.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
public class TomcatDataSourceConfiguration extends AbstractDataSourceConfiguration {
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.autoconfigure.orm.jpa;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -46,12 +47,10 @@ import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Helper to detect a component scan declared in the enclosing context (normally on a
|
||||
* <code>@Configuration</code> class). Once the component scan is detected, the base
|
||||
* packages are stored for retrieval later by the {@link JpaRepositoriesAutoConfiguration}
|
||||
* .
|
||||
* {@code @Configuration} class). Once the component scan is detected, the base packages
|
||||
* are stored for retrieval later by the {@link JpaRepositoriesAutoConfiguration} .
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
class JpaComponentScanDetector implements ImportBeanDefinitionRegistrar, BeanFactoryAware {
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.autoconfigure.web;
|
||||
|
||||
import javax.servlet.Servlet;
|
||||
@@ -36,7 +37,6 @@ import org.springframework.core.type.AnnotationMetadata;
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class EmbeddedContainerConfiguration implements ImportSelector {
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.autoconfigure.web;
|
||||
|
||||
import org.apache.catalina.valves.AccessLogValve;
|
||||
@@ -31,8 +32,11 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
* {@link EmbeddedServletContainerCustomizer} that configures the
|
||||
* {@link ConfigurableEmbeddedServletContainerFactory} from a {@link ServerProperties}
|
||||
* bean.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*/
|
||||
@Configuration
|
||||
@EnableConfigurationProperties
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.bootstrap.bind;
|
||||
|
||||
import java.beans.PropertyEditor;
|
||||
@@ -21,8 +22,9 @@ import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
* {@link PropertyEditor} for {@link InetAddress} objects.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*/
|
||||
public class InetAddressEditor extends PropertyEditorSupport implements PropertyEditor {
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ import org.springframework.beans.factory.FactoryBean;
|
||||
* one: two
|
||||
* three: four
|
||||
*
|
||||
* <pre>
|
||||
* </pre>
|
||||
*
|
||||
* plus (later in the list)
|
||||
*
|
||||
@@ -47,7 +47,7 @@ import org.springframework.beans.factory.FactoryBean;
|
||||
* one: 2
|
||||
* five: six
|
||||
*
|
||||
* <pre>
|
||||
* </pre>
|
||||
*
|
||||
* results in an effecive input of
|
||||
*
|
||||
@@ -58,13 +58,12 @@ import org.springframework.beans.factory.FactoryBean;
|
||||
* three: four
|
||||
* five: six
|
||||
*
|
||||
* <pre>
|
||||
* </pre>
|
||||
*
|
||||
* Note that the value of "foo" in the first document is not simply replaced with the value in the second, but its nested values are merged.
|
||||
* Note that the value of "foo" in the first document is not simply replaced with the
|
||||
* value in the second, but its nested values are merged.
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @since 3.2
|
||||
*
|
||||
*/
|
||||
public class YamlMapFactoryBean extends YamlProcessor implements
|
||||
FactoryBean<Map<String, Object>> {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user