@Bean
	public FilterRegistrationBean<?> eurekaVersionFilterRegistration(ServerProperties serverProperties,
			Environment env) {
		final String contextPath = serverProperties.getServlet().getContextPath();
		String regex = EurekaConstants.DEFAULT_PREFIX + STATIC_CONTENT_PATTERN;
		if (StringUtils.hasText(contextPath)) {
			regex = contextPath + regex;
		}
		String debugResponseHeader = env.getProperty("eureka.server.version.filter.debug.response-header");
		boolean addDebugResponseHeader = StringUtils.hasText(debugResponseHeader);
		Pattern staticPattern = Pattern.compile(regex);
		FilterRegistrationBean<Filter> bean = new FilterRegistrationBean<>();
		bean.setFilter(new OncePerRequestFilter() {
			@Override
			protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response,
					FilterChain filterChain) throws ServletException, IOException {
				HttpServletRequest req = request;
				String requestURI = request.getRequestURI();
				if (!requestURI.startsWith(EurekaConstants.DEFAULT_PREFIX + "/v2")
						// don't forward static requests (images, js, etc...) to /v2
						&& !staticPattern.matcher(requestURI).matches()) {

					String prefix = EurekaConstants.DEFAULT_PREFIX;
					if (StringUtils.hasText(contextPath)) {
						prefix = contextPath + prefix;
					}
					String updatedPath = EurekaConstants.DEFAULT_PREFIX + "/v2" + requestURI.substring(prefix.length());
					if (StringUtils.hasText(contextPath)) {
						updatedPath = contextPath + updatedPath;
					}
					final String computedPath = updatedPath;
					// only used if a special debug property is set, so in prod this is
					// always skipped.
					if (addDebugResponseHeader) {
						response.addHeader(debugResponseHeader, computedPath);
					}
					HttpServletRequestWrapper wrapper = new HttpServletRequestWrapper(request) {
						@Override
						public String getRequestURI() {
							return computedPath;
						}

						@Override
						public String getServletPath() {
							return computedPath;
						}
					};
					req = wrapper;
				}
				filterChain.doFilter(req, response);
			}
		});
		bean.setOrder(0);
		bean.setUrlPatterns(Collections.singletonList(EurekaConstants.DEFAULT_PREFIX + "/*"));

		return bean;
	}
Register the Jersey filter.
@param eurekaJerseyApp an {@link Application} for the filter to be registered
@return a jersey {@link FilterRegistrationBean}
spring-cloud-netflix-eureka-server/src/main/java/org/springframework/cloud/netflix/eureka/server/EurekaServerAutoConfiguration.java