Spring Boot, Velocity Tools - spring

I'm trying to integrate spring boot with velocity tools but it still fails, the documentation did not find anything related to how to load velocity.properties, anyone have any help? Thank you.

I ran into some Boot/Velocity configuration issues this morning. You are right that the documentation is spare here.
If you are looking to use Velocity for Spring MVC templating, be sure to include spring-context-support on the classpath. Based on the behavior, it appears that Boot is doing some classpath autodetection here, and creates VelocityConfigurer and VelocityViewResolver beans if and only if spring-context-support is on the classpath.

Related

Spring Boot requires spring-boot-starter-security as a dependency for ssl

I inherited Spring Boot application (version 1.5.8). I think it reads external foo.properties file then creates Map object having key/value pair then SpringApplication.setDefaultProperties consumes it.
When I inspected the properties file, it has many ssl related key/value properties
server.ssl.key-alias=<some_value>
server.ssl.key-password=<some_value>
server.ssl.key-store=<some_value>
server.ssl.key-store-type=<some_value>
From its pom.xml file I don't see spring-boot-starter-security as a dependency though. My assumption is it is ok. Although as newbie, when I went through simple tutorial of Spring Boot in regard to ssl, it has aforementioned lib as a dependency.
I plan to add more ssl key/value pairs like:
server.ssl.enabled=<some_value>
server.ssl.ciphers=<some_value>
server.ssl.protocol=<some_value>
My question is do I need spring-boot-starter-security lib as a dependency or not. I am sure I'd find out once I update/execute the application but I decided to ask first if anyone knows in advance. My initial research didn't come up with an answer I was looking for.
Update:
From its pom.xml, I see following added as dependency. Another attempt of research makes me believe spring-boot-starter comes with spring-boot-starter-security but I am not positive about this.
spring-boot-starter
spring-boot-starter-log4j2
spring-boot-starter-web
No, you definitely don't need spring-boot-starter-security to enable SSL/TLS in your Spring Boot application.
As described in the Spring Boot documentation, you can enable SSL declaratively by setting the various server.ssl.* properties, typically in application.properties or application.yml.
Refer to the Ssl class for details of all of the supported properties. You may also consider checking the Spring Boot common application properties (in special the server properties).
No.
Spring Boot does not need security for SSL, it's a Tomcat issue. I recommend you to read this tutorial

Is it necessary to use a spring initializr for creating spring applications?

I have started learning about spring and in every tutorial they start from spring initializr, i was wondering is it necessary to use it or we can create a project without using spring initializr ?
No, it is no necessary. You can do everything by your own hands. It just helps you to start quicker so that you focus more on the Spring concepts instead of spending much time on "infrastructure" like configuring dependencies. You run it and it just works. Then you can extend it step by step. This can be especially helpful if you just start learning Spring. Later on you should of course spend some time on other aspects that initializr provides you.
Adding to whatever is already mentioned.
No , it is not necessary to create a project with Spring Initializr
The site provides a curated list of dependencies that you can add to
your application based on the selected Spring Boot version. You can
also choose the language, build system and JVM version for the
project.
https://spring.io/blog/2019/02/20/what-s-new-with-spring-initializr.
https://github.com/spring-io/initializr/
Using Spring Initializr the right dependencies are preconfigured for the Spring Boot version used. These preconfigured projects reduces the setup time and one can start implementing the code rather than investing time on which dependencies to go with.

Which dependency should be used to integrate Apache Camel with Spring Boot

Apache Camel provides two ways to integrate with Spring Boot:
camel-spring-boot
camel-spring-boot-starter
When I look at the starter then I see that it only includes camel-spring-boot and spring-boot-starter. What is the difference then and what are the advantages of using starter?
At the moment of writing this answer, camel-spring-boot is only supported from Camel 2.15 and camel-spring-boot-starter only from Camel 2.17, which is important considering the current version that your project is using.
Then the major difference between these two dependencies, lies in the "opinionated" auto-configuration provided by the starter.
camel-spring-boot, should be used if you want just to include a jar to make your camel routes auto-discovered by spring boot, this also gives you the freedom to update this dependency regardless of your spring-boot version.
camel-spring-boot-starter, (recommended way to go) should be used if you want a collection of dependencies (including camel-spring-boot) that provides the best developer/user experience, due to the fact of customizable properties, additional libraries, and default configuration for the camel library. Check the reference documentation for the starter: https://camel.apache.org/components/latest/spring-boot.html#_spring_boot_auto_configuration
Summary
Use camel-spring-boot, if you want a vanilla jar to use camel with spring boot
Use camel-spring-boot-starter, if you want an automatic-configured component to start to develop with.
You should always use the camel-xxx-starter dependencies, as these are the Camel components that is support with Spring Boot. Also as mentioned they provide auto configuration and some of them additional capabilities.
If there is no camel-xxx-starter component then its because its not supported on Spring Boot with Camel.
See more at: https://github.com/apache/camel/tree/master/platforms/spring-boot/components-starter#camel-component-starters

How to configure Spring Cloud Sleuth in Spring Boot microservices

Can someone please help me? I want to integrate Spring Sleuth with my Spring Boot microservices. I added spring-cloud-starter-sleuth dependency. Also tried by added SLF4J along with it. But it is print normal logs. Not printing in Sleuth style like app name, span id ,traceid etc. I am not sure if it is recognizing dependency? Do I need to add any other dependency? Any properties file?
Could you please guide with exact dependency? and exact steps to configure?
In terms of logging, we support slf4j out of the box. You have to implement your own SpanLogger interface to add the logging support for log4j

Spring Security without spring core?

I have a really simple question, that I just can't find the answer.
If I want to use only Spring Security, do I need Spring core or any other dependency?
In this link, in the bottom I see only spring security jars as dependencies, but still I couldn't get it to work. I only got it to work when I used a lot more of spring jars (core, context, and more).
So, what are the minimal dependencies I need for using Spring Security? All I need is an authorization and authentication framework, and I want as little dependencies as possible.
Thank you!
For every spring extension you need to use Srping core, because every extension is build on top of spring core

Resources