リソースにアクセスできなかったのを修正。 #2

Merged k-okada merged 1 commit into nitta-lab-2022:master from nitta-lab-2022:application_setting on 17 May 2022
Showing 4 changed files
View
5
build.gradle
plugins {
id 'org.springframework.boot' version '2.6.7'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
id 'war'
}
 
group = 'com.ntlab'
version = '0.0.1-SNAPSHOT'
}
 
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-jersey'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.11.4'
implementation 'org.springframework.boot:spring-boot-starter-web'
providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
 
tasks.named('test') {
View
1
■■■■
src/main/java/com/ntlab/irisserver/IrisServerApplication.java
package com.ntlab.irisserver;
 
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RestController;
 
@SpringBootApplication
public class IrisServerApplication {
 
View
4
src/main/java/com/ntlab/irisserver/JerseyConfig.java
package com.ntlab.irisserver;
 
import org.glassfish.jersey.server.ResourceConfig;
import org.springframework.stereotype.Component;
 
import javax.ws.rs.ApplicationPath;
 
@Component
public class JerseyConfig extends ResourceConfig {
 
public JerseyConfig() {
packages("com.ntlab.irisserver.resources");
View
5
src/main/java/com/ntlab/irisserver/resources/HelloWorld.java
import org.springframework.stereotype.Component;
 
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
 
@Component
@Path("hello")
@Path("/hello")
public class HelloWorld {
@GET
@Path("hello")
public String getHello() {
return "Hello World";
}
}