core/src/main/java/org/springframework/security/access/method/MapBasedMethodSecurityMetadataSource.java
public void addSecureMethod(Class<?> javaType, String mappedName,
			List<ConfigAttribute> attr) {
		String name = javaType.getName() + '.' + mappedName;

		if (logger.isDebugEnabled()) {
			logger.debug("Request to add secure method [" + name + "] with attributes ["
					+ attr + "]");
		}

		Method[] methods = javaType.getMethods();
		List<Method> matchingMethods = new ArrayList<>();

		for (Method m : methods) {
			if (m.getName().equals(mappedName) || isMatch(m.getName(), mappedName)) {
				matchingMethods.add(m);
			}
		}

		if (matchingMethods.isEmpty()) {
			throw new IllegalArgumentException("Couldn't find method '" + mappedName
					+ "' on '" + javaType + "'");
		}

		// register all matching methods
		for (Method method : matchingMethods) {
			RegisteredMethod registeredMethod = new RegisteredMethod(method, javaType);
			String regMethodName = (String) this.nameMap.get(registeredMethod);

			if ((regMethodName == null)
					|| (!regMethodName.equals(name) && (regMethodName.length() <= name
							.length()))) {
				// no already registered method name, or more specific
				// method name specification now -> (re-)register method
				if (regMethodName != null) {
					logger.debug("Replacing attributes for secure method [" + method
							+ "]: current name [" + name + "] is more specific than ["
							+ regMethodName + "]");
				}

				this.nameMap.put(registeredMethod, name);
				addSecureMethod(registeredMethod, attr);
			}
			else {
				logger.debug("Keeping attributes for secure method [" + method
						+ "]: current name [" + name + "] is not more specific than ["
						+ regMethodName + "]");
			}
		}
	}
public void addSecureMethod(Class<?> javaType, String mappedName,
			List<ConfigAttribute> attr) {
		String name = javaType.getName() + '.' + mappedName;

		if (logger.isDebugEnabled()) {
			logger.debug("Request to add secure method [" + name + "] with attributes ["
					+ attr + "]");
		}

		Method[] methods = javaType.getMethods();
		List<Method> matchingMethods = new ArrayList<>();

		for (Method m : methods) {
			if (m.getName().equals(mappedName) || isMatch(m.getName(), mappedName)) {
				matchingMethods.add(m);
			}
		}

		if (matchingMethods.isEmpty()) {
			throw new IllegalArgumentException("Couldn't find method '" + mappedName
					+ "' on '" + javaType + "'");
		}

		// register all matching methods
		for (Method method : matchingMethods) {
			RegisteredMethod registeredMethod = new RegisteredMethod(method, javaType);
			String regMethodName = (String) this.nameMap.get(registeredMethod);

			if ((regMethodName == null)
					|| (!regMethodName.equals(name) && (regMethodName.length() <= name
							.length()))) {
				// no already registered method name, or more specific
				// method name specification now -> (re-)register method
				if (regMethodName != null) {
					logger.debug("Replacing attributes for secure method [" + method
							+ "]: current name [" + name + "] is more specific than ["
							+ regMethodName + "]");
				}

				this.nameMap.put(registeredMethod, name);
				addSecureMethod(registeredMethod, attr);
			}
			else {
				logger.debug("Keeping attributes for secure method [" + method
						+ "]: current name [" + name + "] is not more specific than ["
						+ regMethodName + "]");
			}
		}
	}
Add configuration attributes for a secure method. Mapped method names can end or
start with <code>*</code> for matching multiple methods.

@param javaType target interface or class the security configuration attribute
applies to
@param mappedName mapped method name, which the javaType has declared or inherited
@param attr required authorities associated with the method