JHipster update configuration at runtime - spring-boot

I have a java service created using JHipster Generator ver 3.4.0 using the monolith approach. How can I use #RefreshScope? Is it just a matter of brining in spring-cloud as dependency and annotating with bean #RefreshScope?
Does the JHipster Configuration UI support updating configuration values?

Is it just a matter of brining in spring-cloud as dependency and annotating with bean #RefreshScope?
You can add spring cloud dependencies partially, so yes. You can generate a microservice application to see how this should be configured properly by taking a look at bootstrap.yml
Does the JHipster Configuration UI support updating configuration values?
I believe you are talking about the JHipster Registry. The purpose of this UI is to show you an aggregated configuration, which is efficiently loaded for some application. This is not really part of spring cloud config. The only 2 ways are filesystem or git repository.
But we are currently working on integrating consul as config solution as well. Consul itself does provide an UI to change config on the fly

Related

what does "spring-kafka without springboot" mean

I'm totally new to Kafka and terribly confused by this:
https://docs.spring.io/spring-kafka/reference/html/#with-java-configuration-no-spring-boot
I don't understand what that even means. What does "no spring boot mean" because that example sure as hell uses spring boot. I'm so confused....
EDIT
if I'm using SpringBoot and spring-kafka, should I have to manually create #Bean ConcurrentKafkaListenerContainerFactory as shown here. Most of the examples in the docs for setting up filtering / config / etc seem to use the "manual" configuration using #Bean. Is that "normal"? The docs are very confusing to me...especially this warning:
Spring for Apache Kafka is designed to be used in a Spring Application Context. For example, if you create the listener container yourself outside of a Spring context, not all functions will work unless you satisfy all of the …​Aware interfaces that the container implements.
It's referring to the autowired configuration, as compared to putting each property in the config via HashMap/Properties in-code.
Also, it does not use #SpringBootApplication or SpringApplication.run, it just calls a regular main method using a hard-coded Config class.
Spring boot contains the functionality of AutoConfiguration
What this means is that spring boot when discovers some specific jar dependencies it knows, in the project, it automatically configures them to work on a basic level. This does not exist in simple Spring project where even if you add the dependency you have to also provide the configuration as to how it should work in your application.
This is also happening here with dependencies of Kafka. Therefore the documentation explains what more you have to configure if you don't have spring-boot with auto-configuration to make kafka work in a spring project.
Another question asked in comment is what happens in case you want some complex custom configuration instead of the automatic configuration provided while you are in a spring-boot app.
As documented
Auto-configuration tries to be as intelligent as possible and will
back-away as you define more of your own configuration. You can always
manually exclude() any configuration that you never want to apply (use
excludeName() if you don't have access to them). You can also exclude
them via the spring.autoconfigure.exclude property.
So if you want to have some complex configuration which is not automatically provided by spring-boot through some other mechanism like a spring-boot specific application property, then you can make your own configuration with your custom bean and then either automatic configuration from spring-boot for that class will back of as spring does several intelligent checks during application context set up or you will have to exclude the class from auto configuration manually.
In that case you could probably take as an example reference of how to register manually your complex configurations in spring boot what is documented on how to be done in non spring boot app. doc

Spring cloud bus with EnableBinding (non functional approach)

I use spring boot 2.7.2 and spring cloud dependencies 2021.0.3.
The project uses annotation-based model (EnableBinding) rather than
functional. That's something I cannot change.
Right now the bus (used for getting refresh events from config server)
is not working due to: Functional binding is disabled due to the presense of #EnableBinding annotation in your configuration
The question is, if it is possible to have spring-cloud-bus configured without functional approach ?

Passing configuration from yaml file to spring boot application without rebuilding it

How to pass configuration through yaml file to a running spring boot application so that there is no need of rebuilding the application and changes are reflected while the application is runnig?
I think this can help you:
How to hot-reload properties in Java EE and Spring Boot?
Take a look at Spring Boot Cloud Config. It allows you to manage your config files centralized and has the ability to push new configurations to the connected applications.

Can SpringBoot be use for Backend application?

One of the Spring framework advantage is dependency injection. Many had used SpringBoot for providing REST Web Services.
Read up and notice there are Scheduler and CommandLineRunner for SpringBoot, could we using SpringBoot for backend type of application to replace the usual standalone java program while making use of SpringBoot advantage (Dependency Injection)
- Cron Job (Execute and stop running)
- Long Running Process
One of the main thing I am looking into is to use annotation such as Spring Configuration, Spring Data JPA and other technology in backend application.
Of course!
I used spring boot to back CLI projects, DB access projects and more.
Spring boot is very modular. It works by providing auto-configuration based on your maven/gradle imports. If you don't import starter-web/starter-jersey or any other starter that is for the web/rest api, the auto-configuration for this resources won't be triggered and you can basically enjoy all the power of spring boot to support your needs
Definitely,
Spring boot is not a separate framework.It reduces the configuration difficulties when you using spring framework. Spring boot provides a Rapid Application Development using without complex configuration including your dispatcher servlet, XML file for database connectivity and configuration files. You can use spring boot for back-end development. Simply says you can do everything what you does in spring MVC without any complex configuration. If you are using spring boot , You can configure your database details in application.properties file. I am adding one of two links for proper reading,
https://projects.spring.io/spring-boot/ ,
https://dzone.com/articles/why-springboot

How to use Spring Boot externalized configuration at Cloud Foundry

For externalizing configuration in a spring Boot application, I follow the standard way of having an application.properties in the classpath. And then, in the production environment, I put another application.properties beside the JAR which overrides the earlier one. This way, I can have, say, a name property having different values in development and production environments.
Liked to know how to do the same thing when deploying to Cloud Foundry.
You can simply put the properties to override as environment variables (replace dots with underscores, and Boot will match everything up).
You might also want to have a look into the Spring Cloud Config Spring project within Spring Cloud:
"Centralized external configuration management backed by a git repository. The configuration resources map directly to Spring Environment but could be used by non-Spring applications if desired."

Resources