mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-09-26 11:39:14 +00:00
Add nullability annotations to module/spring-boot-activemq
See gh-46587
This commit is contained in:
+3
-2
@@ -18,6 +18,7 @@ package org.springframework.boot.activemq.autoconfigure;
|
||||
|
||||
import jakarta.jms.ConnectionFactory;
|
||||
import org.apache.activemq.ActiveMQConnectionFactory;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
@@ -71,12 +72,12 @@ public final class ActiveMQAutoConfiguration {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUser() {
|
||||
public @Nullable String getUser() {
|
||||
return this.properties.getUser();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPassword() {
|
||||
public @Nullable String getPassword() {
|
||||
return this.properties.getPassword();
|
||||
}
|
||||
|
||||
|
||||
+4
-2
@@ -16,6 +16,8 @@
|
||||
|
||||
package org.springframework.boot.activemq.autoconfigure;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.boot.autoconfigure.service.connection.ConnectionDetails;
|
||||
|
||||
/**
|
||||
@@ -37,12 +39,12 @@ public interface ActiveMQConnectionDetails extends ConnectionDetails {
|
||||
* Login user to authenticate to the broker.
|
||||
* @return the login user to authenticate to the broker or {@code null}
|
||||
*/
|
||||
String getUser();
|
||||
@Nullable String getUser();
|
||||
|
||||
/**
|
||||
* Login to authenticate against the broker.
|
||||
* @return the login to authenticate against the broker or {@code null}
|
||||
*/
|
||||
String getPassword();
|
||||
@Nullable String getPassword();
|
||||
|
||||
}
|
||||
|
||||
+2
-1
@@ -20,6 +20,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.activemq.ActiveMQConnectionFactory;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.boot.activemq.autoconfigure.ActiveMQProperties.Packages;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -40,7 +41,7 @@ class ActiveMQConnectionFactoryConfigurer {
|
||||
private final List<ActiveMQConnectionFactoryCustomizer> factoryCustomizers;
|
||||
|
||||
ActiveMQConnectionFactoryConfigurer(ActiveMQProperties properties,
|
||||
List<ActiveMQConnectionFactoryCustomizer> factoryCustomizers) {
|
||||
@Nullable List<ActiveMQConnectionFactoryCustomizer> factoryCustomizers) {
|
||||
Assert.notNull(properties, "'properties' must not be null");
|
||||
this.properties = properties;
|
||||
this.factoryCustomizers = (factoryCustomizers != null) ? factoryCustomizers : Collections.emptyList();
|
||||
|
||||
+14
-12
@@ -20,6 +20,8 @@ import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.boot.context.properties.NestedConfigurationProperty;
|
||||
import org.springframework.boot.jms.autoconfigure.JmsPoolConnectionFactoryProperties;
|
||||
@@ -44,17 +46,17 @@ public class ActiveMQProperties {
|
||||
/**
|
||||
* URL of the ActiveMQ broker. Auto-generated by default.
|
||||
*/
|
||||
private String brokerUrl;
|
||||
private @Nullable String brokerUrl;
|
||||
|
||||
/**
|
||||
* Login user of the broker.
|
||||
*/
|
||||
private String user;
|
||||
private @Nullable String user;
|
||||
|
||||
/**
|
||||
* Login password of the broker.
|
||||
*/
|
||||
private String password;
|
||||
private @Nullable String password;
|
||||
|
||||
private final Embedded embedded = new Embedded();
|
||||
|
||||
@@ -79,27 +81,27 @@ public class ActiveMQProperties {
|
||||
|
||||
private final Packages packages = new Packages();
|
||||
|
||||
public String getBrokerUrl() {
|
||||
public @Nullable String getBrokerUrl() {
|
||||
return this.brokerUrl;
|
||||
}
|
||||
|
||||
public void setBrokerUrl(String brokerUrl) {
|
||||
public void setBrokerUrl(@Nullable String brokerUrl) {
|
||||
this.brokerUrl = brokerUrl;
|
||||
}
|
||||
|
||||
public String getUser() {
|
||||
public @Nullable String getUser() {
|
||||
return this.user;
|
||||
}
|
||||
|
||||
public void setUser(String user) {
|
||||
public void setUser(@Nullable String user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
public @Nullable String getPassword() {
|
||||
return this.password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
public void setPassword(@Nullable String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
@@ -174,18 +176,18 @@ public class ActiveMQProperties {
|
||||
/**
|
||||
* Whether to trust all packages.
|
||||
*/
|
||||
private Boolean trustAll;
|
||||
private @Nullable Boolean trustAll;
|
||||
|
||||
/**
|
||||
* List of specific packages to trust (when not trusting all packages).
|
||||
*/
|
||||
private List<String> trusted = new ArrayList<>();
|
||||
|
||||
public Boolean getTrustAll() {
|
||||
public @Nullable Boolean getTrustAll() {
|
||||
return this.trustAll;
|
||||
}
|
||||
|
||||
public void setTrustAll(Boolean trustAll) {
|
||||
public void setTrustAll(@Nullable Boolean trustAll) {
|
||||
this.trustAll = trustAll;
|
||||
}
|
||||
|
||||
|
||||
+3
@@ -17,4 +17,7 @@
|
||||
/**
|
||||
* Auto-configuration for ActiveMQ.
|
||||
*/
|
||||
@NullMarked
|
||||
package org.springframework.boot.activemq.autoconfigure;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
+4
-2
@@ -16,6 +16,8 @@
|
||||
|
||||
package org.springframework.boot.activemq.docker.compose;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.boot.activemq.autoconfigure.ActiveMQConnectionDetails;
|
||||
import org.springframework.boot.docker.compose.core.RunningService;
|
||||
import org.springframework.boot.docker.compose.service.connection.DockerComposeConnectionDetailsFactory;
|
||||
@@ -65,12 +67,12 @@ class ActiveMQClassicDockerComposeConnectionDetailsFactory
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUser() {
|
||||
public @Nullable String getUser() {
|
||||
return this.environment.getUser();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPassword() {
|
||||
public @Nullable String getPassword() {
|
||||
return this.environment.getPassword();
|
||||
}
|
||||
|
||||
|
||||
+6
-4
@@ -18,6 +18,8 @@ package org.springframework.boot.activemq.docker.compose;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* ActiveMQ environment details.
|
||||
*
|
||||
@@ -26,20 +28,20 @@ import java.util.Map;
|
||||
*/
|
||||
class ActiveMQClassicEnvironment {
|
||||
|
||||
private final String user;
|
||||
private final @Nullable String user;
|
||||
|
||||
private final String password;
|
||||
private final @Nullable String password;
|
||||
|
||||
ActiveMQClassicEnvironment(Map<String, String> env) {
|
||||
this.user = env.get("ACTIVEMQ_CONNECTION_USER");
|
||||
this.password = env.get("ACTIVEMQ_CONNECTION_PASSWORD");
|
||||
}
|
||||
|
||||
String getUser() {
|
||||
@Nullable String getUser() {
|
||||
return this.user;
|
||||
}
|
||||
|
||||
String getPassword() {
|
||||
@Nullable String getPassword() {
|
||||
return this.password;
|
||||
}
|
||||
|
||||
|
||||
+4
-2
@@ -16,6 +16,8 @@
|
||||
|
||||
package org.springframework.boot.activemq.docker.compose;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import org.springframework.boot.activemq.autoconfigure.ActiveMQConnectionDetails;
|
||||
import org.springframework.boot.docker.compose.core.RunningService;
|
||||
import org.springframework.boot.docker.compose.service.connection.DockerComposeConnectionDetailsFactory;
|
||||
@@ -64,12 +66,12 @@ class ActiveMQDockerComposeConnectionDetailsFactory
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUser() {
|
||||
public @Nullable String getUser() {
|
||||
return this.environment.getUser();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPassword() {
|
||||
public @Nullable String getPassword() {
|
||||
return this.environment.getPassword();
|
||||
}
|
||||
|
||||
|
||||
+6
-4
@@ -18,6 +18,8 @@ package org.springframework.boot.activemq.docker.compose;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* ActiveMQ environment details.
|
||||
*
|
||||
@@ -25,20 +27,20 @@ import java.util.Map;
|
||||
*/
|
||||
class ActiveMQEnvironment {
|
||||
|
||||
private final String user;
|
||||
private final @Nullable String user;
|
||||
|
||||
private final String password;
|
||||
private final @Nullable String password;
|
||||
|
||||
ActiveMQEnvironment(Map<String, String> env) {
|
||||
this.user = env.get("ACTIVEMQ_USERNAME");
|
||||
this.password = env.get("ACTIVEMQ_PASSWORD");
|
||||
}
|
||||
|
||||
String getUser() {
|
||||
@Nullable String getUser() {
|
||||
return this.user;
|
||||
}
|
||||
|
||||
String getPassword() {
|
||||
@Nullable String getPassword() {
|
||||
return this.password;
|
||||
}
|
||||
|
||||
|
||||
+3
@@ -17,4 +17,7 @@
|
||||
/**
|
||||
* Support for Docker Compose ActiveMQ service connections.
|
||||
*/
|
||||
@NullMarked
|
||||
package org.springframework.boot.activemq.docker.compose;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
+3
-2
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.boot.activemq.testcontainers;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.testcontainers.containers.Container;
|
||||
import org.testcontainers.containers.GenericContainer;
|
||||
|
||||
@@ -56,12 +57,12 @@ class ActiveMQContainerConnectionDetailsFactory
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUser() {
|
||||
public @Nullable String getUser() {
|
||||
return getContainer().getEnvMap().get("ACTIVEMQ_USERNAME");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPassword() {
|
||||
public @Nullable String getPassword() {
|
||||
return getContainer().getEnvMap().get("ACTIVEMQ_PASSWORD");
|
||||
}
|
||||
|
||||
|
||||
+3
@@ -17,4 +17,7 @@
|
||||
/**
|
||||
* Support for testcontainers ActiveMQ service connections.
|
||||
*/
|
||||
@NullMarked
|
||||
package org.springframework.boot.activemq.testcontainers;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
|
||||
Reference in New Issue
Block a user