Skip to content

Commit 80128f1

Browse files
committed
Polishing
1 parent 186fef6 commit 80128f1

File tree

5 files changed

+32
-30
lines changed

5 files changed

+32
-30
lines changed

spring-context/src/main/java/org/springframework/context/support/ResourceBundleMessageSource.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2015 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -422,6 +422,8 @@ private class MessageSourceControl extends ResourceBundle.Control {
422422
@Override
423423
public ResourceBundle newBundle(String baseName, Locale locale, String format, ClassLoader loader, boolean reload)
424424
throws IllegalAccessException, InstantiationException, IOException {
425+
426+
// Special handling of default encoding
425427
if (format.equals("java.properties")) {
426428
String bundleName = toBundleName(baseName, locale);
427429
final String resourceName = toResourceName(bundleName, "properties");
@@ -468,6 +470,7 @@ public InputStream run() throws IOException {
468470
}
469471
}
470472
else {
473+
// Delegate handling of "java.class" format to standard Control
471474
return super.newBundle(baseName, locale, format, loader, reload);
472475
}
473476
}

spring-tx/src/main/java/org/springframework/transaction/annotation/AbstractTransactionManagementConfiguration.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2015 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -40,6 +40,9 @@ public abstract class AbstractTransactionManagementConfiguration implements Impo
4040

4141
protected AnnotationAttributes enableTx;
4242

43+
/**
44+
* Default transaction manager, as configured through a {@link TransactionManagementConfigurer}.
45+
*/
4346
protected PlatformTransactionManager txManager;
4447

4548

@@ -50,7 +53,7 @@ public void setImportMetadata(AnnotationMetadata importMetadata) {
5053
"@EnableTransactionManagement is not present on importing class " + importMetadata.getClassName());
5154
}
5255

53-
@Autowired(required=false)
56+
@Autowired(required = false)
5457
void setConfigurers(Collection<TransactionManagementConfigurer> configurers) {
5558
if (CollectionUtils.isEmpty(configurers)) {
5659
return;

spring-tx/src/main/java/org/springframework/transaction/annotation/TransactionManagementConfigurer.java

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2011 the original author or authors.
2+
* Copyright 2002-2015 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,19 +20,21 @@
2020

2121
/**
2222
* Interface to be implemented by @{@link org.springframework.context.annotation.Configuration
23-
* Configuration} classes annotated with @{@link EnableTransactionManagement} that wish
24-
* or need to specify explicitly the {@link PlatformTransactionManager} bean to be used
25-
* for annotation-driven transaction management, as opposed to the default approach of a
26-
* by-type lookup. One reason this might be necessary is if there are two
23+
* Configuration} classes annotated with @{@link EnableTransactionManagement} that wish to
24+
* or need to explicitly specify the default {@link PlatformTransactionManager} bean to be
25+
* used for annotation-driven transaction management, as opposed to the default approach
26+
* of a by-type lookup. One reason this might be necessary is if there are two
2727
* {@code PlatformTransactionManager} beans present in the container.
2828
*
29-
* <p>See @{@link EnableTransactionManagement} for general examples and context; see
30-
* {@link #annotationDrivenTransactionManager()} for detailed instructions.
29+
* <p>See @{@link EnableTransactionManagement} for general examples and context;
30+
* see {@link #annotationDrivenTransactionManager()} for detailed instructions.
3131
*
3232
* <p>Note that in by-type lookup disambiguation cases, an alternative approach to
33-
* implementing this interface is to simply mark one of the offending {@code
34-
* PlatformTransactionManager} {@code @Bean} methods as @{@link
35-
* org.springframework.context.annotation.Primary Primary}.
33+
* implementing this interface is to simply mark one of the offending
34+
* {@code PlatformTransactionManager} {@code @Bean} methods as
35+
* @{@link org.springframework.context.annotation.Primary Primary}.
36+
* This is even generally preferred since it doesn't lead to early initialization
37+
* of the {@code PlatformTransactionManager} bean.
3638
*
3739
* @author Chris Beams
3840
* @since 3.1
@@ -42,9 +44,8 @@
4244
public interface TransactionManagementConfigurer {
4345

4446
/**
45-
* Return the transaction manager bean to use for annotation-driven database
47+
* Return the default transaction manager bean to use for annotation-driven database
4648
* transaction management, i.e. when processing {@code @Transactional} methods.
47-
*
4849
* <p>There are two basic approaches to implementing this method:
4950
* <h3>1. Implement the method and annotate it with {@code @Bean}</h3>
5051
* In this case, the implementing {@code @Configuration} class implements this method,
@@ -68,15 +69,13 @@ public interface TransactionManagementConfigurer {
6869
* public PlatformTransactionManager annotationDrivenTransactionManager() {
6970
* return txManager(); // reference the existing {@code @Bean} method above
7071
* }</pre>
71-
*
72-
* If taking approach #2, be sure that <em>only one</em> of the methods is marked with
73-
* {@code @Bean}!
74-
*
72+
* If taking approach #2, be sure that <em>only one</em> of the methods is marked
73+
* with {@code @Bean}!
7574
* <p>In either scenario #1 or #2, it is important that the
7675
* {@code PlatformTransactionManager} instance is managed as a Spring bean within the
77-
* container as all {@code PlatformTransactionManager} implementations take
78-
* advantage of Spring lifecycle callbacks such as {@code InitializingBean} and {@code
79-
* BeanFactoryAware}.
76+
* container as all {@code PlatformTransactionManager} implementations take advantage
77+
* of Spring lifecycle callbacks such as {@code InitializingBean} and
78+
* {@code BeanFactoryAware}.
8079
*/
8180
PlatformTransactionManager annotationDrivenTransactionManager();
8281

spring-web/src/main/java/org/springframework/web/filter/AbstractRequestLoggingFilter.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2015 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -294,6 +294,7 @@ protected String createMessage(HttpServletRequest request, String prefix, String
294294
return msg.toString();
295295
}
296296

297+
297298
/**
298299
* Concrete subclasses should implement this method to write a log message
299300
* <i>before</i> the request is processed.

spring-web/src/main/java/org/springframework/web/filter/CommonsRequestLoggingFilter.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2005 the original author or authors.
2+
* Copyright 2002-2015 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -38,19 +38,15 @@ public class CommonsRequestLoggingFilter extends AbstractRequestLoggingFilter {
3838
*/
3939
@Override
4040
protected void beforeRequest(HttpServletRequest request, String message) {
41-
if (logger.isDebugEnabled()) {
42-
logger.debug(message);
43-
}
41+
logger.debug(message);
4442
}
4543

4644
/**
4745
* Writes a log message after the request is processed.
4846
*/
4947
@Override
5048
protected void afterRequest(HttpServletRequest request, String message) {
51-
if (logger.isDebugEnabled()) {
52-
logger.debug(message);
53-
}
49+
logger.debug(message);
5450
}
5551

5652
}

0 commit comments

Comments
 (0)