@EnableZuulProxy doesn't work under a servlet 2.5 container. Is there any workaround to get spring-cloud zuul work under a servet 2.5 container?
Also I could not find the annotation processor of @EnableZuulProxy. Please provide the class which propesses @EnableZuulProxy so that I can better understand what this annotation really does.
Spring cloud Zuul with servlet-api 2.5
1.3k Views Asked by Fahim Farook At
2
There are 2 best solutions below
1
Dave Syer
On
@EnableZuulProxy is from Spring Cloud which is based on Spring Boot which is Servlet 3.0 and above. If you need to use Servlet 2.5 you can use the Netflix APIs directly.
@EnableZuulProxy is meta-annotated with @Import(ZuulProxyConfiguration.class) so I guess that's what you mean when you say "propesses"? If you don't know what an @Import is, go and read up on Spring.
Related Questions in JAVA
- I need the BIRT.war that is compatible with Java 17 and Tomcat 10
- Creating global Class holder
- No method found for class java.lang.String in Kafka
- Issue edit a jtable with a pictures
- getting error when trying to launch kotlin jar file that use supabase "java.lang.NoClassDefFoundError"
- Does the && (logical AND) operator have a higher precedence than || (logical OR) operator in Java?
- Mixed color rendering in a JTable
- HTTPS configuration in Spring Boot, server returning timeout
- How to use Layout to create textfields which dont increase in size?
- Function for making the code wait in javafx
- How to create beans of the same class for multiple template parameters in Spring
- How could you print a specific String from an array with the values of an array from a double array on the same line, using iteration to print all?
- org.telegram.telegrambots.meta.exceptions.TelegramApiException: Bot token and username can't be empty
- Accessing Secret Variables in Classic Pipelines through Java app in Azure DevOps
- Postgres && statement Error in Mybatis Mapper?
Related Questions in SPRING
- HTTPS configuration in Spring Boot, server returning timeout
- Multi Tenancy in Spring - Partitioned Data Approach
- How to create beans of the same class for multiple template parameters in Spring
- org.telegram.telegrambots.meta.exceptions.TelegramApiException: Bot token and username can't be empty
- Springboot: How to get an entity optional property and check null?
- How do I propagate the current SecurityContext to my @RabbitListener in Spring Boot?
- Spring's XML based bean configuration for Object Mapper's Case Insensitive property
- Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured. I'm using Postgresql
- springboot class org.hibernate.mapping.Bag cannot be cast to class org.hibernate.mapping.SimpleValue
- Issue while deploying JDK 17 and Spring 6 application in Tomcat 10.1.20
- Spring JPA Data Auditing - How to design it?
- Springframework test: Async not started
- Error: Cannot invoke "jakarta.servlet.http.HttpSession.getAttribute(String)" because "session" is null
- How does spring-retry determine which methods to retry when @Retryable is placed at the class level?
- problem with edge server registration in Eureka
Related Questions in SPRING-CLOUD
- problem with edge server registration in Eureka
- DiscoveryServerUrlInvalidException: spring.cloud.kubernetes.discovery-server-url must be specified and a valid URL
- Handling feign exception in Spring boot using RestControllerAdvice
- No propertes through config server on browser
- Consider defining a bean of type 'org.springframework.cloud.circuitbreaker.resilience4j.Resilience4JCircuitBreakerFactory' in your configuration
- ApiGateway is not routing the api call
- How can Spring Eureka client check local Eureka Server first, then fallback to deployed Server if no local instance registered
- How to implement aws secret manager for multiple project applications
- Spring + Keycloak: Gateway Docker container returns 404
- How to import properties from AWS Secret Manager in Spring Cloud Config Server?
- How do you test Spring Cloud Gateway's RouteLocator?
- Null request id when subscribe to the topic
- Switch between static and dynamic Azure App Configuration service
- Service are not registered in Eureka Server with docker-compose. Spring boot 3
- Timelimiter still saves order after timeout in spring boot 6.2.2
Related Questions in NETFLIX-ZUUL
- Zuul still routing to the instance of the application that are dead
- Write custom ribbonroutingfilter zuul for 1 route and default ribbonroutingfilter for rest of the zuul routes
- How to create currentContext object in spring cloud gateway?
- Zuul ServiceId route is not working on CloudFoundry
- i want to modify response by using zuul filter
- Zuul Response filter getting blocked for sometime intermittently
- Simulate latency and timeout between two microservices
- netflix zuul1, a strange phenomenon of uploading large files with multipart file?
- Zuul Proxy Routing to WebSocket service
- Zuul compatability with Spring boot 3
- Zuul settings in the application.yml doesn't work, just showing 404
- Is it possible to replace Spring Cloud Netflix Zuul with Spring Cloud Gateway in an Spring MVC App?
- Is "zuul.sensitiveHeaders: true" valid and useful for Spring Boot Zuul?
- Why this public endpoints returns 404?
- How to get request and response as string after RequestDispatcher forward
Related Questions in SERVLET-2.5
- How to generate xy line chart using OrsonPDF using itextPDF and Jfreechart for response on request?
- Tomcat 6 vs 7 broke default and jsp servlet requests (404)
- What does Jersey2 follows? Servlet-2 or Servlet-3 specifications
- Jersey 2 status code not visible in HttpServletResponseWrapper
- Tomcat log filter not encoding response body properly
- Redirection to Angular2 page from Servlet results in 404
- Doesn't work Spring Boot legacy in my project
- Spring mvc compatibile with Servlet 2.5
- Does Spring Session require servlet 3.0?
- JSF and basic authentification
- Spring cloud Zuul with servlet-api 2.5
- Application does not start with Spring Boot 1.2.1 + Spring Security + Servlet 2.5
- Set session tracking mode to cookie in Servlet 2.5
- Spring 4 mvc + security for servlet 2.5 in JBoss5.1.0.GA
- Can I keep web.xml version 2.4 even if I am actually using Servlet-api jar version 3.0
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Spring Cloud is meant to be run on servlet 3.0. That being said, it is possible to get @EnableZuulProxy running on servlet 2.5. I had to figure out a hack for this as I had to get this working in Tomcat 6.
The main issue is due to the ZuulConfiguration.class, which has the method:
The issue here is that
ServletRegistrationBeanusesjavax.servlet.Registration$Dynamic, which is not available until Servlet 3.0. This results in aNoClassDefFoundError.To work around this, use the spring-boot-legacy project to first register a DispatcherServlet. Secondly, you'll have to manually create a zuul servlet.
web.xml
I found the best way to remove the auto servlet registration, is to just make a verbatim copy of
ZuulConfigcalledZuulOverrideConfig, and remove thezuulServlet()method. This is because theZuulProxyConfigurationextendsZuulConfiguration, and it seemed to create the bean even when i tried to override it. I'm not 100% on the mechanics behind this, so there may be a better way.The second change I made in
ZuulOverrideConfigwas to call an extended implementation ofZuulFilterInitializer, called 'LegacyZuulFilterInitializer`. This is because for some reason, the Zuul servlet was being crated, and able to be invoked, but no filters were bootstrapped. This extension is a hacky way to get the filters to bootstrap.Next, I created a copy of
ZuulProxyConfigurationcalledZuulLegacyProxyConfiguraiton, and had it extendZuulOverrideConfig.class.Finally, I annotated the Application class as follows.
After all these hacks, the implementation finally worked as expected. I wouldn't suggest using this for long, as it's pretty hacky. You won't get configuration class updates automatically when moving to new versions, and I can't guarantee that something won't break randomly!
This is using Spring Cloud 1.1.4.RELEASE
Gist of all the code.