简体   繁体   English

去哪里看春天?

[英]Where to look to understand spring?

My real question is about how to look up the expectations on the methods (the 'contract' for a method) in Spring. 我真正的问题是关于如何在Spring中查找对方法的期望(方法的“合同”)。 I keep hitting questions, where unless I find some blogger or a stack-overflow that addresses that specific issue, there seems to be no informative documentation. 我不断提出问题,除非找到一些博客作者或解决该特定问题的堆栈溢出问题,否则似乎没有提供任何信息的文档。 Am I looking the wrong places? 我在找错地方了吗? Do I need to buy some book? 我需要买书吗?

In the current specific case: I have working looking up a user/password by making my SQL table map to Spring's defaults, but when a user is absent it's hitting a null pointer exception. 在当前的特定情况下:我正在通过使我的SQL表映射到Spring的默认值来查找用户/密码,但是当用户不存在时,它将遇到空指针异常。 I see JdbcUserDetailsManager 's " void setUserExistsSql( anSQLString) ", and I want to know if that sql-string should return a boolean? 我看到了JdbcUserDetailsManager的“ void setUserExistsSql( anSQLString) ”,并且我想知道该sql字符串是否应返回布尔值? a null? 空吗? and what it should be 'named.' 以及它的“名称”。 Googling is not turning up any usage examples, nor any documentation. 谷歌搜索没有出现任何用法示例或任何文档。 The javadocs I'm finding are uncommented. 我找到javadocs没有评论。 I can guess-and-test, but it seems there should be a better way to look-it-up? 我可以猜测并测试,但似乎应该有更好的查找方法?

Ok, I've been working with spring since version 1, and many other open-source projects follow the same pattern. 好的,从版本1开始,我就一直在使用spring,其他许多开源项目也遵循相同的模式。 Documentation is hard and expensive to produce, and programmers donating their time for free often don't want to write it. 文档制作困难且成本高昂,程序员免费捐赠时间通常不愿意编写。 Spring though is one of the better projects as far as documentation is concerned. 就文档而言,Spring是更好的项目之一。

However, I've always found it necessary to link spring's source code into my project. 但是,我总是发现有必要将spring的源代码链接到我的项目中。 If you're using maven you can download the sources along with the jars, and tools like IntelliJ (and probably eclipse) will allow you to drill down into the source and to trace its execution with their debuggers. 如果您使用的是maven,则可以将源代码与jar一起下载,而诸如IntelliJ(甚至是eclipse)之类的工具将允许您深入研究源代码并使用其调试器跟踪其执行。

With these types of projects it is almost always necessary at some point to drill down and read the source, and that's a good thing because the source is always up to date and always exactly describes the behaviour you're trying to use. 对于这些类型的项目,几乎总是需要在某些时候深入挖掘和阅读源代码,这是一件好事,因为源代码始终是最新的,并且始终准确地描述了您要使用的行为。 Documentation on the other hand is often badly written using an informal language (eg English) and it can never accurately describe anything, especially if it's being written or read by someone who isn't a native speaker, which is often the case. 另一方面,文档通常使用非正式语言(例如英语)编写得很差,并且永远无法准确地描述任何内容,特别是如果文档是由非母语的人编写或阅读的,通常就是这种情况。

So, to answer your question -- look to the source. 因此,要回答您的问题-请查看源代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM