Polishing

This commit is contained in:
Juergen Hoeller
2016-12-01 14:13:23 +01:00
parent f16d453805
commit 5fee5f39ea
14 changed files with 95 additions and 85 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2016 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.
@@ -27,12 +27,12 @@ import org.springframework.core.convert.support.GenericConversionService;
/**
* A factory providing convenient access to a ConversionService configured with
* converters appropriate for most environments. Set the {@link #setConverters
* "converters"} property to supplement the default converters.
* converters appropriate for most environments. Set the
* {@link #setConverters "converters"} property to supplement the default converters.
*
* <p>This implementation creates a {@link DefaultConversionService}. Subclasses
* may override {@link #createConversionService()} in order to return a
* {@link GenericConversionService} instance of their choosing.
* <p>This implementation creates a {@link DefaultConversionService}.
* Subclasses may override {@link #createConversionService()} in order to return
* a {@link GenericConversionService} instance of their choosing.
*
* <p>Like all {@code FactoryBean} implementations, this class is suitable for
* use when configuring a Spring application context using Spring {@code <beans>}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2016 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.
@@ -49,7 +49,6 @@ import org.springframework.util.CollectionUtils;
* @author Rob Harrop
* @author Juergen Hoeller
* @since 1.2
* @see FactoryBean
* @see JMXConnectorServer
* @see MBeanServer
*/

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 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.
@@ -206,8 +206,8 @@ public class ScriptFactoryPostProcessor extends InstantiationAwareBeanPostProces
@Override
public void setBeanFactory(BeanFactory beanFactory) {
if (!(beanFactory instanceof ConfigurableBeanFactory)) {
throw new IllegalStateException("ScriptFactoryPostProcessor doesn't work with a BeanFactory "
+ "which does not implement ConfigurableBeanFactory: " + beanFactory.getClass());
throw new IllegalStateException("ScriptFactoryPostProcessor doesn't work with " +
"non-ConfigurableBeanFactory: " + beanFactory.getClass());
}
this.beanFactory = (ConfigurableBeanFactory) beanFactory;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-2016 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.
@@ -29,13 +29,12 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
*
* @author Stephane Nicoll
*/
public class ExpressionCachingIntegrationTests {
@Test // SPR-11692
@SuppressWarnings("unchecked")
@Test // SPR-11692
public void expressionIsCacheBasedOnActualMethod() {
ConfigurableApplicationContext context =
new AnnotationConfigApplicationContext(SharedConfig.class, Spr11692Config.class);
@@ -50,9 +49,9 @@ public class ExpressionCachingIntegrationTests {
}
@Configuration
static class Spr11692Config {
@Bean
public BaseDao<User> userDao() {
return new UserDaoImpl();
@@ -65,11 +64,14 @@ public class ExpressionCachingIntegrationTests {
}
private static interface BaseDao<T> {
private interface BaseDao<T> {
T persist(T t);
}
private static class UserDaoImpl implements BaseDao<User> {
@Override
@CachePut(value = "users", key = "#user.id")
public User persist(User user) {
@@ -77,7 +79,9 @@ public class ExpressionCachingIntegrationTests {
}
}
private static class OrderDaoImpl implements BaseDao<Order> {
@Override
@CachePut(value = "orders", key = "#order.id")
public Order persist(Order order) {
@@ -85,35 +89,41 @@ public class ExpressionCachingIntegrationTests {
}
}
private static class User {
private final String id;
private User(String id) {
public User(String id) {
this.id = id;
}
@SuppressWarnings("unused")
public String getId() {
return id;
return this.id;
}
}
private static class Order {
private final String id;
private Order(String id) {
public Order(String id) {
this.id = id;
}
@SuppressWarnings("unused")
public String getId() {
return id;
return this.id;
}
}
@Configuration
@EnableCaching
static class SharedConfig extends CachingConfigurerSupport {
@Override
@Bean
public CacheManager cacheManager() {