mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Update samples to use @SpringBootApplication
Update the relevant samples to use the new @SpringBootApplication annotation. Closes gh-1842
This commit is contained in:
parent
68571ee535
commit
d039f43107
@ -17,15 +17,9 @@
|
||||
package sample.actuator.log4j;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@EnableConfigurationProperties
|
||||
@ComponentScan
|
||||
@SpringBootApplication
|
||||
public class SampleActuatorLog4JApplication {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
@ -17,15 +17,9 @@
|
||||
package sample.actuator.log4j2;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@EnableConfigurationProperties
|
||||
@ComponentScan
|
||||
@SpringBootApplication
|
||||
public class SampleActuatorLog4J2Application {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
@ -17,15 +17,9 @@
|
||||
package sample.actuator;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@EnableConfigurationProperties
|
||||
@ComponentScan
|
||||
@SpringBootApplication
|
||||
public class SampleActuatorNoWebApplication {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
@ -19,15 +19,9 @@ package sample.actuator;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.actuate.health.Health;
|
||||
import org.springframework.boot.actuate.health.HealthIndicator;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@EnableConfigurationProperties
|
||||
@ComponentScan
|
||||
@SpringBootApplication
|
||||
public class SampleActuatorApplication implements HealthIndicator {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
@ -22,13 +22,11 @@ import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer;
|
||||
import org.springframework.amqp.rabbit.listener.adapter.MessageListenerAdapter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor;
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@SpringBootApplication
|
||||
public class SampleAmqpSimpleApplication {
|
||||
|
||||
@Autowired
|
||||
|
@ -19,15 +19,11 @@ package sample.aop;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
import sample.aop.service.HelloWorldService;
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@ComponentScan
|
||||
@SpringBootApplication
|
||||
public class SampleAopApplication implements CommandLineRunner {
|
||||
|
||||
// Simple example shows how an application can spy on itself with AOP
|
||||
|
@ -27,14 +27,10 @@ import org.springframework.batch.core.step.tasklet.Tasklet;
|
||||
import org.springframework.batch.repeat.RepeatStatus;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@ComponentScan
|
||||
@SpringBootApplication
|
||||
@EnableBatchProcessing
|
||||
public class SampleBatchApplication {
|
||||
|
||||
|
@ -19,13 +19,9 @@ package sample.data.elasticsearch;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@ComponentScan
|
||||
@SpringBootApplication
|
||||
public class SampleElasticsearchApplication implements CommandLineRunner {
|
||||
|
||||
@Autowired
|
||||
|
@ -17,9 +17,7 @@
|
||||
package sample.data.gemfire;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.ImportResource;
|
||||
import org.springframework.data.gemfire.repository.config.EnableGemfireRepositories;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
@ -31,10 +29,8 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
*
|
||||
* @author John Blum
|
||||
*/
|
||||
@Configuration
|
||||
@SpringBootApplication
|
||||
@ImportResource("/spring-data-gemfire-cache.xml")
|
||||
@ComponentScan
|
||||
@EnableAutoConfiguration
|
||||
@EnableGemfireRepositories
|
||||
@EnableTransactionManagement
|
||||
public class SampleDataGemFireApplication {
|
||||
|
@ -17,13 +17,9 @@
|
||||
package sample.data.jpa;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@Configuration
|
||||
@ComponentScan
|
||||
@EnableAutoConfiguration
|
||||
@SpringBootApplication
|
||||
public class SampleDataJpaApplication {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
@ -19,13 +19,9 @@ package sample.data.mongo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@ComponentScan
|
||||
@SpringBootApplication
|
||||
public class SampleMongoApplication implements CommandLineRunner {
|
||||
|
||||
@Autowired
|
||||
@ -34,16 +30,16 @@ public class SampleMongoApplication implements CommandLineRunner {
|
||||
@Override
|
||||
public void run(String... args) throws Exception {
|
||||
|
||||
repository.deleteAll();
|
||||
this.repository.deleteAll();
|
||||
|
||||
// save a couple of customers
|
||||
repository.save(new Customer("Alice", "Smith"));
|
||||
repository.save(new Customer("Bob", "Smith"));
|
||||
this.repository.save(new Customer("Alice", "Smith"));
|
||||
this.repository.save(new Customer("Bob", "Smith"));
|
||||
|
||||
// fetch all customers
|
||||
System.out.println("Customers found with findAll():");
|
||||
System.out.println("-------------------------------");
|
||||
for (Customer customer : repository.findAll()) {
|
||||
for (Customer customer : this.repository.findAll()) {
|
||||
System.out.println(customer);
|
||||
}
|
||||
System.out.println();
|
||||
@ -51,11 +47,11 @@ public class SampleMongoApplication implements CommandLineRunner {
|
||||
// fetch an individual customer
|
||||
System.out.println("Customer found with findByFirstName('Alice'):");
|
||||
System.out.println("--------------------------------");
|
||||
System.out.println(repository.findByFirstName("Alice"));
|
||||
System.out.println(this.repository.findByFirstName("Alice"));
|
||||
|
||||
System.out.println("Customers found with findByLastName('Smith'):");
|
||||
System.out.println("--------------------------------");
|
||||
for (Customer customer : repository.findByLastName("Smith")) {
|
||||
for (Customer customer : this.repository.findByLastName("Smith")) {
|
||||
System.out.println(customer);
|
||||
}
|
||||
|
||||
|
@ -19,13 +19,11 @@ package sample.data.redis;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.data.redis.core.ValueOperations;
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@SpringBootApplication
|
||||
public class SampleRedisApplication implements CommandLineRunner {
|
||||
|
||||
@Autowired
|
||||
@ -33,9 +31,9 @@ public class SampleRedisApplication implements CommandLineRunner {
|
||||
|
||||
@Override
|
||||
public void run(String... args) throws Exception {
|
||||
ValueOperations<String, String> ops = template.opsForValue();
|
||||
ValueOperations<String, String> ops = this.template.opsForValue();
|
||||
String key = "spring.boot.redis.test";
|
||||
if (!template.hasKey(key)) {
|
||||
if (!this.template.hasKey(key)) {
|
||||
ops.set(key, "foo");
|
||||
}
|
||||
System.out.println("Found key " + key + ", value=" + ops.get(key));
|
||||
|
@ -17,13 +17,9 @@
|
||||
package sample.data.jpa;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@Configuration
|
||||
@ComponentScan
|
||||
@EnableAutoConfiguration
|
||||
@SpringBootApplication
|
||||
public class SampleDataRestApplication {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
@ -19,13 +19,9 @@ package sample.data.solr;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@ComponentScan
|
||||
@SpringBootApplication
|
||||
public class SampleSolrApplication implements CommandLineRunner {
|
||||
|
||||
@Autowired
|
||||
|
@ -23,15 +23,11 @@ import javax.persistence.Id;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Configuration
|
||||
@ComponentScan
|
||||
@EnableAutoConfiguration
|
||||
@SpringBootApplication
|
||||
public class SampleFlywayApplication implements CommandLineRunner {
|
||||
|
||||
@Autowired
|
||||
|
@ -23,16 +23,12 @@ import javax.jms.MessageListener;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.jms.listener.DefaultMessageListenerContainer;
|
||||
import org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor;
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@ComponentScan
|
||||
@SpringBootApplication
|
||||
public class SampleHornetQApplication {
|
||||
|
||||
@Autowired
|
||||
|
@ -17,16 +17,12 @@
|
||||
package sample.integration;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.ImportResource;
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@SpringBootApplication
|
||||
@EnableConfigurationProperties(ServiceProperties.class)
|
||||
@ComponentScan
|
||||
@ImportResource("integration-context.xml")
|
||||
public class SampleIntegrationApplication {
|
||||
|
||||
|
@ -16,13 +16,11 @@
|
||||
|
||||
package sample.jersey;
|
||||
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.context.web.SpringBootServletInitializer;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
|
||||
@ComponentScan
|
||||
@EnableAutoConfiguration
|
||||
@SpringBootApplication
|
||||
public class SampleJerseyApplication extends SpringBootServletInitializer {
|
||||
|
||||
@Override
|
||||
|
@ -20,19 +20,15 @@ import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.context.embedded.FilterRegistrationBean;
|
||||
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import com.sun.jersey.spi.container.servlet.ServletContainer;
|
||||
|
||||
@Configuration
|
||||
@ComponentScan
|
||||
@EnableAutoConfiguration
|
||||
@SpringBootApplication
|
||||
@Path("/")
|
||||
public class SampleJersey1Application {
|
||||
|
||||
|
@ -17,13 +17,9 @@
|
||||
package sample.jetty;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@ComponentScan
|
||||
@SpringBootApplication
|
||||
public class SampleJettyApplication {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
@ -17,13 +17,9 @@
|
||||
package sample.jetty;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@ComponentScan
|
||||
@SpringBootApplication
|
||||
public class SampleJetty8Application {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
@ -19,14 +19,10 @@ package sample.atomikos;
|
||||
import java.io.Closeable;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@ComponentScan
|
||||
@EnableAutoConfiguration
|
||||
@SpringBootApplication
|
||||
public class SampleAtomikosApplication {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
@ -19,14 +19,10 @@ package sample.bitronix;
|
||||
import java.io.Closeable;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@ComponentScan
|
||||
@EnableAutoConfiguration
|
||||
@SpringBootApplication
|
||||
public class SampleBitronixApplication {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
@ -16,13 +16,9 @@
|
||||
|
||||
package sample.jndi;
|
||||
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@ComponentScan
|
||||
@SpringBootApplication
|
||||
public class SampleJndiApplication {
|
||||
|
||||
}
|
||||
|
@ -17,13 +17,9 @@
|
||||
package sample.liquibase;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@Configuration
|
||||
@ComponentScan
|
||||
@EnableAutoConfiguration
|
||||
@SpringBootApplication
|
||||
public class SampleLiquibaseApplication {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
@ -17,16 +17,13 @@
|
||||
package sample.parent;
|
||||
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.ImportResource;
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@SpringBootApplication
|
||||
@EnableConfigurationProperties(ServiceProperties.class)
|
||||
@ComponentScan
|
||||
public class SampleParentContextApplication {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
@ -19,15 +19,11 @@ package sample.profile;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
import sample.profile.service.MessageService;
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@ComponentScan
|
||||
@SpringBootApplication
|
||||
public class SampleProfileApplication implements CommandLineRunner {
|
||||
|
||||
// Simple example shows how a command line spring application can execute an
|
||||
|
@ -19,15 +19,11 @@ package sample.simple;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
import sample.simple.service.HelloWorldService;
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@ComponentScan
|
||||
@SpringBootApplication
|
||||
public class SampleSimpleApplication implements CommandLineRunner {
|
||||
|
||||
// Simple example shows how a command line spring application can execute an
|
||||
|
@ -17,15 +17,11 @@
|
||||
package sample.jsp;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.context.web.SpringBootServletInitializer;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@ComponentScan
|
||||
@SpringBootApplication
|
||||
public class SampleTomcatJspApplication extends SpringBootServletInitializer {
|
||||
|
||||
@Override
|
||||
|
@ -23,12 +23,10 @@ import java.io.IOException;
|
||||
import org.apache.catalina.connector.Connector;
|
||||
import org.apache.coyote.http11.Http11NioProtocol;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory;
|
||||
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
import org.springframework.util.SocketUtils;
|
||||
@ -38,9 +36,7 @@ import org.springframework.util.SocketUtils;
|
||||
*
|
||||
* @author Brock Mills
|
||||
*/
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@ComponentScan
|
||||
@SpringBootApplication
|
||||
public class SampleTomcatTwoConnectorsApplication {
|
||||
|
||||
@Bean
|
||||
|
@ -17,15 +17,9 @@
|
||||
package sample.tomcat;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@ComponentScan
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@EnableConfigurationProperties
|
||||
@SpringBootApplication
|
||||
public class SampleTomcatSslApplication {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
@ -22,14 +22,10 @@ import javax.servlet.ServletContextListener;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@ComponentScan
|
||||
@SpringBootApplication
|
||||
public class SampleTomcatApplication {
|
||||
|
||||
private static Log logger = LogFactory.getLog(SampleTomcatApplication.class);
|
||||
|
@ -17,15 +17,11 @@
|
||||
package sample.jsp;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.context.web.SpringBootServletInitializer;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@ComponentScan
|
||||
@SpringBootApplication
|
||||
public class SampleTomcat7JspApplication extends SpringBootServletInitializer {
|
||||
|
||||
@Override
|
||||
|
@ -17,13 +17,9 @@
|
||||
package sample.traditional;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@ComponentScan
|
||||
@SpringBootApplication
|
||||
public class SampleTraditionalApplication {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
@ -25,14 +25,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.ui.velocity.VelocityEngineUtils;
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@ComponentScan
|
||||
@SpringBootApplication
|
||||
public class SampleVelocityApplication implements CommandLineRunner {
|
||||
|
||||
@Value("${application.message}")
|
||||
|
@ -17,13 +17,9 @@
|
||||
package sample.freemarker;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@ComponentScan
|
||||
@SpringBootApplication
|
||||
public class SampleWebFreeMarkerApplication {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
@ -17,15 +17,11 @@
|
||||
package sample.ui;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.convert.converter.Converter;
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@ComponentScan
|
||||
@SpringBootApplication
|
||||
public class SampleGroovyTemplateApplication {
|
||||
|
||||
@Bean
|
||||
|
@ -17,15 +17,11 @@
|
||||
package sample.jsp;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.context.web.SpringBootServletInitializer;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@ComponentScan
|
||||
@SpringBootApplication
|
||||
public class SampleWebJspApplication extends SpringBootServletInitializer {
|
||||
|
||||
@Override
|
||||
|
@ -17,13 +17,11 @@
|
||||
package sample.ui;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.context.web.SpringBootServletInitializer;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@SpringBootApplication
|
||||
public class SampleWebStaticApplication extends SpringBootServletInitializer {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
@ -17,15 +17,11 @@
|
||||
package sample.ui;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.convert.converter.Converter;
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@ComponentScan
|
||||
@SpringBootApplication
|
||||
public class SampleWebUiApplication {
|
||||
|
||||
@Bean
|
||||
|
@ -17,13 +17,9 @@
|
||||
package sample.velocity;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@ComponentScan
|
||||
@SpringBootApplication
|
||||
public class SampleWebVelocityApplication {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
@ -17,11 +17,10 @@
|
||||
package samples.websocket.config;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.context.web.SpringBootServletInitializer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.socket.WebSocketHandler;
|
||||
import org.springframework.web.socket.config.annotation.EnableWebSocket;
|
||||
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
|
||||
@ -35,8 +34,7 @@ import samples.websocket.echo.EchoService;
|
||||
import samples.websocket.echo.EchoWebSocketHandler;
|
||||
import samples.websocket.snake.SnakeWebSocketHandler;
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@SpringBootApplication
|
||||
@EnableWebSocket
|
||||
public class SampleWebSocketsApplication extends SpringBootServletInitializer implements
|
||||
WebSocketConfigurer {
|
||||
|
@ -17,13 +17,9 @@
|
||||
package sample.ws;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@Configuration
|
||||
@EnableAutoConfiguration
|
||||
@ComponentScan
|
||||
@SpringBootApplication
|
||||
public class SampleWsApplication {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
Loading…
Reference in New Issue
Block a user