The issues with Java threads in the question are addressed by the project Loom, which is now included in Jdk21. It is very well explained here https://www.baeldung.com/openjdk-project-loom :

Presently, Java relies on OS implementations for both the continuation [of threads] and the scheduler [for threads].

Now, in order to suspend a continuation, it's required to store the entire call-stack. And similarly, retrieve the call-stack on resumption. Since the OS implementation of continuations includes the native call stack along with Java's call stack, it results in a heavy footprint.

A bigger problem, though, is the use of OS scheduler. Since the scheduler runs in kernel mode, there's no differentiation between threads. And it treats every CPU request in the same manner. (...) For example, consider an application thread which performs some action on the requests and then passes on the data to another thread for further processing. Here, it would be better to schedule both these threads on the same CPU. But since the [OS] scheduler is agnostic to the thread requesting the CPU, this is impossible to guarantee.

The question really boils down to Why are OS threads considered expensive?

Answer from Albert Hendriks on Stack Overflow
Top answer
1 of 4
10

The issues with Java threads in the question are addressed by the project Loom, which is now included in Jdk21. It is very well explained here https://www.baeldung.com/openjdk-project-loom :

Presently, Java relies on OS implementations for both the continuation [of threads] and the scheduler [for threads].

Now, in order to suspend a continuation, it's required to store the entire call-stack. And similarly, retrieve the call-stack on resumption. Since the OS implementation of continuations includes the native call stack along with Java's call stack, it results in a heavy footprint.

A bigger problem, though, is the use of OS scheduler. Since the scheduler runs in kernel mode, there's no differentiation between threads. And it treats every CPU request in the same manner. (...) For example, consider an application thread which performs some action on the requests and then passes on the data to another thread for further processing. Here, it would be better to schedule both these threads on the same CPU. But since the [OS] scheduler is agnostic to the thread requesting the CPU, this is impossible to guarantee.

The question really boils down to Why are OS threads considered expensive?

2 of 4
7

FastAPI is a fast framework, and you can quickly (and easily) create API backends in it. To be honest, if you are a Java developer, I would recommend Quarkus or something for building a REST API, not FastAPI. FastAPI is a fantastic tool, absolutely great if you are already in the Python ecosystem.

