From 88e3b841644bd860d144acb37c13da3f6a8c2d01 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Wed, 10 Apr 2019 15:57:51 +0200 Subject: [PATCH] Deprecate mock JNDI support in the spring-test module Closes gh-22779 --- .../springframework/mock/jndi/ExpectedLookupTemplate.java | 5 ++++- .../org/springframework/mock/jndi/SimpleNamingContext.java | 5 ++++- .../mock/jndi/SimpleNamingContextBuilder.java | 5 ++++- .../java/org/springframework/mock/jndi/package-info.java | 7 ++++++- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/spring-test/src/main/java/org/springframework/mock/jndi/ExpectedLookupTemplate.java b/spring-test/src/main/java/org/springframework/mock/jndi/ExpectedLookupTemplate.java index 141f4c08bd..abaa399edb 100644 --- a/spring-test/src/main/java/org/springframework/mock/jndi/ExpectedLookupTemplate.java +++ b/spring-test/src/main/java/org/springframework/mock/jndi/ExpectedLookupTemplate.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 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. @@ -29,7 +29,10 @@ import org.springframework.jndi.JndiTemplate; * * @author Rod Johnson * @author Juergen Hoeller + * @deprecated Deprecated as of Spring Framework 5.2 in favor of complete solutions from + * third parties such as Simple-JNDI */ +@Deprecated public class ExpectedLookupTemplate extends JndiTemplate { private final Map jndiObjects = new ConcurrentHashMap<>(16); diff --git a/spring-test/src/main/java/org/springframework/mock/jndi/SimpleNamingContext.java b/spring-test/src/main/java/org/springframework/mock/jndi/SimpleNamingContext.java index 94a3f3fdef..305331fc77 100644 --- a/spring-test/src/main/java/org/springframework/mock/jndi/SimpleNamingContext.java +++ b/spring-test/src/main/java/org/springframework/mock/jndi/SimpleNamingContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 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. @@ -50,7 +50,10 @@ import org.springframework.util.StringUtils; * @author Juergen Hoeller * @see SimpleNamingContextBuilder * @see org.springframework.jndi.JndiTemplate#createInitialContext + * @deprecated Deprecated as of Spring Framework 5.2 in favor of complete solutions from + * third parties such as Simple-JNDI */ +@Deprecated public class SimpleNamingContext implements Context { private final Log logger = LogFactory.getLog(getClass()); diff --git a/spring-test/src/main/java/org/springframework/mock/jndi/SimpleNamingContextBuilder.java b/spring-test/src/main/java/org/springframework/mock/jndi/SimpleNamingContextBuilder.java index 7c809f763a..beb620875b 100644 --- a/spring-test/src/main/java/org/springframework/mock/jndi/SimpleNamingContextBuilder.java +++ b/spring-test/src/main/java/org/springframework/mock/jndi/SimpleNamingContextBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 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. @@ -80,7 +80,10 @@ import org.springframework.util.ReflectionUtils; * @see SimpleNamingContext * @see org.springframework.jdbc.datasource.SingleConnectionDataSource * @see org.springframework.jdbc.datasource.DriverManagerDataSource + * @deprecated Deprecated as of Spring Framework 5.2 in favor of complete solutions from + * third parties such as Simple-JNDI */ +@Deprecated public class SimpleNamingContextBuilder implements InitialContextFactoryBuilder { /** An instance of this class bound to JNDI. */ diff --git a/spring-test/src/main/java/org/springframework/mock/jndi/package-info.java b/spring-test/src/main/java/org/springframework/mock/jndi/package-info.java index 95e56da08d..455919427b 100644 --- a/spring-test/src/main/java/org/springframework/mock/jndi/package-info.java +++ b/spring-test/src/main/java/org/springframework/mock/jndi/package-info.java @@ -1,11 +1,16 @@ /** - * The simplest implementation of the JNDI SPI that could possibly work. + * Deprecated as of Spring Framework 5.2 in favor of complete + * solutions from third parties such as + * Simple-JNDI. + * + *

The simplest implementation of the JNDI SPI that could possibly work. * *

Useful for setting up a simple JNDI environment for test suites * or stand-alone applications. If, for example, JDBC DataSources get bound to the * same JNDI names as within a Java EE container, both application code and * configuration can be reused without changes. */ +@Deprecated @NonNullApi @NonNullFields package org.springframework.mock.jndi;