Relocate projects to spring-boot-project

Move projects to better reflect the way that Spring Boot is released.

The following projects are under `spring-boot-project`:

  - `spring-boot`
  - `spring-boot-autoconfigure`
  - `spring-boot-tools`
  - `spring-boot-starters`
  - `spring-boot-actuator`
  - `spring-boot-actuator-autoconfigure`
  - `spring-boot-test`
  - `spring-boot-test-autoconfigure`
  - `spring-boot-devtools`
  - `spring-boot-cli`
  - `spring-boot-docs`

See gh-9316
This commit is contained in:
Phillip Webb
2017-09-19 14:29:46 -07:00
parent 0419d42b7c
commit 0ba4830b4f
4023 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
package org.test
@Grab("spring-boot-starter-actuator")
@RestController
class SampleController {
@RequestMapping("/")
public def hello() {
[message: "Hello World!"]
}
}

View File

@@ -0,0 +1,23 @@
package org.test
@Component
class Example implements CommandLineRunner {
@Autowired
private MyService myService
void run(String... args) {
println "Hello ${this.myService.sayWorld()} From ${getClass().getClassLoader().getResource('samples/app.groovy')}"
}
}
@Service
class MyService {
String sayWorld() {
return "World!"
}
}

View File

@@ -0,0 +1,15 @@
@RestController
class Application {
@Autowired
String foo
@RequestMapping("/")
String home() {
"Hello ${foo}!"
}
}
beans {
foo String, "World"
}

View File

@@ -0,0 +1,47 @@
package org.test
import java.util.concurrent.atomic.AtomicLong
@Configuration
@EnableCaching
class Sample {
@Bean CacheManager cacheManager() {
new ConcurrentMapCacheManager()
}
@Component
static class MyClient implements CommandLineRunner {
private final MyService myService
@Autowired
MyClient(MyService myService) {
this.myService = myService
}
void run(String... args) {
long counter = myService.get('someKey')
long counter2 = myService.get('someKey')
if (counter == counter2) {
println 'Hello World'
} else {
println 'Something went wrong with the cache setup'
}
}
}
@Component
static class MyService {
private final AtomicLong counter = new AtomicLong()
@Cacheable('foo')
Long get(String id) {
return counter.getAndIncrement()
}
}
}

View File

@@ -0,0 +1,21 @@
package org.test
@Controller
@EnableDeviceResolver
class Example {
@RequestMapping("/")
@ResponseBody
String helloWorld(Device device) {
if (device.isNormal()) {
"Hello Normal Device!"
} else if (device.isMobile()) {
"Hello Mobile Device!"
} else if (device.isTablet()) {
"Hello Tablet Device!"
} else {
"Hello Unknown Device!"
}
}
}

View File

@@ -0,0 +1,24 @@
package org.test
@Grab("org.codehaus.groovy.modules.http-builder:http-builder:0.5.2") // This one just to test dependency resolution
import groovyx.net.http.*
@Controller
class Example implements CommandLineRunner {
@Autowired
ApplicationContext context;
@RequestMapping("/")
@ResponseBody
public String helloWorld() {
return "World!"
}
void run(String... args) {
def port = context.webServer.port;
def world = new RESTClient("http://localhost:" + port).get(path:"/").data.text
print "Hello " + world
}
}

View File

@@ -0,0 +1,39 @@
package org.test
@Configuration
@EnableIntegration
class SpringIntegrationExample implements CommandLineRunner {
@Autowired
private ApplicationContext context;
@Bean
DirectChannel input() {
new DirectChannel();
}
@Override
void run(String... args) {
println()
println '>>>> ' + new MessagingTemplate(input()).convertSendAndReceive("World", String) + ' <<<<'
println()
/*
* Since this is a simple application that we want to exit right away,
* close the context. For an active integration application, with pollers
* etc, you can either suspend the main thread here (e.g. with System.in.read()),
* or exit the run() method without closing the context, and stop the
* application later using some other technique (kill, JMX etc).
*/
context.close()
}
}
@MessageEndpoint
class HelloTransformer {
@Transformer(inputChannel="input")
String transform(String payload) {
"Hello, ${payload}"
}
}

View File

@@ -0,0 +1,33 @@
package org.test
@Grab("spring-boot-starter-artemis")
@Grab("artemis-jms-server")
import java.util.concurrent.CountDownLatch
@Log
@Configuration
@EnableJms
class JmsExample implements CommandLineRunner {
private CountDownLatch latch = new CountDownLatch(1)
@Autowired
JmsTemplate jmsTemplate
void run(String... args) {
def messageCreator = { session ->
session.createObjectMessage("Greetings from Spring Boot via Artemis")
} as MessageCreator
log.info "Sending JMS message..."
jmsTemplate.send("spring-boot", messageCreator)
log.info "Send JMS message, waiting..."
latch.await()
}
@JmsListener(destination = 'spring-boot')
def receive(String message) {
log.info "Received ${message}"
latch.countDown()
}
}

