Jython-使用Spring,用Python编程吗? [英] Jython - Using Spring, Programming in Python?

查看:145
本文介绍了Jython-使用Spring,用Python编程吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,我是这方面的新手.

Ok, I'm a total newbie in this stuff.

所以,我知道Spring作为框架确实非常好,并且我已经在Python中编程了一段时间了,所以我想知道是否可以使用Spring Framework但可以使用来自Python的代码.

So, I know Spring is really good as a framework, and I've been programming in Python for a while, so I was wondering if somehow I can use the Spring Framework but use code from Python.

我听说Jython可能是这样做的好机会,因为(我认为)Python是在JVM上运行的,对吧?

I heard that maybe Jython was a good possibility for doing this, since it's (I think) Python running on the JVM, right?

那么,这可能吗?我可以在使用Python编码时使用Spring吗?

So, is this possible? For me to use Spring while coding in Python?

推荐答案

首先,您说对了,Jython是在JVM中运行的Python.它不仅可以在JVM中运行,而且还可以按照您想要的几乎所有方式与之交互-将Java类用作Python类,在Python类中实现Java接口并将其传递给Java代码,等等.

First, you're right that Jython is Python running in the JVM. And it's not just running in the JVM, it can interact with it in pretty much all the ways you want—use Java classes as Python classes, implement Java interfaces in a Python class and pass it to Java code, etc.

但是,与某些其他JVM语言不同,Jython并未尝试在语义上等同于Java(或Java的超集).当然,Python和Java具有非常不同的惯用风格.

However, unlike some of the other JVM languages, Jython doesn't make any attempt to be semantically equivalent to Java (or to a superset of it). And of course Python and Java have very different idiomatic styles.

因此,简而言之,几乎一切皆有可能,但并非一切如马辛所说的令人愉快.

So, in short, just about anything is possible, but not everything is pleasant, as Marcin says.

有关Spring如何与Jython配合使用的详细信息,Google进行了快速搜索"Spring Python" 的网站一个>.似乎这可能是Spring到Python的移植,而不是关于将Jython与Spring一起使用. (该项目采用了Spring的概念,并将其应用于Python的语言和环境.其中包括实用的库和有用的抽象,它们很快使您重新投入到可以赚钱的代码上.")因此,这可能是另一个您的替代选择.

For specifics about how Spring works with Jython, a quick Google search turned up See how Spring Python works with Jython. And in fact, it's part of a blog called "Spring Python", which is part of a site also called "Spring Python". It seems like this may be a port of Spring to Python rather than about using Jython with Spring. ("This project takes the concepts of Spring and applies it to the language and environment of Python. This includes pragmatic libraries and useful abstractions that quickly gets you back to working on the code that makes you money.") So, that might be another alternative for you.

下一个搜索结果是 Jython Spring MVC控制器.

还有其他六项令人鼓舞的成果.因此,我认为您可以轻松找到信息和示例.

And there were half a dozen other promising results. So, I think you'll have no problem finding information and examples.

这篇关于Jython-使用Spring,用Python编程吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