Skip to content

Polish #26188

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Polish #26188

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6948,7 +6948,7 @@ You can use the `@DataJpaTest` annotation to test JPA applications.
By default, it scans for `@Entity` classes and configures Spring Data JPA repositories.
If an embedded database is available on the classpath, it configures one as well.
SQL queries are logged by default by setting the `spring.jpa.show-sql` property to `true`.
This can be disabled using the `showSql()` attribute of the annotation.
This can be disabled by using the `showSql()` attribute of the annotation.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is OK without the "by".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wilkinsona I just felt that it was clearer, but it seems that my lack of knowledge on English made me feel that way. Thanks for pointing it out 😄


Regular `@Component` and `@ConfigurationProperties` beans are not scanned when the `@DataJpaTest` annotation is used.
`@EnableConfigurationProperties` can be used to include `@ConfigurationProperties` beans.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
* override these settings.
* <p>
* SQL queries are logged by default by setting the {@code spring.jpa.show-sql} property
* to {@code true}. This can be disabled using the {@link DataJpaTest#showSql() showSql}
* attribute.
* to {@code true}. This can be disabled by using the {@link DataJpaTest#showSql()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is OK without the "by".

* showSql} attribute.
* <p>
* If you are looking to load your full application configuration, but use an embedded
* database, you should consider {@link SpringBootTest @SpringBootTest} combined with
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
public class ApplicationAvailabilityBean
implements ApplicationAvailability, ApplicationListener<AvailabilityChangeEvent<?>> {

private static final Log logger = LogFactory.getLog(ApplicationAvailability.class);
private static final Log logger = LogFactory.getLog(ApplicationAvailabilityBean.class);

private final Map<Class<? extends AvailabilityState>, AvailabilityChangeEvent<?>> events = new HashMap<>();

Expand Down Expand Up @@ -70,6 +70,13 @@ public void onApplicationEvent(AvailabilityChangeEvent<?> event) {
}

private void logStateChange(AvailabilityChangeEvent<?> event) {
if (logger.isInfoEnabled()) {
StringBuilder message = createStateChangeMessage(event);
logger.info(message);
}
}

private StringBuilder createStateChangeMessage(AvailabilityChangeEvent<?> event) {
Class<? extends AvailabilityState> stateType = getStateType(event.getState());
StringBuilder message = new StringBuilder(
"Application availability state " + stateType.getSimpleName() + " changed");
Expand All @@ -78,15 +85,16 @@ private void logStateChange(AvailabilityChangeEvent<?> event) {
message.append(" from " + lastChangeEvent.getState());
}
message.append(" to " + event.getState());
if (event.getSource() != null) {
if (event.getSource() instanceof Throwable) {
message.append(": " + event.getSource());
Object source = event.getSource();
if (source != null) {
if (source instanceof Throwable) {
message.append(": " + source);
}
else if (!(event.getSource() instanceof ApplicationEventPublisher)) {
message.append(": " + event.getSource().getClass().getName());
else if (!(source instanceof ApplicationEventPublisher)) {
message.append(": " + source.getClass().getName());
}
}
logger.info(message);
return message;
}

@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class ApplicationConversionService extends FormattingConversionService {

private static volatile ApplicationConversionService sharedInstance;

private boolean unmodifiable;
private final boolean unmodifiable;

public ApplicationConversionService() {
this(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import static org.assertj.core.api.Assertions.assertThat;

/**
* Tests for {@JettyReactiveWebServerFactory} with Jetty 10.
* Tests for {@link JettyReactiveWebServerFactory} with Jetty 10.
*
* @author Andy Wilkinson
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import static org.assertj.core.api.Assertions.assertThat;

/**
* Tests for {@JettyServletWebServerFactory} with Jetty 10.
* Tests for {@link JettyServletWebServerFactory} with Jetty 10.
*
* @author Andy Wilkinson
*/
Expand Down