When spring applications with gradle multi-module run on intellij's dashboard, it can't load property sources - spring

I setup spring boot applications project with gradle multi module project. Each module is just spring boot application. To run all applications, i have to refresh all module using refresh gradle project on root project. On the other hand, If i refresh a specific gradle module, other applications which also are submodule cannot load property source.
For a detailed explanation, i want to present sample application:
https://github.com/samplesrepo/sample-demonstrating-boot-cannot-load-propertysource-in-multi-module
And i uploaded a video demonstrating this problem in youtube:
(https://www.youtube.com/watch?v=5kGu6MhHfmY)

Related

Converting existing project to Spring boot project in InelliJ

I have an existing project. I need to make it a Spring boot based project and I am using IntelliJ CE.
What would be correct procedure for doing it?
Edit:
Project has no initial structure. It is a totally empty project. So no existing modules etc.
Spring Boot is an Ultimate feature, so first you would need to try/buy the IntelliJ IDEA Ultimate.
From there, you can add Spring support to existing project modules or use the Spring Initializr wizard to select the necessary configuration when creating a new project or module.
In your maven pom.xml or build.gradle file, I would add the spring boot starter dependency:
spring-boot-starter (the group id is org.springframework.boot)
If the application is a web application, I would also add the web starter spring-boot-starter-web also with the same group id (org.springframework.boot)
For convenient features, applying the spring boot plugin would help in creating a runnable jar with all required dependencies bundled called a fat jar.
A great tool I use is the spring boot project generator. It allows you to configure the modules you want and create a project template.
Spring Boot requires IntelliJ IDEA Ultimate. If you want to use IntelliJ CE, please create a project using Spring Initilizer then import the same to your IntelliJ CE (File -> Open -> Choose the project root folder). After you import the project, wait for some time so that IntelliJ can download the dependency and build your project. You can check from (Build -> Build your project). Then find the main class of spring boot and run it using the green play button

Spring Boot web app without maven

Friends,
I am trying to build a Spring boot project. but the challenge is maven isn't working in office environment(basically proxy isn't allowing).
Is there any way to create a spring boot project without maven?
if I can get any boiler code link would be very helpful.
Yes, it is possible. Just add all the necessary jar in project class path manually. Example Spring boot project jar added by gradle.
Part1
Part2

Spring Boot multi module WAR Generation

I have made a maven Spring boot (REST) Project that has 3 (maven) sub modules (i. api ii. implementation and iii. service modules).
The main method (#SpringBootApplication) is in the root of the project. The REST web service works fine from IDE but maven does not allow me to package this project as war and deploy to external tomcat.
To solve this I added a new module and added dependencies of other modules within this and packaged this as war (by adding maven-war-plugin). But when deployed on server; the webservice does not get hit.
Structure-
Service Project
main()(This is within root project)
api module
service module
implementation module
Newly added module (that has above 3 modules injected as dependency and the plugin that let me package this as a war)
Expecting a war that has all these submodules that can be deployed on external Tomcat 9 server.
How to achieve this?
Please Note - I have added spring-boot-maven-plugin
to repackage in the root project, but it is not working.
Adding parent to this newly added module fixed the issue and I was able to make a working jar!

Spring Boot Gradle plugin - live reload of resources with multi-module project

I am having problems getting live reload of static resources to work with a gradle multi-module project.
Here is my simplified project structure:
project
- application
- src/main/java/com/mypackage/MyApplication.java
- web
- src/main/resources/index.html
If I am running the spring boot gradle plugin bootRun task to launch my application in place, via the command line, the live reload of static resources within web resources does not get picked up.
Now I know if the spring boot application were to exist in web also, the live reload would work.
My two questions are:
When running the application in place with bootRun and a multi-module structure, does it build the classpath from the dependency modules build/classes or use the lib/mydependency.jar?
Is there a way to configure the plugin to consider peer modules resources for live reloading?

Maven Pom Update

I am using Spring Tool Suite (STS) for my Spring boot application development.
I am using the Spring Started Project option to select the component required for my applications. For example: if I want to develop web application, I will select the "web" check box and spring io initailzier will download all the required jars in the classpath with help of maven.
Suppose, after the project creation for WEB, If I want to add some other components in my existing web project like using Eureka, Hystrix, the required jars are not automatically setup in the classpath and couldn't use the annotation like #EnableEurekaClient as it throws error as jar is missing.
I have manually updated the pom.xml to include the Eureka starter/client/server dependency and trying to update the project (Project >> Maven >> Update Project), so that required jars will be in classpath. But it is not happening.
Any advise on it..thanks.

Resources