AllenInWood's Blog

WritingAndCoding

  • Home
  • project
  • Categories
  • About
  • Archives
  • Tags
  • 公益404

Springboot Restful API summary

Posted on 2017-11-11   |   In code   |   0 comments   |   visitors
Request type URL Function
GET /users get list of users
POST /users create a user
GET /users/id find user by id
PUT /users/id update user by id
DELETE /users/id delete user by id

updating comeback

Posted on 2017-11-09   |   In chatting   |   0 comments   |   visitors

COME BACK

I am going to come back to my blog updating after two months’ silence.
And I changed my platform from windows to macOS.
I will focus more on technique skills in coding and talk more on what I faced during coding.
What’s more, I will update some articles about my thoughts & my values during life growing.

Thank you for your coming!

堆中i结点的子树大小至多为2n/3的证明

Posted on 2017-07-08   |   In code   |   0 comments   |   visitors

完全树的结点数n = 2^h - 1
亦有 结点数n = 2*底层结点数 - 1
注:底层结点数x = 2^(h - 1)

堆中i结点的子树大小至多为2n/3的证明

问题:在任一含n个元素的堆中,至多有ceiling(n/(2^(h+1)))个高度为h的节点。

Read more »

The difference between applicationContext.xml in Spring and xxx-servlet.xml in SpringMVC

Posted on 2017-03-18   |   In code   |   0 comments   |   visitors

一直搞不明白两者的区别。
如果使用了SpringMVC,事实上,bean的配置完全可以在xxx-servlet.xml中进行配置。为什么需要applicationContext.xml?一定必须?

First

因为直接使用了SpringMVC,所以之前一直不明白xxx-servlet.xml和applicationContext.xml是如何区别的,其实如果直接使用SpringMVC是可以不添加applicationContext.xml文件的。
使用applicationContext.xml文件时是需要在web.xml中添加listener的:

<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

而这个一般是采用非spring mvc架构,如使用struts之类而又想引入spring才添加的,这个是用来加载Application Context。
如果直接采用SpringMVC,只需要把所有相关配置放到xxx-servlet.xml中就OK了。

Second

Spring lets you define multiple contexts in a parent-child hierarchy.

The applicationContext.xml defines the beans for the “root webapp context”, i.e. the context associated with the webapp.

The spring-servlet.xml (or whatever else you call it) defines the beans for one servlet’s app context. There can be many of these in a webapp, one per Spring servlet (e.g. spring1-servlet.xml for servlet spring1, spring2-servlet.xml for servlet spring2).

Beans in spring-servlet.xml can reference beans in applicationContext.xml, but not vice versa.

All Spring MVC controllers must go in the spring-servlet.xml context.

In most simple cases, the applicationContext.xml context is unnecessary. It is generally used to contain beans that are shared between all servlets in a webapp. If you only have one servlet, then there’s not really much point, unless you have a specific use for it.

More info: Source link

Difference between redirection and forward in Java

Posted on 2017-03-10   |   In code   |   0 comments   |   visitors

今天来说一下redirection与forward在Jsp中的一些细微差别

Read more »
1234
AllenInWood

AllenInWood

imagination

18 posts
3 categories
30 tags
GitHub
© 2016 - 2019 AllenInWood