revert: 去除prod-api对外转发
parent
aa7a161421
commit
e2754bfe21
@ -1,36 +0,0 @@
|
||||
package com.xydl.cac.config;
|
||||
|
||||
import org.mitre.dsmiley.httpproxy.ProxyServlet;
|
||||
import org.springframework.boot.context.properties.bind.BindResult;
|
||||
import org.springframework.boot.context.properties.bind.Binder;
|
||||
import org.springframework.boot.context.properties.source.ConfigurationPropertySources;
|
||||
import org.springframework.boot.web.servlet.ServletRegistrationBean;
|
||||
import org.springframework.context.EnvironmentAware;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
@Configuration
|
||||
public class SolrProxyServletConfiguration implements EnvironmentAware {
|
||||
|
||||
@Bean
|
||||
public ServletRegistrationBean servletRegistrationBean() {
|
||||
Properties properties = (Properties) bindResult.get();
|
||||
ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new ProxyServlet(), properties.getProperty("servlet_url"));
|
||||
servletRegistrationBean.addInitParameter(ProxyServlet.P_TARGET_URI, properties.getProperty("target_url"));
|
||||
servletRegistrationBean.addInitParameter(ProxyServlet.P_LOG, properties.getProperty("logging_enabled", "false"));
|
||||
return servletRegistrationBean;
|
||||
}
|
||||
|
||||
private BindResult bindResult;
|
||||
|
||||
@Override
|
||||
public void setEnvironment(Environment environment) {
|
||||
Iterable sources = ConfigurationPropertySources.get(environment);
|
||||
Binder binder = new Binder(sources);
|
||||
BindResult bindResult = binder.bind("proxy.solr", Properties.class);
|
||||
this.bindResult = bindResult;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue