https://github.com/neshkeev/spring-proxy-demo
The project reveals the mechanics behind Spring Framework's magic
https://github.com/neshkeev/spring-proxy-demo
proxy spring
Last synced: 2 months ago
JSON representation
The project reveals the mechanics behind Spring Framework's magic
- Host: GitHub
- URL: https://github.com/neshkeev/spring-proxy-demo
- Owner: neshkeev
- License: apache-2.0
- Created: 2023-07-27T15:39:22.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2023-07-27T18:07:34.000Z (almost 3 years ago)
- Last Synced: 2025-01-31T04:08:00.713Z (over 1 year ago)
- Topics: proxy, spring
- Language: Java
- Homepage:
- Size: 47.9 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://gitpod.io/#https://github.com/neshkeev/spring-proxy-demo)
# Overview
The repository reveals the "magic" behind Spring Framework. As a demo it automatically configures JMX MBeans for spring beans that are annotated with `@JmxExporter`.
**IMPORTANT**: the application is built on top of Spring Boot 3.1.2, which supports only Java 17, so `JAVA_HOME` should point at a JDK 17 distribution.
## Quick start
0. Set `JAVA_HOME` to point at JDK17;
1. Clone the repository:
```bash
git clone https://github.com/neshkeev/spring-proxy-demo && cd spring-proxy-demo
```
2. Start the application:
```bash
./mvnw spring-boot:run
```
3. Add a consumer:
```bash
curl http://localhost:8080/customers \
-X POST \
-H "Content-type: application/json" \
-d '{"id":0,"name":"Hello, World!", "active": true}'
```
3. Start `jconsole`:
```bash
jconsole
```
4. Find the `com.github.neshkeev.spring.proxy.Main` process and connect to it;
5. Go to `MBeans`;
6. In the left panel unfold `com.github.neshkeev.spring.proxy.rest` | `basic` | `customerController` | `Operations` | `get`;
7. Click on the `get` button.
## Run tests with maven
The repository contains tests that can be executed with maven:
- Run all tests:
```bash
./mvnw clean test
```
- Run a specific test:
```bash
./mvnw clean test -Dtest=com.github.neshkeev.spring.proxy.rest.CustomerControllerJMXTest
```
## Run the application with Intellij IDEA
If you open the repository in Intellij IDEA you can run the application and it's tests with predefined run configurations:
1. `Main` starts the Spring Boot application with a rest controller and registered MBeans;
1. `HelloWorldInvocationHandlerTest` starts a Spring Boot test that demonstrates the simplest proxy;
1. `PasswordGeneratorInvocationHandlerTest` starts a Spring Boot test for password generators;
1. `LoggerWrapperInvocationHandlerTest`
1. `CustomerControllerJMXTest` starts Spring Boot tests that checks registered JMX MBeans;