question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I tried to implement rate limiting in spring boot with spring cloud netflix rate limiter

See original GitHub issue

These are the dependencies that I added

Spring boot: 1.5.4

compile('org.springframework.cloud:spring-cloud-starter-netflix-zuul')
compile group: 'com.marcosbarbero.cloud', name: 'spring-cloud-zuul-ratelimit', version: '1.7.5.RELEASE'

properties

zuul.ratelimit.enabled=true
zuul.ratelimit.repository=JPA
zuul.ratelimit.policy-list.serviceSimple.limit=1
zuul.ratelimit.policy-list.serviceSimple.refresh-interval=60
zuul.ratelimit.policy-list.serviceSimple.type=url
zuul.ratelimit.key-prefix=rate
zuul.strip-prefix: true

When I try to run the application an error shows that my domain classes aren’t a managed type

caused by: java.lang.IllegalArgumentException: Not a managed type: <My entity class>
	at org.hibernate.jpa.internal.metamodel.MetamodelImpl.managedType(MetamodelImpl.java:210) ~[hibernate-entitymanager-5.0.12.Final.jar:5.0.12.Final]
	at org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation.<init>(JpaMetamodelEntityInformation.java:70) ~[spring-data-jpa-1.11.9.RELEASE.jar:na]
	at org.springframework.data.jpa.repository.support.JpaEntityInformationSupport.getEntityInformation(JpaEntityInformationSupport.java:68) ~[spring-data-jpa-1.11.9.RELEASE.jar:na]
	at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getEntityInformation(JpaRepositoryFactory.java:173) ~[spring-data-jpa-1.11.9.RELEASE.jar:na]
	at org.springframework.data.envers.repository.support.EnversRevisionRepositoryFactoryBean$RevisionRepositoryFactory.getTargetRepository(EnversRevisionRepositoryFactoryBean.java:106) ~[spring-data-envers-1.1.9.RELEASE.jar:na]
	at org.springframework.data.envers.repository.support.EnversRevisionRepositoryFactoryBean$RevisionRepositoryFactory.getTargetRepository(EnversRevisionRepositoryFactoryBean.java:77) ~[spring-data-envers-1.1.9.RELEASE.jar:na]
	at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:200) ~[spring-data-commons-1.13.9.RELEASE.jar:na]
	at org.springframework.data.envers.repository.support.EnversRevisionRepositoryFactoryBean$RevisionRepositoryFactory.getRepository(EnversRevisionRepositoryFactoryBean.java:143) ~[spring-data-envers-1.1.9.RELEASE.jar:na]
	at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.initAndReturn(RepositoryFactoryBeanSupport.java:277) ~[spring-data-commons-1.13.9.RELEASE.jar:na]
	at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:263) ~[spring-data-commons-1.13.9.RELEASE.jar:na]
	at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:101) ~[spring-data-jpa-1.11.9.RELEASE.jar:na]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624) ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]
	... 42 common frames omitted

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:20 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
marcosbarberocommented, May 20, 2020

It would be great if you could apply code formatting to your inputs, it makes it a little hard to read without the formatting. You can follow this link to learn how to do it https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code

0reactions
sharunthomascommented, May 21, 2020

Great! It works now

I changed ‘policies’ to ‘policy-list’ , now its working. @marcosbarbero Thank you

Read more comments on GitHub >

github_iconTop Results From Across the Web

Rate Limiting in Spring Cloud Netflix Zuul - Baeldung
Learn how to rate limit requests using Spring Cloud Zuul. ... It adds some specific features for Spring Boot applications.
Read more >
API Rate Limiting with Spring Cloud Gateway
Rate limiting is a technique to control the rate by which an API ... spring.cloud.gateway.filter.request-rate-limiter.deny-empty-key=false
Read more >
Adding Rate Limit for Spring Cloud Netflix Zuul
All the rate-limiting implementation is done using Zuul Filters and applying the validations based on the configuration set per service, in case ...
Read more >
Secure Rate Limiting with Spring Cloud Gateway
In this article, you will learn how to configure rate limiting with Spring Cloud Gateway for authenticated user with Spring Security.
Read more >
Rate Limiting In Spring Cloud Gateway With Redis
Currently Spring Cloud Gateway is second the most popular Spring Cloud project just after Spring Cloud Netflix (in terms of number of stars ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found