Spring boot activemq using pooledConnectionFactory not working - spring

I am developing on Spring boot activemq, using pooledConnectionFactory, already set spring.activemq.pool.enabled=true in application.properties.
I already created a PooledConnectionFactory, but what value shall be input after this setting : spring.activemq.pool.configuration.*. It is really confusing.

Depending on the Spring Boot Version you may need the dependency:
<dependency>
<groupId>org.messaginghub</groupId>
<artifactId>pooled-jms</artifactId>
</dependency>

Related

Spring Boot [2.6.6] is not compatible with this Spring Cloud release train

We're trying to upgrade spring boot version to 2.6.6 and faced up with "Spring Boot [2.6.6] is not compatible with this Spring Cloud release train" (when running integration tests).
In additional
spring-cloud.version = 2021
We're using org.springframework.cloud (spring-cloud-starter-openfeign & spring-cloud-openfeign-cores) 3.1.1
according to the documentation , spring boot support 2.6.6 should be compatible.
You could try and set your spring cloud version to
spring-cloud.version = 2021.0.1
If it is not that simple mistake I am sorry. The documentation that you linked to is correct. Spring Boot [2.6.6] is compatible with spring-cloud.version 2021.x.x. openfeign 3.1.1 is also part of springCloud 2021.x.x. I have multiple project with this configuration running. In all of them the runtime as well as the integration test are working properly. Otherwise a stacktrace would be nice to gain further information :)
I have multimodule project using maven.
After migrating for Spring-Boot version 2.4.2 to 2.6.6, I face multiple issues.
First one is the application won't be able to find the Bootstrap class. The error is:
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.Bootstrapper
To fix the issue I need to add the dependency in the pom.xml of the module:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bootstrap</artifactId>
</dependency>
Second problem I face is to this "Spring Cloud release train"
In this case I need to upgrade the Spring-Cloud version to "2021.0.1" which is compatible with Spring-Boot 2.6.6
Third problem I face is this error while starting the application:
"No spring.config.import property has been defined"
The reason for this error is that some of the "bootstrap.properties" files are deprecated in the new version so application won't starts. To fix this, we need to add below property in application.properties or application.yml file.
spring.config.import=optional:configserver:

Swagger with Spring Boot and AWS Lambda

I am trying to deploy a spring boot , Java, Swagger application, everything is working fine except the swagger UI.
I am getting this below error.
File path not allowed: /swagger-ui.html
at com.amazonaws.serverless.proxy.internal.SecurityUtils.getValidFilePath
(SecurityUtils.java:192) ~[task/:na]
This is an old bug in Amazon's library.
<dependency>
<groupId>com.amazonaws.serverless</groupId>
<artifactId>aws-serverless-java-container-spring</artifactId>
</dependency>
Use the latest (or higher than 1.2).
https://github.com/awslabs/aws-serverless-java-container/pull/205
Its a configuration issue. You need to check the configuration part. I have mentioned few tutorials,have a look int it.
Configure Swagger With Jersey and Spring Boot
Spring Boot + Swagger2
How to add Swagger to Spring Boot -Video tutorial
How to configure Swagger in Spring Boot -Video tutorial

spring actuator for standalone spring boot application

we have standalone spring boot application which triggers some quartz jobs based on triggers. it is standalone jar file , no application server involved.
i am planning to add Spring actuator to it. is it possible to add actuator to spring boot application which is not running on any application server.
i did search in google and spring.io website but haven't found any relevant info. if i can add can someone help me how to do it or any link for documentation.
Thanks
Try adding the spring-boot-starter-web dependency to your pom.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
I had the same issue and this resolved it for me.

Spring Boot Deployment Strategy

Am implementing the swagger 2 using Spring Boot. Using Dependencies-
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.4.0</version>
</dependency>
It works good. But want to implement swagger in such a way that in production
swagger does not get deployed. Also will it be possible to host the swagger build differently than the application build on different host machines?
There are two approaches to do this.
Maven profile
By intrudue a maven profile like 'swagger' and add the springfox-swagger-ui related depdencenty to this maven profile. As maybe you need to use some swagger annotations in the java code, so it cannot eliminate the springfox-swagger2 dependency.
Spring profile( should be more better than option 1 )
For a standard spring-boot swagger2 config class, for example you can add the #Profile("swagger") annoation to enable the swagger2 integration only when add the spring.profiles.active=swagger in app running.
For the different host machines, I has no idea about that, but as my understanding, swagger will select all the spring boot endpoints so suppose you cannot leave them alone. But there is a library which can provides a way to publish springfox-swagger2 on spring boot actuator. so you can add management.port=8181 property in application.properties to makes spring-boot-actuator run on another TCP port.

Is Mybatis supported with Spring 4.x?

I tried mybatis-spring 1.2.2 with mybatis 3.2.5 and Spring version 4.1.0.Release and it appears like it is not supported.
mybatis-spring 1.2.2 spring contains org.springframework.core.MethodParameter class however, getContainingClass() is not present.
I am getting the exception:
java.lang.NoSuchMethodError: org.springframework.core.MethodParameter.getContainingClass()
Any idea is I could use Mybatis with Spring 4x at all? (even ibatis seems to be unsupported)
Looking in the pom.xml of the Spring MyBatis here I can see that the project itself depends on Spring 3.2.9:
...
<spring.version>3.2.9.RELEASE</spring.version>
...
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
<scope>provided</scope>
</dependency>
So, based on that I wouldn't be surprised if I would get an exception like the one you are getting in my project and I would have to say that "no", it's not supported.
We are using MyBatis v3.2.7 with Spring v4.0.6 and so far we have not seen any issues. Since Spring usually maintains the backward compatibility, it usually works.
However, I am not sure (as of this writing) if it is totally supported in Spring v4.1.x.

Resources