Spring boot hot deployment for templates and resources under IntelliJ - spring-mvc

Is anyone aware of a mechanism to get hot deployment for resources and template working under IntelliJ 14.0.2 for a Spring Boot application.
I know that full Spring Boot support is scheduled for 14.1 but I have a project that I converted over from a standard WAR project to a Spring Boot project and I really miss the hot deployment.
At the moment I have to manually build the project that the resources are in to get hot deployment and even then it is a bit flaky sometimes. I would prefer to just save a template or a javascript/css file and get it picked up as I did when I was running my app using a local tomcat server via IntelliJ.
I could switch back to Eclipse to get this working, but my project is Scala based and IntelliJ Scala support is far superior.

So after some testing I came to few conclusions I think someone arriving here may find useful:
If you are running embedded spring boot application from IntelliJ IDEA (myself on 14 at the moment) in debug mode and you want to hot re-deploy resources you can do that via: Run -> Reload changed classes. Setting a keyboard shortcut much recommended.
Don't get fooled by Loaded classes are up to date. Nothing to reload. message. Your static resources have been updated (tested on .js files and Thymeleaf templates).
As pointed out in comments for thymeleaf templates hot-redeploy you would need:
spring.thymeleaf.cache=false
If you are running in external container IntelliJ provides extra features like action on Frame deactivation which is extremely handy for web development. This works fine as well just beware that external Jetty container on 9.2.7 will cause troubles, i.e. unload the resources on Update resources action breaking your webapp. The only fix was app restart for me. Works nicely in Tomcat 8 though.

As instructed here adding spring-boot-devtools dependency will enable static resources reloading (templates and css).
Beware that you need to select Build -> Compile for this to work.

