跳至主要內容
"关于Spring-statemachine的一些看法"

"关于Spring-statemachine的一些看法"

我们需要有状态的状态机么?

昨天和今天再一次翻看了一下Spring-Statemachine项目的最新进展, 上一次看这个项目的文档还是几年前。 之所以之前关注这个项目主要有2个原因吧,第一个就是spring的project一般比较有质量保证,第二个是状态机本身是一个用途非常广泛的架构设计。所以这个项目一直让我 惦记着。


xkrivzooh大约 3 分钟postspringjava系统设计
构造函数中使用Spring @Value注解

构造函数中使用Spring @Value注解

如果想在构造函数中使用的@value注解的话,demo如下:

// File: sample/Message.groovy
package sample

import org.springframework.beans.factory.annotation.*
import org.springframework.stereotype.*

@Component
class Message {

    final String text

    // Use @Autowired to get @Value to work.
    @Autowired
    Message(
        // Refer to configuration property
        // app.message.text to set value for 
        // constructor argument message.
        @Value('${app.message.text}') final String text) {
        this.text = text
    }

}

xkrivzooh小于 1 分钟postjavaspring
为Spring boot项目增加Servlet

为Spring boot项目增加Servlet

为Spring boot项目增加Servlet有好多种方式

方式1

Just add a bean for the servlet. It'll get mapped to /{beanName}/.

@Bean
public Servlet foo() {
    return new FooServlet();
}

xkrivzooh大约 1 分钟postspringjava
Spring的AntPathMatcher是个好东西

Spring的AntPathMatcher是个好东西

经常需要在各种中做一些模式匹配,正则表达式虽然是个好东西,但是Ant风格的匹配情况也非常的多。 这种情况下使用正则表达式不一定方便,而Spring提供的AntPathMatcher确可以帮助我们简化很多。

位于Spring-core中的org.springframework.util.AntPathMatcher使用起来非常简单:


xkrivzooh小于 1 分钟postjavaspring
跨域资源共享以及Spring MVC的支持

跨域资源共享以及Spring MVC的支持

本来想写文章详细整理一下「跨域资源共享,以及在Spring MVC中如何实现」,但是发现网站上已经有很多文章总结了, 相信我在怎么写也和绝大多数文章的差别不大,所以我选中了5篇比较不错的文章(地址在文章参考资料中)作为引用。 所以读者直接看引用的这几篇文章就好了。

##参考资料


xkrivzooh小于 1 分钟postspring
打赏
给作者赏一杯咖啡吧
您的支持将是我继续更新下去的动力
微信微信
支付宝支付宝