Giter Site home page Giter Site logo

ff4j-samples's Introduction

✨✨✨ FF4J - Feature Flipping for Java ✨✨✨

Build Status Backers on Open Collective Sponsors on Open Collective Maven Central codecov

Codacy Badge chat License Apache2

FF4j, is an implementation of the Feature Toggle pattern.

🤘Features

  • Feature Toggle: Enable. and disable features at runtime - no deployments. In your code implement multiple paths protected by dynamic predicates (if/then/else).

  • Role-based Toggling: Enable features not only with flag values but also drive access with roles and groups (Canary Release). Different frameworks supported starting by Spring Security.

  • Strategy-based Toggling: Implement custom predicates (Strategy Pattern) to evaluate if a feature is enabled. Some are provided out of the box: White/Black lists ,Time based, Expression based. Connect external source like a Drools rule engine.

  • AOP-driven Toggling: Keep your code clean and readable: Avoid nested if statements but use annotations. Thanks to Spring AOP target implementation is pick at runtime, and thus driven by feature statuses.

  • Features Monitoring: For each features execution, ff4j evaluates the predicate therefore it's possible to collect and record events, metrics to compute nice dashboards or draw curves for features usage over time.

  • Audit Trail: Each action (create, update, delete, toggles) can be traced and saved in the audit trail for troubleshooting. With permissions management (AuthorizationManager) it's possible to identify users.

  • Web Console: Administrate FF4j (including features and properties) with the web UI. Packaged as a servlet in the library you will expose it in your backend applications. Almost 10 languages available.

  • Wide choice of Databases Our proud: we support 20+ databases technologies to store your features, properties and events. Same business model, multiple implementations. Thanks to extension points it's easy to build your own.

  • Spring Boot Starter Import ff4j-spring-boot-starter dependency in your microservices to get the web console and rest api working immediately. (To be used for the backend app. Now compliant with Spring Boot 2x: 👉 SAMPLES

  • REST Api Operate FF4j through a WEB API. This is the way to go to use ff4j with others languages, specially javascript frontends.(also: leverage on FeatureStoreHttp to avoid microservices to directly connect to the DB.

  • Properties (CMDB) Store not only feature statuses but any property value.. Create properties you can change at runtime . It is integrated with most used frameworks like Spring, Archaius, commons-config or Consul.

  • (Distributed) Cache Evaluating predicates may put pressure on DB (high hit ratio). ff4j provides local and distributed caches to help. (edit feature also evict cache). Leveraging JSR-107 it supports most of cache solutions.

  • Command Line Interface To automate things or because web ports may be blocked (you know, production...) you can work through SSH using our Command Line Interface (cli), our Shell #devOps. It will interact directly with storages.

  • JMX and MBeans Limited set of operations can be performed through JMX. ff4j exposes some Mbeans to read metrics or toggle features from external tools (Nagios...). Not all applications are web based.(batches, shell, standalone...)

More information can be found at ff4j.org or Reference Documentation in the wiki.

🔨 Getting Started

Check the Getting started here

👀 Screenshot

Home Page

Features

Monitoring

👤Contributors

This project exists thanks to all the people who contribute. [Contribute].

Backers

Thank you to all our backers! 🙏 [Become a backer]

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]

ff4j-samples's People

Contributors

alainlompo avatar clun avatar dependabot[bot] avatar drizztguen77 avatar jeromevdl avatar lunascat avatar paul58914080 avatar pierrebesson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ff4j-samples's Issues

FF4J web console doesn't display properly

I am new to FF4J and started with hello world application. I wrote a sample spring boot project and added dependency for ff4j-spring-boot-starter and ff4j-web modules in my pom.xml.

However, when I run the application, the FF4J web console is displayed distracted.
Below is my pom.xml for your reference
Screen Shot 2020-09-23 at 7 34 41 PM

Below is the web console that i can see

Screen Shot 2020-09-23 at 7 34 56 PM

Below are my configuration classes.

Screen Shot 2020-09-24 at 10 42 05 AM

Screen Shot 2020-09-24 at 10 42 19 AM

Please check and help what i am missing and how do i get web console properly.

Unable to make work the ff4j web console

Can someone point to me a project that has web console + rest API and it builds successfully?

So far I tried the following project(and many more) and was unsuccessful:
ff4j-sample-springboot-starter
ff4j-sample-springboot
ff4j-sample-springboot2
ff4j-sample-springboot-jdbc

Once I switch the version from <ff4j.version>1.9-SNAPSHOT</ff4j.version> to <ff4j.version>1.8.4</ff4j.version> it runs and the REST API works but the web console doesn't work.
Once I hit http://localhost:8080/ff4j-web-console/home
it gives me below message in the browser:
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.

Mon Apr 06 13:40:57 PDT 2020
There was an unexpected error (type=Not Found, status=404).
No message available

sample with spring boot

Hi there,

sorry for asking again.

Is there a sample project which combines the REST API (with Swagger doc), Spring jdbc and the admin web console?
Like the other project you created (ff4j-sample-simplejdbc)?

Or how can I integrate swagger doc into the ff4j-sample-jdbc example?

Thank you in advance.

Swagger conflict

hi,
when i integrate ff4j according to this sample, i got ,
Caused by: org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name 'swaggerConfig' for bean class [org.ff4j.spring.boot.web.api.config.SwaggerConfig] conflicts with existing, non-compatible bean definition of same name and class [com.phoenix.common.swagger.SwaggerConfig]

how to fix this, thanks

Invalid <url-pattern> [ff4j-web-console/*] in servlet mapping

Hi, I am trying to embed the ff4j functionality in my existing spring boot application
Followed all the steps as per the ff4j release 1.8.6, jumped to spring boot 2.2.7, still getting the below error
Full Stack trace -

14:01:15.212 ERROR org.springframework.boot.web.embedded.tomcat.TomcatStarter : Error starting Tomcat context. Exception: java.lang.IllegalArgumentException. Message: Invalid [ff4j-web-console/] in servlet mapping
14:01:15.296 ERROR org.springframework.boot.SpringApplication : Application run failed
org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:156)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:544)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)
at com.streamlinx.snapsource.SnapsourceApplication.main(SnapsourceApplication.java:22)
Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:125)
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.(TomcatWebServer.java:87)
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:437)
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:191)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:180)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:153)
... 8 common frames omitted
Caused by: java.lang.IllegalArgumentException: Invalid [ff4j-web-console/
] in servlet mapping
at org.apache.catalina.core.StandardContext.addServletMappingDecoded(StandardContext.java:3183)
at org.apache.catalina.Context.addServletMappingDecoded(Context.java:881)
at org.apache.catalina.core.ApplicationServletRegistration.addMapping(ApplicationServletRegistration.java:196)
at org.springframework.boot.web.servlet.ServletRegistrationBean.configure(ServletRegistrationBean.java:194)
at org.springframework.boot.web.servlet.ServletRegistrationBean.configure(ServletRegistrationBean.java:51)
at org.springframework.boot.web.servlet.DynamicRegistrationBean.register(DynamicRegistrationBean.java:113)
at org.springframework.boot.web.servlet.RegistrationBean.onStartup(RegistrationBean.java:53)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.selfInitialize(ServletWebServerApplicationContext.java:228)
at org.springframework.boot.web.embedded.tomcat.TomcatStarter.onStartup(TomcatStarter.java:53)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5140)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:841)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1384)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1374)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:909)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:421)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Tomcat.start(Tomcat.java:468)
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:106)
... 13 common frames omitted

Process finished with exit code 1

We do have our own WebSecurityConfig, where i tried to add the ff4j-wen-console/* to permitted URL, still cant get rid of the error.

.antMatchers("/ff4j-web-console/*").permitAll();

Can you please let me know the issue, what i am missing here. Thanks

modal dialog box does not come up in web console

When using the latest spring boot sample and trying to edit either a property or a feature, the modal dialog box does not come up.

I tested with chrome and firefox and ff4j 1.6.5.

If I delete the templates folder, delete css, js, img, fonts folders from resources/static and copy the resources from the ff4j-sample-web/src/main/webapp project then everything seems functional but the button colors for edit/remove in property and feature list does not render correctly. The demo/ url does not work either since I guess it uses the templates for that.

FF4J Swagger not working

When trying to access the Swagger UI for documentation I'm getting the following in my browser:

{"uptime":"0 day(s) 0 hours(s) 2 minute(s) 42 seconds"","autocreate":true,"version":"1.8.11","featuresStore":{"type":"org.ff4j.audit.proxy.FeatureStoreAuditProxy","numberOfFeatures":5,"numberOfGroups":2,"features":["AwesomeFeature","first","second","third","forth"],"groups":["GRP0","GRP1"],"cache":null},"eventRepository":{"type":"org.ff4j.audit.repository.InMemoryEventRepository","eventsPie":{"title":"Total Hit Counts FROM 20211211 TO 20211212","sectors":[]},"barChart":{"title":"HitCounts Distribution FROM 20211211 TO 20211212","labels":[],"series":[]},"hitCount":0},"authorizationsManager":null}

This is on URL: http://localhost:8080/api/ff4j/

Under project: ff4j-sample-springboot2x

Is there a missing configuration or setup step?

My expectation is the swagger for the ff4j-sample-springboot2x project would look similar to the following:

https://ff4j.herokuapp.com/swagger-ui.html

Thanks,
Travis

ff4j with micro services

Hi,

Do you have any sample to showcase ff4j with microservices implementation. Basically, how we can manage features in ff4j database and the same features should be available for multiple services running on multiple JVMS.

Audit logging not working

Hi there,

thank you for uploading the ff4j-sample-simplejdbc sample.
But i am not able to get the audit working.

Do you know what the reason could be?

Thanks,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.