搜尋

搜尋結果

Don't relaxvigilance against evil-doers
玄學星相
熊神進・2016-07-07

There was a pornographic website contacting me before. They wanted me to write an women’ lascivious physiognomy on their website but I refused. From my professional ethics, physiognomy is not divided into immorality, lowliness, hero and rogue. Everything is from “heart “(attitude, behavior, conduct)". No one can figure out that a baby will become a national leader or a thief from its physiognomy of eyes, ears, nose and mouth after growing up. What an irresponsible wording is. More compelling way is to provide some information to them that it will develop into these results only if you don’t pay attention to personal behavior. If the girl's eyebrows are too narrow which will let her boyfriend worry. In general eyebrows can analyze a person's social skills. With thicker eyebrows, the people are more optimistic. Therefore, they have better relationship with friends. But you have to pay attention that it is a complex society, human nature is. The relationship with friends means you get along with strangers. You have chance to be exploited and betrayed by your friends even if you have a good relationship with them. I have a friend who is a police officer with shaggy eyebrows.The distance between two eyebrows is less than the width of a finger. Because of her special occupation, she often drinks alcohol and entertain with subordinates and friends.I have given her some advices that you must notrelax vigilance against evil-doers. But she said no one would offend her as her job. Three years ago, she came to my office to see me. It was the first time that I saw her cry. Her crying is not because of her wayward behavior, but her radical personality and strong subjectivity. Therefore, she will not accept other suggestion. Due to study crime psychology, I understand psychology of friends’ of rape very well.I repeatedly reminded her many times. 1)Must watch and drink the beverage which is pour out from the unopened bottle . 2)Never let the cup leave your sight and change the new one if you go to toilet, singing and dancing. 3) Make an appointment with boyfriend, trusted friends and family to pick up you in advance. Don’t go home alone or by their cars, preferring to take a taxi. ■作者:熊神進(澳門玄學家),E-mail:fortune@macau.ctm.net 如有任何問題,歡迎聯絡: 林小姐: 13726267799(晚8時後) 熊神進:澳門 853-66618785 Facebook: 熊神進(澳門風水師) 公共微信: macaumasterxiong 淘寶風水法器店:http://macauhung.taobao.com

Spring boot 10 - openapi 生成器 - spring boot java client
科技新知
MacauYeah・2025-08-19

之前我們在介紹Spring Boot Web 調試工具 ,就試安裝 openapi 相關的元件。其實 openapi 並不單是為了提供 swagger 測試介面,它主要是提供一個描述的方式,讓我們針對一個特定 openapi 文件,生成對應的 api server 或 api client 接口。也就是,如果 server 方有提供該文件,道理上可以經 openapi 的工具,生成一個可以直接訪問 server 的 client library。本節,可以沿用之前的 spring boot web api doc ,為它產生一個client library 作為實驗。 在生成 client library 之前,我們還需要一個工具 openapi-generator-cli 。最簡單的取得方式,就是經過 npm , 在你需要生成 client library 的專案中,安裝你需要的 openapi-generator-cli 版本。 npm install @openapitools/openapi-generator-cli 那怕你不是使用 nodejs 作為開發,也可以經過這個方法安裝。它只提供使用 cmd 指令的捷徑。 生成 Java Client Library 我們先把 backend server 起好 cd somewhere && mvn spring-boot:run,然後使用 openapi-generator-cli 去生成以 java spring boot 3 為底的 client library 。 npx openapi-generator-cli generate \ -i http://localhost:8080/v3/api-docs \ --api-package io.github.macauyeah.springboot.tutorial.openapiclient.api \ --model-package io.github.macauyeah.springboot.tutorial.openapiclient.model \ --invoker-package io.github.macauyeah.springboot.tutorial.openapiclient.invoker \ --group-id io.github.macauyeah.springboot.tutorial \ --artifact-id spring-boot-web-api-open-api-client \ --artifact-version 0.0.1-SNAPSHOT \ -g java \ -p useJakartaEe=true \ -p useSpringBoot3=true \ --library webclient \ -o spring-boot-web-api-open-api-client 生成的 source code 就像是 spring-boot-web-api-open-api-client ,具體的使用方式,可以看看測試用例 ApiControllerApiTest.java private final ApiControllerApi api = new ApiControllerApi(); @Test public void postDateQueryTest() { // default call ApiDateRequest apiDateRequest = new ApiDateRequest(); apiDateRequest.setInputDate(OffsetDateTime.now()); LOG.debug("default web client postDateQuery:{}", api.postDateQuery(apiDateRequest).block()); // replace webClient in ApiClient if you have special auth config on // webClient, you can also change basePath during new obj creation ObjectMapper mapper = new ObjectMapper(); mapper.setDateFormat(new SimpleDateFormat()); mapper.registerModule(new JavaTimeModule()); WebClient webClient = WebClient.builder() .codecs(configurer -> { configurer.defaultCodecs().jackson2JsonDecoder(new Jackson2JsonDecoder(mapper)); configurer.defaultCodecs().jackson2JsonEncoder(new Jackson2JsonEncoder(mapper)); }) .build(); ApiControllerApi api2 = new ApiControllerApi( new ApiClient(webClient) .setBasePath("http://localhost:8080/")); LOG.debug("create api2 by local web client postDateQuery:{}", api2.postDateQuery(apiDateRequest).block()); // use webClient directly String response = webClient.post().uri("http://localhost:8080/api/record").bodyValue(apiDateRequest).retrieve() .bodyToMono(String.class).block(); LOG.debug("request by local web client postDateQuery:{}", response); } 上述例子中,如果大家沒有任何特殊要求,其實經過 api.postDateQuery(apiDateRequest).block() 就完成了。有需要改 api endpoint 的,只要生成新的 ApiClient 並設定 basePath new ApiClient().setBasePath("XXXXXX") 就好。真的要加入更多權限設定,就需要生成新的 ApiClient 並設定 webClient new ApiClient(webClient) 這個生成的 Java Client Library 道理上還是要經過 maven 等打包,變成 jar 檔,才能被其他 Java 專案所引用。筆者就建議大家直接把成生的視為獨立的 module (sub module) 存放,其他專案就以 maven dependency 的方式引用。想要混合現有專案,動態生成專案內某些 java package,暫時不太可行。因為它也有大量的 dependency ,交由 openapi-generator-cli 自己管理會比較好,它們升級時,你也可以完整升級。 openapi-generator-cli https://github.com/OpenAPITools/openapi-generator-cli spring-boot-web-api-open-api-client