Java Code Examples for org.springframework.beans.factory.annotation.Value#value()

The following examples show how to use org.springframework.beans.factory.annotation.Value#value() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SpringValueProcessor.java    From apollo with Apache License 2.0 6 votes vote down vote up
@Override
protected void processField(Object bean, String beanName, Field field) {
  // register @Value on field
  Value value = field.getAnnotation(Value.class);
  if (value == null) {
    return;
  }
  Set<String> keys = placeholderHelper.extractPlaceholderKeys(value.value());

  if (keys.isEmpty()) {
    return;
  }

  for (String key : keys) {
    SpringValue springValue = new SpringValue(key, value.value(), bean, beanName, field, false);
    springValueRegistry.register(beanFactory, key, springValue);
    logger.debug("Monitoring {}", springValue);
  }
}
 
Example 2
Source File: SpringValueProcessor.java    From apollo with Apache License 2.0 5 votes vote down vote up
@Override
protected void processMethod(Object bean, String beanName, Method method) {
  //register @Value on method
  Value value = method.getAnnotation(Value.class);
  if (value == null) {
    return;
  }
  //skip Configuration bean methods
  if (method.getAnnotation(Bean.class) != null) {
    return;
  }
  if (method.getParameterTypes().length != 1) {
    logger.error("Ignore @Value setter {}.{}, expecting 1 parameter, actual {} parameters",
        bean.getClass().getName(), method.getName(), method.getParameterTypes().length);
    return;
  }

  Set<String> keys = placeholderHelper.extractPlaceholderKeys(value.value());

  if (keys.isEmpty()) {
    return;
  }

  for (String key : keys) {
    SpringValue springValue = new SpringValue(key, value.value(), bean, beanName, method, false);
    springValueRegistry.register(beanFactory, key, springValue);
    logger.info("Monitoring {}", springValue);
  }
}
 
Example 3
Source File: ExpressionValueMethodArgumentResolver.java    From spring-analysis-note with MIT License 4 votes vote down vote up
private ExpressionValueNamedValueInfo(Value annotation) {
	super("@Value", false, annotation.value());
}
 
Example 4
Source File: ExpressionValueMethodArgumentResolver.java    From spring-analysis-note with MIT License 4 votes vote down vote up
private ExpressionValueNamedValueInfo(Value annotation) {
	super("@Value", false, annotation.value());
}
 
Example 5
Source File: ExpressionValueMethodArgumentResolver.java    From java-technology-stack with MIT License 4 votes vote down vote up
private ExpressionValueNamedValueInfo(Value annotation) {
	super("@Value", false, annotation.value());
}
 
Example 6
Source File: ExpressionValueMethodArgumentResolver.java    From java-technology-stack with MIT License 4 votes vote down vote up
private ExpressionValueNamedValueInfo(Value annotation) {
	super("@Value", false, annotation.value());
}
 
Example 7
Source File: ExpressionValueMethodArgumentResolver.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
private ExpressionValueNamedValueInfo(Value annotation) {
	super("@Value", false, annotation.value());
}
 
Example 8
Source File: ExpressionValueMethodArgumentResolver.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
private ExpressionValueNamedValueInfo(Value annotation) {
	super("@Value", false, annotation.value());
}