mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-05-02 07:02:48 +00:00
Remove misleading production profile
Closes gh-333
This commit is contained in:
parent
415bd73893
commit
5ff057d90b
4 changed files with 39 additions and 31 deletions
|
@ -6,14 +6,9 @@ import javax.cache.configuration.MutableConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.cache.JCacheManagerCustomizer;
|
import org.springframework.boot.autoconfigure.cache.JCacheManagerCustomizer;
|
||||||
import org.springframework.cache.annotation.EnableCaching;
|
import org.springframework.cache.annotation.EnableCaching;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Profile;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Cache could be disabled in unit test.
|
|
||||||
*/
|
|
||||||
@org.springframework.context.annotation.Configuration
|
@org.springframework.context.annotation.Configuration
|
||||||
@EnableCaching
|
@EnableCaching
|
||||||
@Profile("production")
|
|
||||||
class CacheConfig {
|
class CacheConfig {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
|
|
@ -20,6 +20,3 @@ management.endpoints.web.exposure.include=*
|
||||||
logging.level.org.springframework=INFO
|
logging.level.org.springframework=INFO
|
||||||
# logging.level.org.springframework.web=DEBUG
|
# logging.level.org.springframework.web=DEBUG
|
||||||
# logging.level.org.springframework.context.annotation=TRACE
|
# logging.level.org.springframework.context.annotation=TRACE
|
||||||
|
|
||||||
# Active Spring profiles
|
|
||||||
spring.profiles.active=production
|
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2012-2018 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.samples.petclinic;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.samples.petclinic.vet.VetRepository;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@SpringBootTest
|
||||||
|
public class PetclinicIntegrationTests {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private VetRepository vets;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFindAll() throws Exception {
|
||||||
|
vets.findAll();
|
||||||
|
vets.findAll(); // served from cache
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,23 +0,0 @@
|
||||||
package org.springframework.samples.petclinic.system;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
|
||||||
import org.springframework.samples.petclinic.vet.VetRepository;
|
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
|
||||||
|
|
||||||
@RunWith(SpringRunner.class)
|
|
||||||
@SpringBootTest
|
|
||||||
public class ProductionConfigurationTests {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private VetRepository vets;
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testFindAll() throws Exception {
|
|
||||||
vets.findAll();
|
|
||||||
vets.findAll(); // served from cache
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue