Multiple Datasource with Micronautor or Quarkus - java

I want to migrate to Micronaut or Quarkus from Spring Boot, but in Spring boot there is one feature as AbstractRoutingDataSource, which in runtime change datasouce. Is there anything similar or any mechanism in micronaut or quarkus which gives opportunity to work with multiple datasources in runtime??
Spring-boot feature for reference https://medium.com/innomizetech/dynamic-multi-database-application-with-spring-boot-7c61a743e914

Related

Spring Cloud Sleuth with Spring Boot 3.0 and Tracer

I use spring sleuth in my project and after I updated spring-boot to version 3 I receive the following error:
Consider defining a bean of type 'org.springframework.cloud.sleuth.Tracer' in your configuration.
I inject Tracer in my logging service to get current traceId and spanId. This is the dependency for spring sleuth:
implementation 'org.springframework.cloud:spring-cloud-starter-sleuth:3.1.5'
Is Tracer Bean no longer built in in terms of spring boot v3?
Spring Cloud Sleuth’s last minor version is 3.1. You can check the 3.1.x branch for the latest commits. The core of this project got moved to Micrometer Tracing project and the instrumentations will be moved to Micrometer and all respective projects (no longer all instrumentations will be done in a single repository).
see: https://spring.io/projects/spring-cloud-sleuth
This means that for Boot 3.x you need to use Micrometer Tracing instead of Sleuth.

Spring data JPA WITHOUT an entire Spring Boot application

I am creating an internal CLI that is communicating with a PostgreSQL database and the easiness to create a no-code repository is one of the features that convince me to choose Spring data JPA.
However, I am not able to find some tutorial or GitHub repository to set up a Spring data JPA project without an entire spring boot application.
On the project https://github.com/spring-projects/spring-data-book/tree/master/jpa there is no main entry point, so the code is not runnable and by the way, it was updated 8 years ago ...
This other StackOverflow thread Spring Data JPA without Spring Boot does not help me because the guy could run his spring application on Google Cloud Platform finally (that was the cause of why he ask how to setup sping data jpa without spring boot).
I don't know how to start, if you have any ideas I will be happy to discuss with someone who is more experienced than me.
Thank you.
This might help if no more complete tutorial turns up https://docs.spring.io/spring-data/jpa/docs/1.5.0.RELEASE/reference/html/repositories.html
Look for this section
Standalone usage
You can also use the repository infrastructure outside of a Spring container, e.g. in CDI environments. You still need some Spring libraries in your classpath, but generally you can set up repositories programmatically as well. The Spring Data modules that provide repository support ship a persistence technology-specific RepositoryFactory that you can use as follows
In particular it says you can use a factory to generate repositories:
RepositoryFactorySupport factory = … // Instantiate factory here
UserRepository repository = factory.getRepository(UserRepository.class);
So adding the spring parts that contain the spring data classes may be enough for this level and if you want to have DI, too, you likely need to combine them with the respective spring dependencies and configure a regular spring application.

Spring Data JPA without Spring MVC and Spring Boot

I want to make a small CRUD application using Spring Core and also I want to use Spring Data JPA.
How can I make such application without any web dependency or others like without using Spring MVC and Spring Boot.
Simple Spring Core + Spring Data JPA crud application.
Forget about whether it is recommended or not but is it possible?
Spring Boot is a architecture and it is not a framework. If you want to use Spring Core + Spring Data Jpa without spring-boot then go with maven quickstart.

Migrate Spring application to Spring Boot with Spring Data JPA and Hibernate

I'm working on project, that uses Spring framework (Spring MVC, JDBC etc.) Project is not so big and uses Jetty servlet container, PostgreSQL database with standard DAO classes(sql requests). I need to make it possible to use Spring Boot and Hibernate/Spring JPA with repositories instead SQL queries. I found a few states describes migration to spring boot: https://www.baeldung.com/spring-boot-migration https://3ldn.nl/2016/02/16/spring-boot-in-an-existing-application-part-1/ Now I make small example with Hibernate - generate few Entities and make CRUD operations with Hibernate instead sql queries.
But I need to update existing project for using Spring Boot and I need to use Spring JPA Repositories.
I add spring boot dependencies in dependencyManagment section. What steps I need to do`s next?
I've solved my task and succesfully migrate project to spring boot with JPA/Hibernate.
Its very simple task! and all what you need to migrate is:
0) solve all dependencies issues and remove all tags from boot dependencies.
1) How to use JPA Repositories without Spring Boot
2) How to migrate existing Spring project to Spring Boot
that is all.

Adding Spring Boot's CRaSH shell to regular non-boot Spring MVC application

Spring Boot comes with a neat remote monitoring shell (http://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-remote-shell.html) that's installed into Spring Boot apps by adding spring-boot-starter-remote-shell dependency. It provides access to Spring beans, jdbc, allows extension by custom commands, plugs into Spring Security for authentication, you can connect to it via SSH etc...
I would really like this feature in my regular non-boot Spring MVC application. I've searched the internet and Spring docs and found nothing. Any ideas how to achieve this besides reverse engineering spring-boot-starter-remote-shell sources?

Categories

Resources