{"id":19448548,"url":"https://github.com/vnt-dev/jsonweb","last_synced_at":"2025-06-17T10:10:39.285Z","repository":{"id":105577343,"uuid":"329318340","full_name":"vnt-dev/jsonweb","owner":"vnt-dev","description":null,"archived":false,"fork":false,"pushed_at":"2021-03-25T02:50:46.000Z","size":36,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-25T08:54:12.011Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vnt-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-13T13:34:19.000Z","updated_at":"2021-03-25T02:50:48.000Z","dependencies_parsed_at":"2024-03-25T16:48:29.408Z","dependency_job_id":null,"html_url":"https://github.com/vnt-dev/jsonweb","commit_stats":null,"previous_names":["vnt-dev/jsonweb"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/vnt-dev/jsonweb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vnt-dev%2Fjsonweb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vnt-dev%2Fjsonweb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vnt-dev%2Fjsonweb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vnt-dev%2Fjsonweb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vnt-dev","download_url":"https://codeload.github.com/vnt-dev/jsonweb/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vnt-dev%2Fjsonweb/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260336343,"owners_count":22993740,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T16:27:28.796Z","updated_at":"2025-06-17T10:10:34.271Z","avatar_url":"https://github.com/vnt-dev.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 一个简易的web框架\n参照springboot的功能使用java实现如下操作\n### 功能示例\n\n#### 1. 配置文件\n    ```\n    #支持yml和properties两种格式\n    web:\n      profiles:\n        active: local #指定读取配置文件\n      port: 8080      #web服务器端口\n    ```\n\n#### 2. 读取配置，支持字符串注入，支持基础数据类型和其包装类以及数组\n\n```\n    @Value(\"string\")\n    private String string;\n    @Value(\"integer:1\")\n    private int integer;\n    @Value(\"strings:1,2\")\n    private String[] strings;\n    @Value(\"integers:1,2\")\n    private Integer[] integers;\n    @Value(\"ints:1,2\")\n    private int[] ints;\n    @Value(\"def:true\")\n    private Boolean def;\n```\n\n#### 3. 实例化到容器和获取引用\n```\n@Component\npublic class TestServiceImpl implements TestService {\n    @Resource\n    private TestConfig testConfig;\n\n    @Override\n    public int sum(int num1, int num2) {\n        return num1 + num2;\n    }\n\n    @Override\n    public TestConfig getConfig() {\n        return testConfig;\n    }\n}\n\n@Configuration\npublic class TestConfig {\n    @Bean\n    public String testBean(){\n        return \"testBean\";\n    }\n}\n```\n#### 4. aop切面\n```\n//设置需要拦截的类路径\n@Aspect(\"com.top.service.*\") \npublic class AspectTest {\n    @Value(\"key\")\n    private String key;\n\n    private static final ThreadLocal\u003cLong\u003e LONG_THREAD_LOCAL = new ThreadLocal\u003c\u003e();\n\n    @Before\n    public void before() {\n        LONG_THREAD_LOCAL.set(System.currentTimeMillis());\n        System.out.println(\"AspectTest before:\" + key);\n    }\n\n    @Around\n    public Object doAround(JoinPoint joinPoint) throws InvocationTargetException, IllegalAccessException {\n        Object object = joinPoint.proceed();\n        System.out.println(\"AspectTest 环绕触发：\" + object);\n        return object;\n    }\n\n    @After\n    public void after() {\n        System.out.println(\"AspectTest after:\" + (System.currentTimeMillis() - LONG_THREAD_LOCAL.get()) + \"(ms)\");\n    }\n}\n\n```\n#### 5. 控制器\n```\n@RestController(\"/url\")\npublic class TestController {\n    @Value(\"key\")\n    private String key;\n    @Resource\n    private TestService testService;\n\n    @GetMapping(\"/get\")\n    public String test(@RequestParam(\"a\") int a, int b) {\n        return key + testService.sum(a, b);\n    }\n\n    @PostMapping(\"/get\")\n    public String test(@RequestParam(\"a\") int a, int b, @RequestBody Map\u003cString, Object\u003e msg) {\n        return msg.toString() + testService.sum(a, b);\n    }\n\n    @PostMapping(\"/post\")\n    public TestConfig post(@RequestParam(\"a\") int a, int b, @RequestBody Map\u003cString, Object\u003e msg) {\n        return testService.getConfig();\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvnt-dev%2Fjsonweb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvnt-dev%2Fjsonweb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvnt-dev%2Fjsonweb/lists"}