View File

@@ -0,0 +1,33 @@
package org.test
@Grab("hsqldb")
@Configuration
@EnableBatchProcessing
class JobConfig {
@Autowired
private JobBuilderFactory jobs
@Autowired
private StepBuilderFactory steps
@Bean
protected Tasklet tasklet() {
return new Tasklet() {
@Override
RepeatStatus execute(StepContribution contribution, ChunkContext context) {
return RepeatStatus.FINISHED
}
}
}
@Bean
Job job() throws Exception {
return jobs.get("job").start(step1()).build()
}
@Bean
protected Step step1() throws Exception {
return steps.get("step1").tasklet(tasklet()).build()
}
}

View File

@@ -0,0 +1,32 @@
package org.test
import java.util.concurrent.CountDownLatch
@Log
@Configuration
@EnableRabbit
class RabbitExample implements CommandLineRunner {
private CountDownLatch latch = new CountDownLatch(1)
@Autowired
RabbitTemplate rabbitTemplate
void run(String... args) {
log.info "Sending RabbitMQ message..."
rabbitTemplate.convertAndSend("spring-boot", "Greetings from Spring Boot via RabbitMQ")
latch.await()
}
@RabbitListener(queues = 'spring-boot')
def receive(String message) {
log.info "Received ${message}"
latch.countDown()
}
@Bean
Queue queue() {
new Queue("spring-boot", false)
}
}

View File

@@ -0,0 +1,28 @@
package org.test
@EnableRetry
@Component
class Example implements CommandLineRunner {
@Autowired
private MyService myService
void run(String... args) {
println "Hello ${this.myService.sayWorld()} From ${getClass().getClassLoader().getResource('samples/retry.groovy')}"
}
}
@Service
class MyService {
static int count = 0
@Retryable
String sayWorld() {
if (count++==0) {
throw new IllegalStateException("Planned")
}
return "World!"
}
}

View File

@@ -0,0 +1,8 @@
package org.test
class Runner implements CommandLineRunner {
void run(String... args) {
print "Hello World!"
}
}

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="runner" class="org.test.Runner"/>
</beans>

View File

@@ -0,0 +1,13 @@
package org.test
@Grab("spring-boot-starter-security")
@Grab("spring-boot-starter-actuator")
@RestController
class SampleController {
@RequestMapping("/")
public def hello() {
[message: "Hello World!"]
}
}

View File

@@ -0,0 +1,24 @@
package org.test
import static org.springframework.boot.groovy.GroovyTemplate.*;
@Component
class Example implements CommandLineRunner {
@Autowired
private MyService myService
@Override
void run(String... args) {
print template("test.txt", ["message":myService.sayWorld()])
}
}
@Service
class MyService {
String sayWorld() {
return "World"
}
}

View File

@@ -0,0 +1,17 @@
package org.test
@Grab("hsqldb")
@Configuration
@EnableTransactionManagement
class Example implements CommandLineRunner {
@Autowired
JdbcTemplate jdbcTemplate
@Transactional
void run(String... args) {
println "Foo count=" + jdbcTemplate.queryForObject("SELECT COUNT(*) from FOO", Integer)
}
}

View File

@@ -0,0 +1,33 @@
package app
@Grab("thymeleaf-spring5")
@Controller
class Example {
@RequestMapping("/")
public String helloWorld(Map<String,Object> model) {
model.putAll([title: "My Page", date: new Date(), message: "Hello World"])
return "home";
}
}
@Configuration
@Log
class MvcConfiguration extends WebMvcConfigurerAdapter {
@Override
void addInterceptors(InterceptorRegistry registry) {
log.info "Registering interceptor"
registry.addInterceptor(interceptor())
}
@Bean
HandlerInterceptor interceptor() {
log.info "Creating interceptor"
[
postHandle: { request, response, handler, mav ->
log.info "Intercepted: model=" + mav.model
}
] as HandlerInterceptorAdapter
}
}

View File

@@ -0,0 +1,21 @@
@Controller
class Example {
@Autowired
private MyService myService;
@RequestMapping("/")
@ResponseBody
public String helloWorld() {
return myService.sayWorld();
}
}
@Service
class MyService {
public String sayWorld() {
return "World!";
}
}