Install jetbrains-ide-support
Start your Spring Boot app
Go in browser and open your_project_page(http://localhost:8080/)
right mouse click(on your page) -> choose "Inspect in IDEA"

Related

Is it possible for dotnet watch to only build the changed ASP.NET project and not the projects it depended on?

I'm developing a Blazor application and I'm running dotnet watch on it for the hot module reload properties. It works great and fast when it is a standalone project, but after I introduced a DTO project and a client project as dependencies, it looks the dotnet watch has to build the two extra projects on every reload (if I understand it correctly) and the reload is a lot slower. Is there any way to somehow cache the projects? Does something like Vite not do that for fast Hot module reload? Or am I doing something wrong or misunderstand the dotnet watch?
Maybe it's something to do with the projects it depends on, which in that case is just bad luck and I'll have to live with the slow reload.
I have looked at the official Microsoft doc. and couldn't find anything relevant, might have missed something?
I have also tried the command:
dotnet watch run --no-dependencies
It seems like that the dependency projects is no longer build (they no longer appear in the cmd output) but it's still slow.

Vaadin + Css formatting

I'm using Vaadin 14.4.4 with Gradle 6.3 and Spring Boot.
When I was creating a website in developer's mode everything was working well. Now I switched to productionMode = true and website doesn't load a single css file.
I'm trying to use one css file per class.
After switching back to developer's mode the CSS formatting is not working as it used to.
I tried vaadinClean, vaadinBuildFrontend and vaadinPrepareFrontend but that doesn't seem to fix my problem...
Do you guys have any suggestions does any of you interfered with the same problem as I ?
From the docs of the gradle plugin for
Vaadin:
./gradlew clean build -Pvaadin.productionMode - will compile Vaadin
in production mode, then packages everything into the war/jar archive.
Automatically calls the vaadinPrepareFrontend and
vaadinBuildFrontend tasks.
Note the explicit passing of -Pvaadin.productionMode. It might seem
a bit counter intuitive to have to pass that explicitly to a task like
vaadinBuildFrontend, which sole purpose usually is to build the
production stage.

Turning off Spring Roo in STS, but still use from command line

From time to time STS seems to bog down or free while working in a Spring Root webapp. It can sometimes be ten or twenty minutes before the UI allows you to really do anything, other than go slow and queue up actions.
We've traced all the the postings/bug reports about "JPA change handler (waiting)" messages and AspectJ issues - but no real permanent solution appears. Sometimes when we upgrade Eclipse or Roo things get better for a while.
We are hoping to figure out if this is really a Roo problem or more of an a Spring/AspectJ issue.
Question: Is it possible to disable Roo in the IDE but still have it build and work OK in the IDE, just not Roo smarts going on?
I thought I just had to remove the "Roo Nature" for the project but that does not seem to completely do it - the Roo Shell keeps popping open when I do a Maven Update.
If not we'll probably look at the push-in refactoring route - but that seem to really be a one-way street.
Our webapp has about 20 domain objects and 30 controllers - it's not tiny but not huge either. We use JPA/Hibernate too.
Thank you - Richard
We ran into the same problem. It seems the JPA Daly support for Eclipse, included in the WTP, generates of a lot of JPA Event Change notifications while compiling a project. It seems in projects with aspects, like the Roo ones, this behavior is even worse and makes using the IDE very slow and even hangs sometimes.
As there is not any way to disable it through configuration, you have to remove or move the related files. Ex:
Go to the STS/Eclipse installation folder.
Run the following command::
rm -rf plugins/org.eclipse.jpt. features/org.eclipse.jpt.**
We found also another problem with the Eclipse AspectJ plugin (https://issuetracker.springsource.com/browse/STS-4037) that caused to compile all the project on each modification to any Java class in the project with Aspects applied. It is solved in the recent STS versions, but check it just in case by performing the following steps:
Go to the Project > Properties > AspectJ Compiler menu.
Check the Other > Outxml configuration property is disabled.

Release Symfony2 project to the web

I have almost finished the development of a project developed with Symfony2, and wish to put the project online.
However, I suppose there are a lot of things that need to be done so that everything works ok. I suppose, the dev mode needs to be disabled etc....What needs to be done and how?
What are the most important things to do on a Symfony2 project that will be available to everyone on the web?
I suggest you to use Capifony for deployment. It does a lot of stuff out of the box and you can make it run any custom commands you need. See its documentation for details.
Regarding the dev mode, unless you've removed the IP checks from app_dev.php, you don't have to worry about deploying it. Of course, if you wish, you can tell Capifony to delete it on deployment.
The best way to handle deployment is to create "build" script, which will:
Remove all folders and files with tests from your bundles and vendors.
Remove app_dev.php file
Make sure that app/cache and app/logs are fully writable/readable.
Packs your project into archive (rpm f.e.)
Then, before deployment, you should create tag in your project - so it will mean, that certain version of your application is released (I recommend to follow this git branching model).
Create tag.
Run your build script
Upload archive to host
Unpack
Enjoy your project
Im currently researching the same thing.
The first thing you have to consider is "how professional" you want to deploy. There are a lot of tools you can use:
Continous Integration Server ( e.g. Hudson, Jenkins)
Build Tools (e.g. Phing, Capistrano --> Capifony, Shell scripts)
Versioning Tools (e.g. Git, SVN)
I think the simplest setup is using only a Build tool and i guess you are already using some kind of versioning.
Depending on which tool you use, the setup is different, but I think there are some things you should consider with your application (maybe not all are applicable to your application)
Creating a Tag in your Versioning
Copying the new Code in an folder on production
--> if you are in a new folder you dont need to clear the cache and logs, since these shouldnt be in your versioning the first time.
loading composer (if youre using it)
installing vendors
updating database schema
install assets from your bundles
move symlink from current version to the folder of the new site
These are the things I currently need for my application for production deployment, if you deploy to an test environment you should load fixtures and run your testscripts as well.
One other option that is very well described here is to deploy the Symfony2 application with Apache Ant. Apache Ant is a Java library and command-line tool whose mission is to drive processes described in build files as targets and extension points dependent upon each other.

Environment-dependent compilation properties in Flex/AIR

I'm building a Flex/AIR application that connects to a remote server, the URL of which changes depending on the environment (development/production, and possibly others). For now, this URL parameter is hardcoded in my root application MXML file but it means I have to change it everytime I build my app for a different environment.
Is there a way to externalize such a parameter so that when Flash Builder automatically builds my app (in development mode), it uses the development URL (http://localhost...) and when Flash Builder exports a release build, it uses the production URL (http://www.mycompany.com/myapp)?
Flex compiler supports something called Conditional compilation, you an read about it here: link. The problem is that it still doesn't give you an way to check if you're exporting a release build or building for debug. Probably the simplest way to achieve that is to use ANT for compilation of the release build and use the conditional compilation from there.

Resources