Dkngit 发布的文章

Here is the difference:

  • addFlashAttribute() actually stores the attributes in a flashmap (which is internally maintained in the users session and removed once the next redirected request gets fulfilled)
  • addAttribute() essentially constructs request parameters out of your attributes and redirects to the desired page with the request parameters.

So the advantage of addFlashAttribute() will be that you can store pretty much any object in your flash attribute (as it is not serialized into request params at all, but maintained as an object), whereas with addAttribute() since the object that you add gets transformed to a normal request param, you are pretty limited to the object types like String or primitives.

answerd by Biju Kunjummen


This looks like a bug in Spring: spring-projects/spring-boot#27147

JS WebSocket class can't connect to the server and there is nothing to fix on our side.
The same happens with:

  • console code ws = new WebSocket("ws://localhost: 35729");
  • Live reload Chrome extension: it doesn't work with 2.5.2

Fixed in Spring Boot 2.4.9 & 2.5.3

Live reload is broken starting with Spring Boot 2.5.2 #11375
DevTools' LiveReload support's HTTP header handling is case sensitive #26813


Whenever login to debian OS via ssh will get this message:

Linux ds1821-virtual-debian 5.10.0-15-amd64 #1 SMP Debian 5.10.120-1 (2022-06-09) x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.


As Joan notes, motd is the key. The Debian wiki has good information on how the motd file is generated at boot and how to modify it. Check out the How to keep your /etc/motd from being overwritten section to make permanent motd changes.

If you just want to disable it for your user, create a .hushlogin file in your home directory:

touch ~/.hushlogin

    <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
        <property name="messageConverters">
                <bean class="org.springframework.http.converter.StringHttpMessageConverter">
                    <property name="supportedMediaTypes" value = "text/plain;charset=UTF-8" />
                <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter" />

此时配置,response content-type 依然是 text/plain;charset=ISO-8859-1

            <bean class="org.springframework.http.converter.StringHttpMessageConverter">
                    <util:constant static-field="java.nio.charset.StandardCharsets.UTF_8"/>
                <property name="writeAcceptCharset" value="false" />

<mvc:annotation-driven> 配置存在时,bean StringHttpMessageConverter 放于 <mvc:message-converters> 中, response 才能正确返回 text/plain;charset=UTF-8

声明 util:
<beans ...
xml: 注入静态成员变量至 spring bean