Closed emschu closed 2 years ago
Thank you very much for looking into this PR, providing feedback and integrating most of its changes.
Servlet context path has changed from /MBP to /mbp
Is there a certain reason why this was necessary? While it may force some of the project developers to adapt their local development environments accordingly, for me this change is fine.
No, this change is not really necessary, but it will most certainly cause effects in depending projects, which rely on the uppercase variant. I want to let you decide if this change is helpful.
Thanks a lot!
I started to get the most recent version of MBP to work locally and ran into a lot of problems. This is about how it started, because I didn't intend to modernize and clean up (a little) the project firstly... But I think there is a chance that you might find these fixes, changes and updates helpful :)
At first I just wanted to make a proper docker(-compose) build for testing and (potential) development purposes, because I have to rely on this project in the university context. Looking at the code and the installation routine I found the self-made Tomcat-deployment-solution which is really not required here, because Spring Boot is already able to build a "fat jar" containing a (well-configured) Tomcat servlet container for the application. There is also a lot of boilerplate code which is really not necessary to get this project to work. I thought I could do the changes quickly and move on, but I had to solve different problems to get the app working both locally during development and deployed in a docker container. So I fixed the problems keeping in mind you could appreciate a proper project setup too.
To get the project to work with docker(-compose), one needs to execute the following commands on this branch:
Visit: 127.0.0.1:8080/mbp
That's it.
The
mbp
service in thedocker-compose.yml
can be commented out to have a working development environment with MongoDB + Custom Mosquitto and the IDE could start the app. Also useful for unit tests.This PR contains:
.war
file created, but aMBP.jar
and the corresponding (complicated) maven plugin section is removed, because the spring-boot-maven-plugin already does all this and moreconfig.properties
,PropertySourcesConfiguration
/MBP
to/mbp
pom.xml
which makes development sometimes a lot easier + providing detailled app's health informationnew EntityModel()
->EntityModel.of()
.jar
in development, in docker and in "prod" environment with proper default values.dev
anddocker
. You should usedev
during local development.is_secure
build argument in thedocker-compose.yml
file.true
means the mosquitto container is shipped with the plugin binary as well.pom.xml
is cleaned up/src/main/webapp
->/src/main/resources/templates
(spring boot default location for templates)WEB-INF
was a hardcoded path.Notes:
Exception
s are swallowed, ignored or are too generic, e.g.catch(Exception ex){}
. This makes it really hard to debug the application if something fails.DynamicBeanProvider
is evil and can cause very confusing bugs (I found at least one), because Spring wants you to use Dependency Injection.@Lazy
annotation should avoid problems with these code places.Issues:
requestOAuth2Token()
-method returns 401. This should be investigated.It would be great to receive your honest feedback on this - unfortunately pretty big - PR. Please let me know what you think about these changes.