quarkus动态注入Bean

通过@Produces注解例如:

package com.wzh.app.beans;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import javax.enterprise.inject.Produces;

public class InitBean {

    @Produces
    public ObjectMapper objectMapper() {
        return new ObjectMapper().disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
    }
}

 

posted @ 2020-12-28 13:12  yshy  阅读(664)  评论(0编辑  收藏  举报