Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

druid-spring-boot-starter增加WallConfig的配置项 #1800

Closed
cxjava opened this issue Jun 28, 2017 · 2 comments
Closed

druid-spring-boot-starter增加WallConfig的配置项 #1800

cxjava opened this issue Jun 28, 2017 · 2 comments
Milestone

Comments

@cxjava
Copy link

cxjava commented Jun 28, 2017

建议在druid-spring-boot-starter中增加WallConfig的配置项。目前使用的druid-spring-boot-starter没有办法自定义配置WallConfig。

@lihengming
Copy link
Contributor

lihengming commented Jul 5, 2017

@cxjava WallConfig的配置项太多了,推荐你在Spring Boot 中使用下面这种方式来自定义配置WallFilter。

spring.datasource.druid.wall.config.multiStatementAllow=false
spring.datasource.druid.wall.config.truncateAllow=true
    @Bean
    @ConfigurationProperties("spring.datasource.druid.wall.config")
    public WallConfig wallConfig(){
        return new WallConfig();
    }

    @Bean
    public WallFilter wallFilter(){
        WallFilter filter = new WallFilter();
        filter.setConfig(wallConfig());
        filter.setDbType("mysql");
        return filter;
    }

    @Bean
    public DataSource dataSource(Environment env){
        DruidDataSource dataSource = DruidDataSourceBuilder
                .create()
                .build(env,"spring.datasource.druid.");
        List<Filter> filters = new ArrayList<>();
        filters.add(wallFilter());
        dataSource.setProxyFilters(filters);
        return dataSource;
    }

@wenshao
Copy link
Member

wenshao commented Jul 23, 2017

问题已解决,请用新版本
https://github.com/alibaba/druid/releases/tag/1.1.2

@wenshao wenshao closed this as completed Jul 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants