Browse Source

Polishing

pull/30915/head
Juergen Hoeller 2 years ago
parent
commit
c873a597c7
  1. 2
      spring-context/src/main/java/org/springframework/context/event/ApplicationListenerMethodAdapter.java
  2. 38
      spring-core/src/main/java/org/springframework/core/env/Environment.java

2
spring-context/src/main/java/org/springframework/context/event/ApplicationListenerMethodAdapter.java

@ -371,7 +371,7 @@ public class ApplicationListenerMethodAdapter implements GenericApplicationListe @@ -371,7 +371,7 @@ public class ApplicationListenerMethodAdapter implements GenericApplicationListe
* Return the target bean instance to use.
*/
protected Object getTargetBean() {
Assert.notNull(this.applicationContext, "ApplicationContext must no be null");
Assert.notNull(this.applicationContext, "ApplicationContext must not be null");
return this.applicationContext.getBean(this.beanName);
}

38
spring-core/src/main/java/org/springframework/core/env/Environment.java vendored

@ -95,6 +95,25 @@ public interface Environment extends PropertyResolver { @@ -95,6 +95,25 @@ public interface Environment extends PropertyResolver {
*/
String[] getDefaultProfiles();
/**
* Determine whether one of the given profile expressions matches the
* {@linkplain #getActiveProfiles() active profiles} — or in the case
* of no explicit active profiles, whether one of the given profile expressions
* matches the {@linkplain #getDefaultProfiles() default profiles}.
* <p>Profile expressions allow for complex, boolean profile logic to be
* expressed &mdash; for example {@code "p1 & p2"}, {@code "(p1 & p2) | p3"},
* etc. See {@link Profiles#of(String...)} for details on the supported
* expression syntax.
* <p>This method is a convenient shortcut for
* {@code env.acceptsProfiles(Profiles.of(profileExpressions))}.
* @since 5.3.28
* @see Profiles#of(String...)
* @see #acceptsProfiles(Profiles)
*/
default boolean matchesProfiles(String... profileExpressions) {
return acceptsProfiles(Profiles.of(profileExpressions));
}
/**
* Determine whether one or more of the given profiles is active &mdash; or
* in the case of no explicit {@linkplain #getActiveProfiles() active profiles},
@ -117,25 +136,6 @@ public interface Environment extends PropertyResolver { @@ -117,25 +136,6 @@ public interface Environment extends PropertyResolver {
@Deprecated
boolean acceptsProfiles(String... profiles);
/**
* Determine whether one of the given profile expressions matches the
* {@linkplain #getActiveProfiles() active profiles} &mdash; or in the case
* of no explicit active profiles, whether one of the given profile expressions
* matches the {@linkplain #getDefaultProfiles() default profiles}.
* <p>Profile expressions allow for complex, boolean profile logic to be
* expressed &mdash; for example {@code "p1 & p2"}, {@code "(p1 & p2) | p3"},
* etc. See {@link Profiles#of(String...)} for details on the supported
* expression syntax.
* <p>This method is a convenient shortcut for
* {@code env.acceptsProfiles(Profiles.of(profileExpressions))}.
* @since 5.3.28
* @see Profiles#of(String...)
* @see #acceptsProfiles(Profiles)
*/
default boolean matchesProfiles(String... profileExpressions) {
return acceptsProfiles(Profiles.of(profileExpressions));
}
/**
* Determine whether the given {@link Profiles} predicate matches the
* {@linkplain #getActiveProfiles() active profiles} &mdash; or in the case

Loading…
Cancel
Save