datagokr-api-b090041-lunphinfoservice-client-spring

a client library for accessing LunPhldInfoService

License

License

Categories

Categories

Data CLI User Interface
GroupId

GroupId

com.github.jinahya
ArtifactId

ArtifactId

datagokr-api-b090041-lunphinfoservice-client-spring
Last Version

Last Version

0.0.3
Release Date

Release Date

Type

Type

jar
Description

Description

datagokr-api-b090041-lunphinfoservice-client-spring
a client library for accessing LunPhldInfoService
Project URL

Project URL

https://github.com/jinahya/datagokr-api-b090041-lunphinfoservice-client-spring
Project Organization

Project Organization

Jinahya, Inc.
Source Code Management

Source Code Management

https://github.com/jinahya/datagokr-api-b090041-lunphinfoservice-client-spring

Download datagokr-api-b090041-lunphinfoservice-client-spring

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.jinahya/datagokr-api-b090041-lunphinfoservice-client-spring/ -->
<dependency>
    <groupId>com.github.jinahya</groupId>
    <artifactId>datagokr-api-b090041-lunphinfoservice-client-spring</artifactId>
    <version>0.0.3</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.jinahya/datagokr-api-b090041-lunphinfoservice-client-spring/
implementation 'com.github.jinahya:datagokr-api-b090041-lunphinfoservice-client-spring:0.0.3'
// https://jarcasting.com/artifacts/com.github.jinahya/datagokr-api-b090041-lunphinfoservice-client-spring/
implementation ("com.github.jinahya:datagokr-api-b090041-lunphinfoservice-client-spring:0.0.3")
'com.github.jinahya:datagokr-api-b090041-lunphinfoservice-client-spring:jar:0.0.3'
<dependency org="com.github.jinahya" name="datagokr-api-b090041-lunphinfoservice-client-spring" rev="0.0.3">
  <artifact name="datagokr-api-b090041-lunphinfoservice-client-spring" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.jinahya', module='datagokr-api-b090041-lunphinfoservice-client-spring', version='0.0.3')
)
libraryDependencies += "com.github.jinahya" % "datagokr-api-b090041-lunphinfoservice-client-spring" % "0.0.3"
[com.github.jinahya/datagokr-api-b090041-lunphinfoservice-client-spring "0.0.3"]

Dependencies

provided (8)

Group / Artifact Type Version
com.fasterxml.jackson.core : jackson-databind jar 2.11.4
jakarta.annotation : jakarta.annotation-api jar 1.3.5
jakarta.xml.bind : jakarta.xml.bind-api jar 2.3.3
jakarta.validation : jakarta.validation-api jar 2.0.2
org.projectlombok : lombok jar 1.18.16
org.slf4j : slf4j-api jar 1.7.30
org.springframework : spring-context jar 5.3.3
org.springframework : spring-webflux jar 5.3.3

test (5)

Group / Artifact Type Version
org.glassfish.jaxb : jaxb-runtime jar 2.3.3
org.springframework.boot : spring-boot-starter-test jar 2.4.2
org.springframework.boot : spring-boot-starter-webflux jar 2.4.2
org.springframework.boot : spring-boot-starter-validation jar 2.4.2
org.xerial : sqlite-jdbc jar 3.34.0

Project Modules

There are no modules declared in this project.

b090041-lunphdinfoservice-client-spring

Java CI with Maven Quality Gate Status Maven Central javadoc

A client library for accessing http://apis.data.go.kr/B090041/openapi/service/LunPhInfoService.

See 월령정보(data.go.kr) and/or 월별천문현상(천문연구원).

Verify

Verify with your own service key assigned by the service provider.

$ mvn -Pfailsafe -DservcieKey=... clean verify

You may put your service key on src/test/resources/failsafe.system.properties, which is .gitignored, like this,

serviceKey=...

and verify like this.

$ mvn -Pfailsafe clean verify

Injection points

Common

Qualifier Type Notes
@LunPhInfoServiceServiceKey java.lang.String Provided by the service provider

For LunPhInfoServiceClient with RestTemplate

Qualifier Type Notes
@LunPhInfoServiceRestTemplate RestTemplate
@LunPhInfoServiceRestTemplateRootUri String Optional

For LunPhInfoServiceReactiveClient with WebClient

Qualifier Type Notes
@LunPhInfoServiceWebClient WebClient

Usages

Expand the component-scanning path.

@SpringBootApplication(
        scanBasePackageClasses = {
                com.github.jinahya.datagokr.....client.NoOp.class,
                MyApplication.class
        }
)
class MyApplication {

}

Provide the service key assigned by the service provider. Note that the service provider may give you a URL-encoded value. You should use a URL-decoded value.

@AbstractLunPhInfoServiceClient.LunPhInfoServiceServiceKey
@Bean
public String lunPhInfoServiceServiceKey(){
    // The service key assigned by data.go.kr
    // Might be already URL-encoded
    // Use a URL-decoded value    
    // return "...%3D%3D"; (X)
    // return "...==";     (O)
}

Using LunPhInfoServiceClient with RestTemplate

Provide an instance of RestTemplate.

@LunPhInfoServiceRestTemplate
@Bean
public RestTemplate lunPhInfoServiceRestTemplate() {
    return new RestTemplateBuilder()
            ...
            .rootUri(AbstractLunPhInfoServiceClient.BASE_URL_PRODUCTION)
            .build();
}

Get @Autowired with an instance of LunPhInfoServiceClient which is internally got autowired with the RestTemplate instance.

@Autowired
private LunPhInfoServiceClient client;

Using LunPhInfoServiceReactiveClient with WebClient

Provide an instance of WebClient.

@LunPhInfoServiceWebClient
@Bean
public WebClient lunPhInfoServiceWebClient() {
    return WebClient.builder()
            ...
            .baseUrl(AbstractLunPhInfoServiceClient.BASE_URL_PRODUCTION)
            .build();
}

Get @Autowired with an instance of LunPhInfoServiceReactiveClient which is internally got autowired with the WebClient instance.

@Autowired
private LunPhInfoServiceReactiveClient client;

Versions

Version
0.0.3
0.0.2
0.0.1