Is it possible to add route in Spring Integration during execution? I'm doing project in Spring Boot and I need to use Spring Integration to make routes able to create during runtime. I can't find proper example or documentation that describes is it possible and how to to that.
What is route in your mind? Are you really referring to the router component? Why then dynamic routers doesn’t work for you: https://docs.spring.io/spring-integration/docs/5.2.2.RELEASE/reference/html/message-routing.html#dynamic-routers?
So, you can populate router mappings at runtime using an AbstractMappingMessageRouter.
Since some version, we don’t require initial mapping any more.
If you speak about something what we call flows, then you need to take a look into Java DSL and it dynamic flows registration: https://docs.spring.io/spring-integration/docs/5.2.2.RELEASE/reference/html/dsl.html#java-dsl-runtime-flows
Related
I am learning Camel and trying to integrate it with Spring Boot applications. From what I've read there appear to be two main ways to configure the Camel routes (and other related entities): 1) via Java DSL, or 2) via XML DSL. We don't think the Java DSL approach will work for us, as it doesn't seem that it would allow dynamic route definitions. Maybe I'm wrong? If dynamic routing can somehow be done using Java DSL and whatever, I'd like to know about it.
So, I'm focusing on configuring the routes in XML, where we should have a little more flexibility. The idea is that a given application (or service) could be handed a constructed XML route configuration at deploy-time that would specify the details of that service's routing.
The first question I have is how can we indicate to Camel (or Spring Boot and Camel) what/where the configuration file(s) are? Does it expect specific file naming and/or project location, or is it more flexible? Can it be broken into separate files?
By the way, we configure our Spring Boot applications via a combination of Java-based bean configuration and an application.yml file. We don't use XML for Spring Boot configuration.
I've poked around in a number of places on the Camel site (https://camel.apache.org/) but haven't found much information on this subject. The emphasis definitely favors the Java DSL approach.
There is a spring boot example with XML DSL at
https://github.com/apache/camel-spring-boot/tree/master/examples/camel-example-spring-boot-xml
You can use property placeholders in your Camel routes that can be configured via spring boot configuration (eg application.properties etc).
From Camel pov, then XML or Java can be equally dynamic. You can remove/add routes at runtime. But mind that its not always a good thing to do dynamic changes in production, without knowing if the changes works.
I was wondering if anybody could explain(or point me to proper documentation) and Spring Security in Hybris. I have used Spring Security before in Java based applications and I have always enjoyed the flexibility of custom groups with specific functions. I was unable to find any documentation on how to do that in Hybris. Ideally, I would be able to add security to CMS site without creating a separate storefront. How does Hybris allow to extend Spring Security? Thanks!
Generally, there is spring security config at this location. **web/webroot/WEB-INF/config/spring-security-config.xml . Here you can play with the configuration. wiki page
Hybris supports different user groups and rules about them, which can be seen here .
It really depends on your goal but some things can be done with Hybris restrictions engine.
It is always recommended create your own extension (extending the default one) and not using the platform extension, if i understood your idea correctly. There you can find the spring-security-config and modify it.
Is there anyway to map routes without conf/routes file in play framework. like #HttpRequest(url="/someurl")
Not out of the box. See this issue:
https://github.com/playframework/playframework/issues/1139
But, there are some reasons to not do it and I suggest you to don't fight the framework. If Play uses /conf/routes, stick to it because everything will evolve around this way of doing things. Per instance, by using a custom router that supports annotations, you will probably give up:
Reverse routing for your views and other controllers
Default controllers offered by the framework (controllers.Assets) or by module creators
Possible performance loss if your solution is not as fast as the default one.
Not sure if it is worth.
If you prefer to have your routing embedded in your controller rather than in a separate config file play 2.5 actually now supports this through its String Interpolating Routing DSL (a mouthful i know).
here's the docs for it:
https://www.playframework.com/documentation/2.5.x/ScalaSirdRouter
I have been messing around with Spring Integration, and I'd like to use its capabilities in a project. I have two different applications, one is a business-sided one, which when users do certain actions, should send messages to another application. The other application should receive these messages (using some kind of queue (rabbitmq or another) to handle big loads) and store them, so it can use it to create realtime statistics of a number of applications running.
These messages will just contain information of the actions of the users, for example "bought N of product X" or "Used searchbar for Y".
This scenario is of course pretty simple, but I don't want to use any kind of XML configuration in my Spring applications. The examples I have seen so far all rely on XML, but I want to use some kind of annotations instead.
Spring Integration java dsl is already released which would serve your purpose.
A gentle introduction can be found at
https://dzone.com/articles/spring-integration-java-dsl
You can also checkout Camel (has a fluent dsl for EIP) which also gels well with spring
I am currently not using any frameworks (other than bootstrap) for my java-ee application. But i came across a problem in using server side validation for servlets. I am finding it difficult to implement validation like this
http://spring.io/guides/gs/validating-form-input/
I could use request dispatcher, but I am not sure if it's the right way.
So i wanted to ask is it advisable to use the spring framework just for the validation?
is there any way to convert my entire java application to use spring or should i build the application from the ground up again?
If you just need the validation, then I recommend to use JSR-303/349 Bean Validation 1.0/1.1. The default implementation is done by Hiberante-Validator (this is NOT the Hibernate-ORM project!). It is relative easy to use out of the box.
http://hibernate.org/validator/documentation/getting-started/