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() . These examples are extracted from open source projects. 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 Project: apollo   File: SpringValueProcessor.java    License: 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 Project: apollo   File: SpringValueProcessor.java    License: 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
private ExpressionValueNamedValueInfo(Value annotation) {
	super("@Value", false, annotation.value());
}
 
Example 4
private ExpressionValueNamedValueInfo(Value annotation) {
	super("@Value", false, annotation.value());
}
 
Example 5
private ExpressionValueNamedValueInfo(Value annotation) {
	super("@Value", false, annotation.value());
}
 
Example 6
private ExpressionValueNamedValueInfo(Value annotation) {
	super("@Value", false, annotation.value());
}
 
Example 7
private ExpressionValueNamedValueInfo(Value annotation) {
	super("@Value", false, annotation.value());
}
 
Example 8
private ExpressionValueNamedValueInfo(Value annotation) {
	super("@Value", false, annotation.value());
}