@Path("/abc")
@Produces(MediaType.APPLICATION_JSON)
public class ABCController
{
@Autowired
private MyService myService;
@GET
public Response getSome(@QueryParam("identification") List<String> ids)
{
GenericEntity<List<Label>> entity = new GenericEntity<>(myService.findSomething(ids))
{
};
return Response.ok(entity).build();
}
MyService:
@RequiredArgsConstructor
@Service
public class MyService
{
private final MyMapper myMapper;
private final JpaRepository myRepository;
public List<String> findSomething(ids){
myRepository.findXYZ(ids);
}
My MainClass:
@SpringBootApplication
public class MainClass
{
public static void main(String[] args)
{
SpringApplication.run(MainClass.class, args);
}
@Bean
public MyMapper myMapper()
{
return new MyMapperImpl();
}
}
build.gradle:
buildscript {
ext {
LOMBOK_VERSION = "1.18.22"
SPRING_BOOT_VERSION = "2.6.6"
JERSEY_VERSION = "3.0.8"
JACKSON_VERSION = "2.13.1"
MSSQL_JDBC_VERSION = "9.4.1.jre11"
MAPSTRUCT = "1.5.1.Final"
}
}
plugins {
id "org.gretty" version "4.0.3"
}
apply plugin: 'java-library'
apply plugin: 'java'
apply plugin: 'war'
repositories {
mavenLocal()
maven {
url = '...'
}
}
dependencies {
compileOnly "org.projectlombok:lombok:${LOMBOK_VERSION}"
testImplementation "org.projectlombok:lombok:${LOMBOK_VERSION}"
annotationProcessor "org.projectlombok:lombok:${LOMBOK_VERSION}"
implementation "org.mapstruct:mapstruct:${MAPSTRUCT}"
annotationProcessor "org.mapstruct:mapstruct-processor:${MAPSTRUCT}"
implementation "org.springframework.boot:spring-boot-starter-data-jpa:${SPRING_BOOT_VERSION}"
implementation "com.microsoft.sqlserver:mssql-jdbc:${MSSQL_JDBC_VERSION}"
implementation "org.glassfish.jersey.containers:jersey-container-servlet-core:${JERSEY_VERSION}"
implementation "org.glassfish.jersey.inject:jersey-hk2:${JERSEY_VERSION}"
implementation "org.glassfish.jersey.media:jersey-media-json-jackson:${JERSEY_VERSION}"
}
When i call http://localhost:8080/myservice/abc?identification=61234561234569,71234561234568,71234561234569
i got a NullPointerException
of myService.findSomething(ids)
I start the application with gradle command appRun