Best practices of deploying Spring Extjs webapp - spring

i'm working on a project involving Spring Boot for creating a REST webservice and ExtJS 5 for Front End, Frontend and backend are developped independentely, so i've managed to avoid CORS problems, i would like to know Best practices concerning deployment in this case. i would like to keep the backend independent of the frontend by packaging frontend in its own .war and so for backend, is there any problems in following this practice.

You can avoid CORS problem if you deploy front-end and back-end to the same domain but different context (domain.com/front, domain.com/back).
In other case you need CORS, please take a look at the last release Spring Boot 1.3.M1:
https://spring.io/blog/2015/06/12/spring-boot-1-3-0-m1-available-now
The recently released Spring Framework 4.2 RC1 provides first class support for CORS out-of-the-box, giving you an easier and more powerful way to configure it than typical filter based solutions.
Source post: https://spring.io/blog/2015/06/08/cors-support-in-spring-framework

Related

Azure Active Directory in Spring App Without Boot

I have been trying to set up a Spring Web application to use Azure Active Directory.
All the samples that I have found online are based on Spring Boot, is there a simple example that shows setting up spring framework web app only without using Spring Boot?
I am having no luck finding stuff, I am also trying to figure out how to convert all the spring boot autoconfig. Surely there is a sample somewhere that makes it easy to use for a Spring Framework only web-app?
I was able to figure this out somewhat. I'm very new to OAuth so still trying to learn as I go.
Basically I followed the Spring Reference and got things working using the override auto-configuration sections at https://docs.spring.io/spring-security/reference/servlet/oauth2/index.html
It also helped that I updated the Spring Framework versions to the latest and made sure I used the correct dependencies according to that reference site

I am developing a website I know bootstrap and learned spring I want to know what else can be done to make it better?

I want to know what spring dependencies should I use on my website to make the work easy and spring or spring boot which one is better. also, suggest some frontend technologies that I can use to make the website smart.
It's a very broad question. And it all depends on what features you want in your web site. Just listing few basic module to give you some hints.
Spring MVC - For web application with MVC Pattern
Spring Security - To secure your app
Spring ORM - If using any ORM tool like hibernate
You need to explore more on the basis of your need.
Spring Boot vs Spring:
You should use Spring Boot if you are starting new project. Spring Boot came to make development process easier when using Spring Framework. In Spring, developer had to write lots of code to configure beans and dependencies. Spring Boot automated this process so that you no longer do it by yourself but Spring Boot will take care of it. Plus it provides some extra tools (In built Web Server, in Memory DB, tool to monitor and manage Spring Boot App )
Try to create a simple web app in Spring and Spring Boot to understand the difference.
Front-end Technologies:
JavaScript based framework/lib like Angular,React,Vue etc. are the trend for front-end now a days. Again there are pros and cons of each of them. Hence you need to evaluate, what suits you better as per your requirement.

spring-security, testing the filter chain without webapp

We are using spring-security in many applications with the same configuration. So we have created a library for it.
But today I have to changes many things in this library and I would like to test it so that I'm sure to not breaking anything.
Is it a way to test the filter chain and other spring-security components (like DetailsSource) without a web application ?
Thanks a lot
Spring security has very convenient API for testing with spring mvc testing
http://docs.spring.io/spring-security/site/docs/4.1.3.RELEASE/reference/htmlsingle/#test-mockmvc

What are the parts of the Spring framework that does work with Appengine

Right now, I have been facing so much issue running some parts of the Spring Framework, like I have no problems running my Appengine web app with Spring MVC however have so many issues running Spring Data on top of Appengine.
I wan't to know which part of the framework have been tested to work with Appengine (AE)?
Does Spring Security work with AE?
Does Spring Data work with AE?
I'm guessing that there is no planned support for these frameworks at all for AE. However, hopefully I'm wrong.
I would suggest looking here: https://code.google.com/p/googleappengine/wiki/WillItPlayInJava
Spring Security is listed as SEMI-COMPATIBLE.
As for Spring Security, it works great. You'll just have to enable sessions. And if you want to apply the SPring filter on static files, make sure to exclude them from the static resources in appengine-web.xml.
As for Spring Data, I've never tried it but you might be able to use the JPA and REST sub-projects at least.

Experiences with integrating spring 3 mvc with GWT?

Given:
Spring 3.0 mvc has excellent REST support with one of the representation being JSON.
GWT simplifies development as UI is developed in java. But by default it uses RPC for client server interaction. But there is an option to use JSON.
Questions:
Can you share experiences with using Spring 3.0 mvc with GWT ?
What is the best approach to integrate these two frameworks?
Is the default GWT's MVP architecture only for client side and does it work well with JSON?
Thanks
Can you share experiences with using Spring 3.0 mvc with GWT ?
Yes. We've successfully built a whole large application around GWT and Spring MVC (1500 source files, 6 months in development).
Spring was the key to the project's success. Only with Spring we were able to test individually some pieces of the application on the server side.
What is the best approach to marry these two frameworks?
Ignore the default Servlet used by GWT and instead create your own Spring controller to handle incoming GWT-RPC requests. This blog post was the key to integrating the two techs.
We also successfully integrated other components: Flash for animated charts and third-party Javascript components for other stuff. These communicate with the server through JSON. So you have two or more kinds of URLs:
the *.rpc urls are for GWT components and are served by the Spring controller for gwt
the *.json urls are for other components and are served by another Spring controller.
Also, in our case, we shunned configuration with annotations and instead preferred configuration with the good old Spring XML files. They make it much more clear what's going on. Except for the #Required annotation; it's great to find spring beans that should be connected but aren't.
Is the default GWT's MVP architecture only for client side and does it work well with JSON?
GWT's MVP architecture works best if you follow the guide lines. Use GWT-RPC communication as Google suggests.
You can still have JSON for other client-side components.
Try this solution: GWT and Spring MVC Integration
It uses 3 classes. Its very simple, declarative and clear.
It's stupid to mix Spring MVC and GWT. Also it's stupid to mix Spring MVC and JSF... It's stupid to mix 2 MVC (MVP) frameworks together. But you can use Spring DI and GWT for sure!
You may want to check out Spring Roo. It will help you get started quickly with Spring MVC, especially when dealing with RESTful URLs. It also provides a means to automatically set up GWT "scaffolding" (GWT code to interact with the Spring MVC backend). Hope it helps!

Resources