Upgrade to Spring Boot 1.4.0.RELEASE

This commit upgrades to Spring Boot 1.4.0.RELEASE and bumps to Java8. It
also migrate the cache library from Guava to Caffeeine.

The git and build information are now exposed via the `info` endpoint.

Closes gh-251
This commit is contained in:
Stephane Nicoll
2016-06-09 13:17:31 +02:00
parent d018782726
commit af2ae44b8d
11 changed files with 69 additions and 137 deletions

View File

@@ -18,7 +18,7 @@ package io.spring.initializr.web.autoconfigure
import java.util.concurrent.TimeUnit
import com.google.common.cache.CacheBuilder
import com.github.benmanes.caffeine.cache.Caffeine
import io.spring.initializr.generator.ProjectGenerator
import io.spring.initializr.generator.ProjectRequestPostProcessor
import io.spring.initializr.generator.ProjectRequestResolver
@@ -35,8 +35,10 @@ import io.spring.initializr.web.ui.UiController
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.cache.Cache
import org.springframework.cache.CacheManager
import org.springframework.cache.annotation.EnableCaching
import org.springframework.cache.caffeine.CaffeineCache
import org.springframework.cache.concurrent.ConcurrentMapCache
import org.springframework.cache.support.SimpleCacheManager
import org.springframework.context.annotation.Bean
@@ -121,12 +123,11 @@ class InitializrAutoConfiguration {
cacheManager
}
private static ConcurrentMapCache createConcurrentMapCache(Long timeToLive, String name) {
def cacheBuilder = CacheBuilder.newBuilder()
private static Cache createConcurrentMapCache(Long timeToLive, String name) {
new CaffeineCache(name, Caffeine
.newBuilder()
.expireAfterWrite(timeToLive, TimeUnit.SECONDS)
def map = cacheBuilder.build().asMap()
new ConcurrentMapCache(name, map, false)
.build())
}
}

View File

@@ -32,10 +32,9 @@ import org.junit.runner.RunWith
import org.skyscreamer.jsonassert.JSONAssert
import org.skyscreamer.jsonassert.JSONCompareMode
import org.springframework.beans.factory.annotation.Value
import org.springframework.boot.autoconfigure.EnableAutoConfiguration
import org.springframework.boot.test.IntegrationTest
import org.springframework.boot.test.SpringApplicationConfiguration
import org.springframework.boot.context.embedded.LocalServerPort
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.context.annotation.Bean
import org.springframework.core.io.ClassPathResource
import org.springframework.http.HttpEntity
@@ -43,20 +42,18 @@ import org.springframework.http.HttpHeaders
import org.springframework.http.HttpMethod
import org.springframework.http.MediaType
import org.springframework.http.ResponseEntity
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner
import org.springframework.test.context.web.WebAppConfiguration
import org.springframework.test.context.junit4.SpringRunner
import org.springframework.util.StreamUtils
import org.springframework.web.client.RestTemplate
import static org.junit.Assert.assertTrue
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT
/**
* @author Stephane Nicoll
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = Config.class)
@WebAppConfiguration
@IntegrationTest('server.port=0')
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Config.class, webEnvironment = RANDOM_PORT)
abstract class AbstractInitializrControllerIntegrationTests {
static final MediaType CURRENT_METADATA_MEDIA_TYPE = InitializrMetadataVersion.V2_1.mediaType
@@ -65,7 +62,7 @@ abstract class AbstractInitializrControllerIntegrationTests {
@Rule
public final TemporaryFolder folder = new TemporaryFolder()
@Value('${local.server.port}')
@LocalServerPort
protected int port
final RestTemplate restTemplate = new RestTemplate()

View File

@@ -7,14 +7,14 @@ import io.spring.initializr.metadata.InitializrMetadata
import io.spring.initializr.web.AbstractInitializrControllerIntegrationTests
import org.junit.Test
import org.springframework.boot.test.SpringApplicationConfiguration
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.context.annotation.Import
import org.springframework.core.annotation.Order
import org.springframework.test.context.ActiveProfiles
@ActiveProfiles('test-default')
@SpringApplicationConfiguration(classes = [Config, ProjectRequestPostProcessorConfiguration])
@Import(ProjectRequestPostProcessorConfiguration)
class ProjectGenerationPostProcessorTests extends AbstractInitializrControllerIntegrationTests {