When it goes about multithreading; Java is 'real' multithreading where as Python is very much not. Java threads will run concurrently; two tasks can and will be executed at the same time. In Python, within one Python process, this is (nearly) impossible. The reason for this is GIL (google it, there is ton's of stuff out there on how it works). The result is; even if you use 'real' threads in Python, code is still not executed concurrently but rather serially, where the interpreter (big difference to Java) is jumping from one call stack to another constantly.

As to what you refer to as 'logical threads', I think you mean the asynchronous capability of Python. This is basically the same as using threads (not really, but on an abstract level they are very similar); tasks are not run concurrently. There is just one thread that constantly switches between tasks. Tasks will yield back control to the event loop (the object that coordinates tasks and decides what is executed in which order), and another task is further executed until that task yields control, etc. It is basically the same kind of execution pattern as with threads within Python.

Comparing a Python framework to a Java framework is just weird in my opinion. They are both useful and cool, but not really competitors.

🌐
StackShare
stackshare.io › stackups › python-vs-spring-boot
Python vs Spring Boot | What are the differences? | StackShare
Development Paradigm: Python follows a more procedural and object-oriented programming paradigm, allowing developers to write code that is easier to understand and maintain. In contrast, Spring Boot follows a more declarative programming paradigm, providing developers with a higher level of abstraction and reducing the amount of boilerplate code.
🌐
Medium
medium.com › deno-the-complete-reference › python-vs-springboot-performance-comparison-for-jwt-verify-and-mysql-query-d2c28bff3958
Python vs SpringBoot: Performance comparison for JWT verify and MySQL query | Tech Tonic
June 29, 2023 - On the Python side, I’m using FastAPI (of course). And the other frameworks on Python side are jwt for verifying & decoding JWTs, and mysql-connector for performing MySQL queries. On the SpringBoot side, I’m using jjwt for verifying and decoding JWTs.
🌐
Reddit
reddit.com › r/python › pyspring - a python web framework inspired by spring boot.
r/Python on Reddit: PySpring - A Python web framework inspired by Spring Boot.
June 15, 2025 -

I've been working on something exciting - PySpring, a Python web framework that brings Spring Boot's elegance to Python. If you're tired of writing boilerplate code and want a more structured approach to web development, this might interest you!

- What's cool about it:

  • Auto dependency injection (no more manual wiring!)

  • Auto configuration management

  • Built on FastAPI for high performance

  • Component-based architecture

  • Familiar Spring Boot-like patterns

    • Recent PRs:

      • Route Mapping Decorators Implementation #3

      • Add Support for Qualifiers and Component Registration Validation

  • GitHub: https://github.com/PythonSpring/pyspring-core

  • Example Project: https://github.com/NFUChen/PySpring-Example-Project

Note: This project is in active development. I'm working on new features and improvements regularly. Your feedback and contributions would be incredibly valuable at this stage!If you like the idea of bringing Spring Boot's elegant patterns to Python or believe in making web development more structured and maintainable, I'd really appreciate if you could:

  • Star the repository

  • Share this with your network

  • Give it a try in your next project

Every star and share helps this project grow and reach more developers who might benefit from it. Thanks for your support! 🙏I'm actively maintaining this and would love your feedback! Feel free to star, open issues, or contribute. Let me know what you think!

🌐
Dreamix
dreamix.eu › home › insights › tech › how to use jython with spring boot
How to use Jython with Spring Boot - Dreamix
July 16, 2024 - And that’s all. We can use our python implementation just as we would use a normal Spring service. That was just a simple example but it wouldn’t be much different if we need to create more complex python classes that rely on external libraries, etc. We can also extend Java classes in Python.
Find elsewhere
🌐
PyPI
pypi.org › project › pyctuator
pyctuator · PyPI
This is where Pyctuator comes in. It allows you to easily integrate your Python microservices into your existing Spring Boot Admin deployment.
      » pip install pyctuator
    
Published   Jan 17, 2024
Version   1.2.0
🌐
DevOpsChat
devopschat.co › articles › python-versus-java-springboot-for-apis
DevOpsChat | Python Versus Java Springboot for APIs
August 10, 2023 - Python Versus Java Springboot for APIs Comparing Python and Java SpringBoot for APIs development, Python provides simplicity and readability, making it a great choice for beginners, while Java SpringBoot’s robust structure and efficiency make ...
🌐
Quora
quora.com › Which-is-best-Java-Spring-Boot-or-Python-Django
Which is best, Java Spring Boot or Python Django? - Quora
Answer (1 of 2): Django is really as moto its says: The Web Framework For Perfectionists With Deadlines. If you are a developer you can learn Django and be up and running in four hours. Django ORM is similar to defining a table in a relational database. You don't have to know that much about Pyth...
🌐
Spring
docs.spring.io › spring-python › 1.2.x › sphinx › html › overview.html
1. Overview — Spring Python v1.2.1.FINAL documentation
DatabaseTemplate - Reading from the database requires a monotonous cycle of opening cursors, reading rows, and closing cursors, along with exception handlers. With this template class, all you need is the SQL query and row-handling function. Spring Python does the rest.
🌐
Similarweb
similartech.com › compare › python-vs-spring
Python VS Spring - Framework Technologies Market Share ...
Discover SimilarTech by Similarweb, the leading platform for web technology analysis. Check technology stacks & gain insights on competitors’ tools. Try it now!
🌐
GeeksforGeeks
geeksforgeeks.org › gblog › spring-boot-alternatives
Top 10 Spring Boot Alternatives [2025 Updated] - GeeksforGeeks
July 23, 2025 - The above mentioned top alternatives of Spring Boot are the best ones and each alternative holds their own unique advantages and challenges. You can choose the best ones for your project based on demand for your specific requirements, features, limitations, and security concerns.
🌐
Quora
quora.com › Should-I-abandon-Spring-Boot-Java-for-Python-Django
Should I abandon Spring Boot/Java for Python/Django? - Quora
Answer (1 of 3): Python, being dynamically typed language, is a tool, that in the hands of a competent developer provides great power. With Django, you will be able to create your first web-based app capable of working with the data in a database using powerful admin interface within the course ...
🌐
Reddit
reddit.com › r/webdev › java+spring or python+flask/django? which backend-framework is more stable and currently active on the market?
r/webdev on Reddit: Java+spring or Python+Flask/Django? Which backend-framework is more stable and currently active on the market?
April 9, 2019 -

Hello,

When you want to get a good job it is best to focus on a particular framework within a programming language such as Java, Python, Javascript, PHP and the most used framework for that particular language. Java+Spring, Python+Flask/Django, etc. I am making some decisions based on stability, tutorials online, what the market is offering in jobs and so on. Personally, I think Java and Python are better for me because they offer great OOP and architectural designs. I just need to decide between these two. I think Java+Spring sounds more robust but I don't know wheater more "fun" jobs will appear in Python. I think python is a little more flexible as it can be just a script but at the same time a large project with OOP. Looking at tutorials online, python offers more it seems and they include fun images etc. On the other hand, Java seems a little more stable. What are your opinions on this and what are you personally working with?

🌐
Reddit
reddit.com › r/webdev › what's better, springboot aka java or python?
r/webdev on Reddit: What's better, SpringBoot AKA Java or Python?
July 15, 2021 -

Hi! I'm a webdev newbie and I'm currently looking for a good framework to try out. I'd like to know, regardless of my expertise and learning curve of either language, which would be a better choice for building a fast and reliable website? Java(SpringBoot) or Python(Flask/Django)? And can you give some examples of websites made with either language? If anybody has any other suggestions(like JS) besides these two languages/frameworks, feel free to tell me as well. Thanks in advance!! :D

Top answer
1 of 4
5
It depends what your aiming for, much of Enterprise Web based Applications run with Spring Boot. It's mostly used as Backend Only and a separate Frontend. I would recommend looking at HTMX + Spring Boot https://youtu.be/aGgWvwb5xUE Django is more Full Stack and probably easier to do fast development. I would recommend Dennis Ivy on YouTube
2 of 4
5
Like others have said already - It depends on what you're going to build... Java (spring/spring boot) - is an enterprise framework used mainly for managing heavy db transactions, mostly in financial industries like those corpo banks. Python(Flask/Django) - on the other hand, is more of general purpose lang (like swiss army knife).. Django is more common to hear on web dev due its out of box features included. Flask is easier to get into if you are just starting out. Few examples - reddit, airbnb, dropbox, instagram etc.. Let's try & level down a little bit here ye... In your post, you mentioned that you are new (to this sub? or web programming in general?)... Either way - Why are you jumping straight into web frameworks?? (this is like using a Ginsu knife while still learning how to cook OR getting a Lambo when you just passed your driving test yesterday) my point here is: do you understand different layers of a web app (business logic, presentation, data persistence/data storage etc.) do you have a fundamental knowledge of how web works (http get, event handlers, DOM elements, html/css, forms etc.) understanding of web servers & how they communicate w/ your website (networking/security)... and the list goes on Not saying you need to be proficient on all of the above, just an understanding will suffice then you can dig deeper into each parts & possibly specialise on one. Having said that, based on your post i will go for Flask as it is a good tool in learning fundamentals & has core pieces you need w/c is available on almost all other frameworks. If this was me (And I need to re-learn everything), I'd start w/ barebones html, css w/ vanilla JS. Then take next step with PHP & setup a LAMP stack locally. Anyways, I'm blaberring on about things now - I wish you goodluck on your webdev journey mate.
🌐
Slant
slant.co › versus › 158 › 1398 › ~spring-boot_vs_flask
Spring-boot vs Flask detailed comparison as of 2026 - Slant
Spring boot is built for fast prototyping. Flask is very easy to get up and going, with vanilla HTML or with bootstrap pieces. It doesn't take much lines of Python to load Flask to get headers working, etc, and since it's all modular you don't ...
🌐
Better Stack
betterstack.com › community › guides › scaling-python › spring-boot-vs-django
Spring Boot vs. Django | Better Stack Community
September 11, 2025 - The repository pattern separates data access from business logic, while Spring Data JPA generates implementation code from method names like findByEmail. You can switch databases by changing configuration properties without touching code.
🌐
Quora
quora.com › Are-there-any-application-framework-like-spring-Java-framework-for-python
Are there any application framework like spring (Java framework) for python? - Quora
Answer (1 of 2): Spring framework is a java based framework which uses MVC .Am assuming you want a similar kind of framework in Python ,if that being the case you should checkout Django framework , there are others see outline below. * CherryPy. * Django. * Quixote. * Zope. * Flask. * Grok...