Java Code Examples for org.springframework.web.bind.annotation.ControllerAdvice#basePackageClasses()

The following examples show how to use org.springframework.web.bind.annotation.ControllerAdvice#basePackageClasses() . 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: ControllerAdviceBean.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private static Set<String> initBasePackages(ControllerAdvice annotation) {
	Set<String> basePackages = new LinkedHashSet<String>();
	for (String basePackage : annotation.basePackages()) {
		if (StringUtils.hasText(basePackage)) {
			basePackages.add(adaptBasePackage(basePackage));
		}
	}
	for (Class<?> markerClass : annotation.basePackageClasses()) {
		basePackages.add(adaptBasePackage(ClassUtils.getPackageName(markerClass)));
	}
	return basePackages;
}
 
Example 2
Source File: ControllerAdviceBean.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
private static Set<String> initBasePackages(ControllerAdvice annotation) {
	Set<String> basePackages = new LinkedHashSet<String>();
	for (String basePackage : annotation.basePackages()) {
		if (StringUtils.hasText(basePackage)) {
			basePackages.add(adaptBasePackage(basePackage));
		}
	}
	for (Class<?> markerClass : annotation.basePackageClasses()) {
		basePackages.add(adaptBasePackage(ClassUtils.getPackageName(markerClass)));
	}
	return basePackages;
}