Extension.java 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one or more
  3. * contributor license agreements. See the NOTICE file distributed with
  4. * this work for additional information regarding copyright ownership.
  5. * The ASF licenses this file to You under the Apache License, Version 2.0
  6. * (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. package cn.nosum.common.annotation;
  18. import java.lang.annotation.Documented;
  19. import java.lang.annotation.ElementType;
  20. import java.lang.annotation.Retention;
  21. import java.lang.annotation.RetentionPolicy;
  22. import java.lang.annotation.Target;
  23. /**
  24. * Marker for extension interface
  25. * <p/>
  26. * Changes on extension configuration file <br/>
  27. * Use <code>Protocol</code> as an example, its configuration file 'META-INF/dubbo/com.xxx.Protocol' is changes from: <br/>
  28. * <pre>
  29. * com.foo.XxxProtocol
  30. * com.foo.YyyProtocol
  31. * </pre>
  32. * <p>
  33. * to key-value pair <br/>
  34. * <pre>
  35. * xxx=com.foo.XxxProtocol
  36. * yyy=com.foo.YyyProtocol
  37. * </pre>
  38. * <br/>
  39. * The reason for this change is:
  40. * <p>
  41. * If there's third party library referenced by static field or by method in extension implementation, its class will
  42. * fail to initialize if the third party library doesn't exist. In this case, dubbo cannot figure out extension's id
  43. * therefore cannot be able to map the exception information with the extension, if the previous format is used.
  44. * <p/>
  45. * For example:
  46. * <p>
  47. * Fails to load Extension("mina"). When user configure to use mina, dubbo will complain the extension cannot be loaded,
  48. * instead of reporting which extract extension implementation fails and the extract reason.
  49. * </p>
  50. *
  51. * @deprecated because it's too general, switch to use {@link org.apache.dubbo.common.extension.SPI}
  52. */
  53. @Deprecated
  54. @Documented
  55. @Retention(RetentionPolicy.RUNTIME)
  56. @Target({ElementType.TYPE})
  57. public @interface Extension {
  58. /**
  59. * @deprecated
  60. */
  61. @Deprecated
  62. String value() default "";
  63. }