mkopylec / charon-spring-boot-starter

Reverse proxy implementation in form of a Spring Boot starter.
Apache License 2.0
240 stars 54 forks source link

Incompatibility with Spring Boot 2.0 #47

Closed johnnyvdberg closed 6 years ago

johnnyvdberg commented 6 years ago

I tried loading in the dependency for a Spring Boot 2.0 project, however they made some minor abstractions in the ServerProperties class, breaking this starter.

Currently you use this line of code in MappingsProvider and RequestForwarder: return correctUri(server.getContextPath()) + mapping.getPath(); While Spring Boot 2 requires: return correctUri(server.getServlet().getContextPath()) + mapping.getPath(); Can we support both versions?

BenEfrati commented 6 years ago

You can extend ConfigurationMappingsProvider and @Override concatContextAndMappingPaths

@Component("mappingsProvider")
public class ProxyMappingProvider extends ConfigurationMappingsProvider {

    public ProxyMappingProvider(ServerProperties server, CharonProperties charon, MappingsCorrector mappingsCorrector, HttpClientProvider httpClientProvider) {
        super(server, charon, mappingsCorrector, httpClientProvider);
    }

    @Override
    protected String concatContextAndMappingPaths(MappingProperties mapping) {
        return correctUri(server.getServlet().getContextPath()) + mapping.getPath();
    }

}
mkopylec commented 6 years ago

@BenEfrati fix should be good for now. Full support for Spring Boot 2 and Spring 5 is planned but I can't tell you when it will be done. I would like to also include webflux support.