Implementing an AccessBlock Service Maintenance System Based on Vue.js and Spring AOP
Key point
This introduces the frontend and backend implementation logic and Redis data management approach for the AccessBlock system, which blocks access during service maintenance using Vue.js routing and Spring AOP.
Details
Frontend Access Control Logic
In the Vue.js-based frontend, the beforeEach method of VueRouter is used to check whether access is blocked before routing. It asynchronously calls the API defined in the Store to check whether the current path (to.path) is a blocked target, and if the block response is true, it forcibly redirects to the /unavailable path. The paths /unavailable, /login, /logout, and /block are exception targets for blocking, so they are not checked for block status.
Backend AOP-Based API Blocking
The backend uses Spring AOP to inspect all requests coming into the RestController. Through an @Around advice, it determines whether to block requests that satisfy the controllerPointcut and notExcludeAccessBlockAnnotated conditions. If a request is a blocking target, an InboundServiceException is thrown, and classes or methods with the @ExcludeAccessBlock annotation declared are excluded from Aspect execution. The block determination logic was separated into its own domain, and test code was written for it.
Data Management Using Redis
Metadata is synchronized from Google Sheets through BigQuery to Redis. Through a batch job running every 3 minutes, the metadata is fully deleted and re-saved, stored in the List type. On the other hand, execution data, which involves frequent additions and deletions, is stored in the Hash type, which allows for easy Key control. Execution data is registered and retrieved via Swagger, and IDs are issued based on UUID. Blocking is executed immediately upon registration, and upon deletion, the block is immediately lifted using the input ID.
This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.
Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.