jvz commented on code in PR #2148: URL: https://github.com/apache/logging-log4j2/pull/2148#discussion_r1439715992
########## log4j-core-test/src/main/java/org/apache/logging/log4j/core/test/junit/TestBinding.java: ########## @@ -0,0 +1,66 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to you under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.logging.log4j.core.test.junit; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Inherited; +import java.lang.annotation.Repeatable; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Specifies one or more pairs of {@linkplain org.apache.logging.log4j.plugins.di.Key binding keys} with + * injectable classes to bind in a test. The binding key corresponds to {@link #api()} and the factory will + * use the provided {@link #implementation()} class (or {@link #implementationClassName()} to load reflectively). + * + * @see ConfigurationFactoryType + * @see ContextSelectorType + */ +@Repeatable(TestBinding.Group.class) +@Target({ElementType.TYPE, ElementType.METHOD}) +@Retention(RetentionPolicy.RUNTIME) +@Inherited +@Log4jTest +public @interface TestBinding { + /** + * Specifies the {@linkplain org.apache.logging.log4j.plugins.di.Key#forClass(Class) class to use as a key} for this binding. + */ + Class<?> api(); Review Comment: Will note that some sort of annotation-specific way of specifying a `Key` here would also be useful, but I haven't had a need for that particular syntax yet as all the bindings needed in tests from this annotation use plain interfaces as the key rather than any particular namespace, name, qualifier, etc. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
