Revert some @Ignores after bugfixes in Spring

Also lifts the restriction on @RefreshScope and @Configuration
(since that was imposed by a bug).

Fixes gh-43
This commit is contained in:
Dave Syer
2014-12-03 17:19:05 +00:00
parent 3911d91e57
commit 2caf87f92e
3 changed files with 12 additions and 6 deletions

View File

@@ -291,6 +291,15 @@ target cache. There is also a `refresh(String)` method to refresh an
individual bean by name. This functionality is exposed in the
`/refresh` endpoint (over HTTP or JMX).
NOTE: `@RefreshScope` works (technically) on an `@Configuration`
class, but it might lead to surprising behaviour: e.g. it does *not*
mean that all the `@Beans` defined in that class are themselves
`@RefreshScope`. Specifically, anything that depends on those beans
cannot rely on them being updated when a refresh is initiated, unless
it is itself in `@RefreshScope` (in which it will be rebuilt on a
refresh and its dependencies re-injected, at which point they will be
re-initialized from the refreshed `@Configuration`).
=== Encryption and Decryption
The Config Client has an `Environment` pre-processor for decrypting

View File

@@ -17,7 +17,6 @@ package org.springframework.cloud.context.scope.refresh;
import static org.junit.Assert.assertEquals;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
@@ -32,7 +31,6 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@SpringApplicationConfiguration(classes = TestConfiguration.class)
@RunWith(SpringJUnit4ClassRunner.class)
@Ignore("gh-43")
public class ImportRefreshScopeIntegrationTests {
@Autowired
@@ -47,7 +45,7 @@ public class ImportRefreshScopeIntegrationTests {
@Test
public void testSimpleProperties() throws Exception {
assertEquals("Hello scope!", service.getMessage());
assertEquals("refresh", beanFactory.getBeanDefinition("service").getScope());
assertEquals("refresh", beanFactory.getBeanDefinition("scopedTarget.service").getScope());
assertEquals("Hello scope!", service.getMessage());
}

View File

@@ -18,7 +18,6 @@ package org.springframework.cloud.context.scope.refresh;
import static org.junit.Assert.assertEquals;
import org.junit.After;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
@@ -64,12 +63,11 @@ public class RefreshScopeConfigurationTests {
* See gh-43
*/
@Test
@Ignore("gh-43")
public void configurationWithRefreshScope() throws Exception {
context = new AnnotationConfigApplicationContext(Application.class,
PropertyPlaceholderAutoConfiguration.class, RefreshAutoConfiguration.class);
Application application = context.getBean(Application.class);
assertEquals("refresh", context.getBeanDefinition("application").getScope());
assertEquals("refresh", context.getBeanDefinition("scopedTarget.application").getScope());
application.hello();
refresh();
String message = application.hello();
@@ -126,6 +124,7 @@ public class RefreshScopeConfigurationTests {
@RefreshScope
protected static class Application {
@Value("${message:Hello World!}")
String message = "Hello World";
@RequestMapping("/")