diff --git a/spring-context/src/main/java/org/springframework/context/support/ResourceBundleMessageSource.java b/spring-context/src/main/java/org/springframework/context/support/ResourceBundleMessageSource.java index 8d711989d9..56d73102f9 100644 --- a/spring-context/src/main/java/org/springframework/context/support/ResourceBundleMessageSource.java +++ b/spring-context/src/main/java/org/springframework/context/support/ResourceBundleMessageSource.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2015 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. @@ -422,6 +422,8 @@ public class ResourceBundleMessageSource extends AbstractMessageSource implement @Override public ResourceBundle newBundle(String baseName, Locale locale, String format, ClassLoader loader, boolean reload) throws IllegalAccessException, InstantiationException, IOException { + + // Special handling of default encoding if (format.equals("java.properties")) { String bundleName = toBundleName(baseName, locale); final String resourceName = toResourceName(bundleName, "properties"); @@ -468,6 +470,7 @@ public class ResourceBundleMessageSource extends AbstractMessageSource implement } } else { + // Delegate handling of "java.class" format to standard Control return super.newBundle(baseName, locale, format, loader, reload); } } diff --git a/spring-tx/src/main/java/org/springframework/transaction/annotation/AbstractTransactionManagementConfiguration.java b/spring-tx/src/main/java/org/springframework/transaction/annotation/AbstractTransactionManagementConfiguration.java index 4d2aa5be59..52690fadad 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/annotation/AbstractTransactionManagementConfiguration.java +++ b/spring-tx/src/main/java/org/springframework/transaction/annotation/AbstractTransactionManagementConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2015 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. @@ -40,6 +40,9 @@ public abstract class AbstractTransactionManagementConfiguration implements Impo protected AnnotationAttributes enableTx; + /** + * Default transaction manager, as configured through a {@link TransactionManagementConfigurer}. + */ protected PlatformTransactionManager txManager; @@ -50,7 +53,7 @@ public abstract class AbstractTransactionManagementConfiguration implements Impo "@EnableTransactionManagement is not present on importing class " + importMetadata.getClassName()); } - @Autowired(required=false) + @Autowired(required = false) void setConfigurers(Collection configurers) { if (CollectionUtils.isEmpty(configurers)) { return; diff --git a/spring-tx/src/main/java/org/springframework/transaction/annotation/TransactionManagementConfigurer.java b/spring-tx/src/main/java/org/springframework/transaction/annotation/TransactionManagementConfigurer.java index 62bbe0ee15..1c7d432960 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/annotation/TransactionManagementConfigurer.java +++ b/spring-tx/src/main/java/org/springframework/transaction/annotation/TransactionManagementConfigurer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2015 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. @@ -20,19 +20,21 @@ import org.springframework.transaction.PlatformTransactionManager; /** * Interface to be implemented by @{@link org.springframework.context.annotation.Configuration - * Configuration} classes annotated with @{@link EnableTransactionManagement} that wish - * or need to specify explicitly the {@link PlatformTransactionManager} bean to be used - * for annotation-driven transaction management, as opposed to the default approach of a - * by-type lookup. One reason this might be necessary is if there are two + * Configuration} classes annotated with @{@link EnableTransactionManagement} that wish to + * or need to explicitly specify the default {@link PlatformTransactionManager} bean to be + * used for annotation-driven transaction management, as opposed to the default approach + * of a by-type lookup. One reason this might be necessary is if there are two * {@code PlatformTransactionManager} beans present in the container. * - *

See @{@link EnableTransactionManagement} for general examples and context; see - * {@link #annotationDrivenTransactionManager()} for detailed instructions. + *

See @{@link EnableTransactionManagement} for general examples and context; + * see {@link #annotationDrivenTransactionManager()} for detailed instructions. * *

Note that in by-type lookup disambiguation cases, an alternative approach to - * implementing this interface is to simply mark one of the offending {@code - * PlatformTransactionManager} {@code @Bean} methods as @{@link - * org.springframework.context.annotation.Primary Primary}. + * implementing this interface is to simply mark one of the offending + * {@code PlatformTransactionManager} {@code @Bean} methods as + * @{@link org.springframework.context.annotation.Primary Primary}. + * This is even generally preferred since it doesn't lead to early initialization + * of the {@code PlatformTransactionManager} bean. * * @author Chris Beams * @since 3.1 @@ -42,9 +44,8 @@ import org.springframework.transaction.PlatformTransactionManager; public interface TransactionManagementConfigurer { /** - * Return the transaction manager bean to use for annotation-driven database + * Return the default transaction manager bean to use for annotation-driven database * transaction management, i.e. when processing {@code @Transactional} methods. - * *

There are two basic approaches to implementing this method: *

1. Implement the method and annotate it with {@code @Bean}

* In this case, the implementing {@code @Configuration} class implements this method, @@ -68,15 +69,13 @@ public interface TransactionManagementConfigurer { * public PlatformTransactionManager annotationDrivenTransactionManager() { * return txManager(); // reference the existing {@code @Bean} method above * } - * - * If taking approach #2, be sure that only one of the methods is marked with - * {@code @Bean}! - * + * If taking approach #2, be sure that only one of the methods is marked + * with {@code @Bean}! *

In either scenario #1 or #2, it is important that the * {@code PlatformTransactionManager} instance is managed as a Spring bean within the - * container as all {@code PlatformTransactionManager} implementations take - * advantage of Spring lifecycle callbacks such as {@code InitializingBean} and {@code - * BeanFactoryAware}. + * container as all {@code PlatformTransactionManager} implementations take advantage + * of Spring lifecycle callbacks such as {@code InitializingBean} and + * {@code BeanFactoryAware}. */ PlatformTransactionManager annotationDrivenTransactionManager(); diff --git a/spring-web/src/main/java/org/springframework/web/filter/AbstractRequestLoggingFilter.java b/spring-web/src/main/java/org/springframework/web/filter/AbstractRequestLoggingFilter.java index 00fc99801f..096a9bb954 100644 --- a/spring-web/src/main/java/org/springframework/web/filter/AbstractRequestLoggingFilter.java +++ b/spring-web/src/main/java/org/springframework/web/filter/AbstractRequestLoggingFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2015 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. @@ -294,6 +294,7 @@ public abstract class AbstractRequestLoggingFilter extends OncePerRequestFilter return msg.toString(); } + /** * Concrete subclasses should implement this method to write a log message * before the request is processed. diff --git a/spring-web/src/main/java/org/springframework/web/filter/CommonsRequestLoggingFilter.java b/spring-web/src/main/java/org/springframework/web/filter/CommonsRequestLoggingFilter.java index 191a510fbf..e870f526e8 100644 --- a/spring-web/src/main/java/org/springframework/web/filter/CommonsRequestLoggingFilter.java +++ b/spring-web/src/main/java/org/springframework/web/filter/CommonsRequestLoggingFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2005 the original author or authors. + * Copyright 2002-2015 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. @@ -38,9 +38,7 @@ public class CommonsRequestLoggingFilter extends AbstractRequestLoggingFilter { */ @Override protected void beforeRequest(HttpServletRequest request, String message) { - if (logger.isDebugEnabled()) { - logger.debug(message); - } + logger.debug(message); } /** @@ -48,9 +46,7 @@ public class CommonsRequestLoggingFilter extends AbstractRequestLoggingFilter { */ @Override protected void afterRequest(HttpServletRequest request, String message) { - if (logger.isDebugEnabled()) { - logger.debug(message); - } + logger.debug(message); } }