Avoid Spring Boot App to connect to Cassandra on boot - spring

I have a Spring Boot Application which stores/retries data from Cassandra DB. But if Cassandra is not available, Spring application does not boot.
Here is my code - https://github.com/simplyatul/springcassandrajunit
I am playing around DemoTableRepo.java. If I comment out
#RepositoryDefinition(domainClass = DemoTable.class, idClass = String.class)
then Spring boot app starts w/o connecting to Cassandra, however when Repo is used on retrieve/store call it throws following exception
java.lang.IllegalArgumentException: Interface org.simplyatul.cassandrajunit.repository.DemoTableRepo must be annotated with #org.springframework.data.repository.RepositoryDefinition!
If I keep the following line commented
#RepositoryDefinition(domainClass = DemoTable.class, idClass = String.class)
then Spring boot app tries to connect to Cassandra on boot and fails to start.
I found similar links/Qs, but things are not working with the solutions provided. Am I missing anything? Thanks in advance.
How can we stop spring boot data cassandra from connecting to localhost?
How to load spring application context even if Cassandra down

Related

Spring Redis Cache

New to Spring, have an old Spring Project, NOT Spring Boot
Need to implement in memory cache using Redis,
Following this guide - https://www.baeldung.com/spring-setting-ttl-value-cache
To start with, added just only bellow two dependency
implementation("org.springframework.boot:spring-boot-starter-cache:2.7.5")
implementation("org.springframework.boot:spring-boot-starter-data-redis:2.7.5")
When I start the application after compilation, I am getting -
Caused by: java.lang.NoClassDefFoundError: org/springframework/core/metrics/ApplicationStartUp
Could not find an example of Redis Cache only for Spring (all are for Spring Boot).
Need to implement Redis Cache on Spring only, NOT on Spring Boot.

Spring Cloud Data Flow - can it be used without spring boot?

Can Spring Cloud Data Flow be used in Spring5 applications - NOT Spring Boot - my current employer seems to view Spring Boot applications as insecure (I've no idea why) in anyway I'd like to try use this stack for an integration project, so is it possible to use it without Spring Boot?
With Spring Cloud Data Flow you can deploy streams, tasks and batches.
This is all based on Spring, Spring Cloud and Spring Boot. Spring Boot is nothing else as a preconfigured Spring stack.
Spring Data Flow is a runitme that usually needs a cloud infrastructure like Kubernets.
I'm not sure if you really are looking for that or more for something like https://spring.io/projects/spring-integration

How to Refresh Spring Boot Configuration Info with Using Spring Cloud Config

I would like to ask how to refresh spring boot configuration info with using spring cloud config. Would you please give me some advice? Many thanks.
If your spring boot application is a client of Spring Cloud Configuration Server and use itself as single point of truth in the application configuration let's say retrieve application.properties/yml from the config server, you can benefit of #RefreshScope. in this case if you do a post to the /refresh if you use spring boot 1.x or /actuator/refresh if you use spring boot 2.x all the bean that are have are annotated as #RefreshScope will be refreshed.

Spring first request very slow

I have application in Spring Boot. After initialization of Spring Boot with embeded tomcat, the first response is very slow. How can I fix it? Has spring boot any warmup command/mode? I am thinking too about connection with database and I am wondering about connection database, probably spring connects with Postgres during first request.
You could either use ApplicationRunner or CommandlineRunner to run something on startup:
https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-command-line-runner

Unable to retrieve javax.websocket.server.ServerContainer from ServletContext in Spring Boot (Tomcat application)

I have a spring boot application using spring-boot-starter-tomcat. I am trying to add a custom websocket endpoint in the application class.
To do this, I am trying to retrieve the ServerContainer with following:
ServerContainer container = (ServerContainer)servletContext.getAttribute(ServerContainer.class.getName());
However, the container is null, even though the tomcat server seems to come up in the spring boot application.
Is there any way to initialize the javax.websocket.server.ServerContainer in a spring boot application?

Resources