Micronaut

Micronaut 1.3.5: Page not found

十年热恋 提交于 2021-01-29 06:07:15
问题 GET http://localhost:8080/system/version GET http://localhost:8080/system/version/ import io.micronaut.http.annotation.Controller; import io.micronaut.http.annotation.Get; @Controller("/system") public class SystemController { @Get(uri = "/version/") public String version() { return SystemController.class.getPackage().getImplementationVersion(); } } leads to { "message": "Page Not Found", "_links": { "self": { "href": "/system/version/", "templated": false } } } How to fix this? 回答1: If a

Micronaut not connecting to db in yml

佐手、 提交于 2021-01-28 11:24:25
问题 I have created a new environment for my application and called it docker. I'm trying stuff out so I set it like this: application-docker.yml micronaut: application: name: time server: netty: access-logger: enabled: true logger-name: access-logger datasources: default: url: jdbc:postgresql://db:5432/postgres driverClassName: org.postgresql.Driver username: postgres password: postgres schema-generate: CREATE_DROP dialect: POSTGRES schema: time jpa.default.properties.hibernate.hbm2ddl.auto:

Debug java micronaut microservice in visual studio code

半腔热情 提交于 2021-01-28 11:01:38
问题 I created a microservice using micronaut and visual studio code. Everything is working find when I run the service using the gradlew.bat. I want to debug my microservice using visual studio code but annotation processing are not working. When I debug the service in visual studio code, it runs the main class and starts listening the localhost port but none of my controllers is found This is my launch configuration: { "type": "java", "name": "Debug (Launch)-Application<keycloak>", "request":

Global exception handling in micronaut Java

旧时模样 提交于 2021-01-27 19:22:38
问题 Looking for a better solution to handle the global exception in micronaut https://docs.micronaut.io/latest/guide/index.html#errorHandling Controller @Controller("/category") public class CategoryController { @Delete(uri = "/{id}") public Maybe<HttpResponse> delete(@NotBlank String id) { LOG.info(String.format("API --> Deleting the specified category")); return iCategoryManager.Count(id).flatMap(item -> { if (item > 0) { iCategoryManager.Delete(id).subscribe(); return Maybe.just(HttpResponse

How to create Micronaut's fat-jar without shadow plugin?

最后都变了- 提交于 2021-01-27 17:20:01
问题 What started as a roadblock to setup a new Micronaut project with corporate repo, is now more about curiosity of how Embedded server is bootstrapped. I have a Micronaut CLI generated project with com.github.johnrengelman.shadow gradle plugin which works fine when I run the jar using- $ java -Dmicronaut.environments=E1 -jar build/appBundle/app.jar build.gradle - plugins { id "com.github.johnrengelman.shadow" version "5.0.0" } ... shadowJar { mergeServiceFiles() } When I replace shadow plugin

How to create Micronaut's fat-jar without shadow plugin?

自作多情 提交于 2021-01-27 17:15:47
问题 What started as a roadblock to setup a new Micronaut project with corporate repo, is now more about curiosity of how Embedded server is bootstrapped. I have a Micronaut CLI generated project with com.github.johnrengelman.shadow gradle plugin which works fine when I run the jar using- $ java -Dmicronaut.environments=E1 -jar build/appBundle/app.jar build.gradle - plugins { id "com.github.johnrengelman.shadow" version "5.0.0" } ... shadowJar { mergeServiceFiles() } When I replace shadow plugin

Micronaut controller error Page Not Found

こ雲淡風輕ζ 提交于 2021-01-27 07:37:33
问题 I created a new micronaut app using mn create-app example.micronaut.complete After that I opened the project using intellij and added a new class as TestController to the project with code below: package example.micronaut; import io.micronaut.http.MediaType; import io.micronaut.http.annotation.Controller; import io.micronaut.http.annotation.Get; @Controller("/hello") public class TestController { TestController(){} @Get(value = "/", produces = MediaType.TEXT_PLAIN) String getTest(){ return

Micronaut controller error Page Not Found

时光怂恿深爱的人放手 提交于 2021-01-27 07:34:18
问题 I created a new micronaut app using mn create-app example.micronaut.complete After that I opened the project using intellij and added a new class as TestController to the project with code below: package example.micronaut; import io.micronaut.http.MediaType; import io.micronaut.http.annotation.Controller; import io.micronaut.http.annotation.Get; @Controller("/hello") public class TestController { TestController(){} @Get(value = "/", produces = MediaType.TEXT_PLAIN) String getTest(){ return

How to configure Jackson to use SNAKE_CASE in Micronaut?

半世苍凉 提交于 2021-01-27 06:28:41
问题 I have tried to configure jackson to accept JSON using SNAKE_CASE when using Micronaut, however, it doesn't recognize the property jackson.property-naming-strategy: SNAKE_CASE . 回答1: From Micronaut 1.1.1 application.yml jackson: property-naming-strategy: SNAKE_CASE Before Micronaut 1.1.1 Micronaut constructs ObjectMapper using ObjectMapperFactory that does not set property naming strategy (at least in Micronaut 1.0 GA version, this may change in future releases). The configuration option you

Reactive and Non-Blocking Method Micronaut with apache kafka

守給你的承諾、 提交于 2021-01-19 08:29:49
问题 I am trying to get the Non-Blocking response from the Micronaut kafka implementation, however the return value in not working. public class ProductManager implements IProductManager{ private final ApplicationContext applicationContext; public ProductManager(ApplicationContext applicationContext) { this.applicationContext = applicationContext; } @Override public ProductViewModel findFreeText(String text) { final ProductViewModel model = new ProductViewModel(); IProductProducer client =