Druid appears (*) druid property for user to setup solution

 

introduction:

Druid appeared (*)druid property for user to setup, which made me find it hard to find it. I checked the official documents and found no problems. Finally found the following solution. Hope it helps you. .

If you have already configured it, directly change druid-1.0.12.jar, directly change the version to: druid-1.0.11.jar or upgrade to the latest version druid-1.0.29.jar (validated on 2017-04-07) , Reboot, save some time and don't have to look down, here are the steps I found to solve the problem.

1. Introduce the jar package in the maven project pom.xml:

 

<dependency>  
    <groupId>com.alibaba</groupId>  
    <artifactId>druid</artifactId>  
    <version>1.0.12</version>  
</dependency>  

2. Configure the data source:

 

 

<!-- druid setting -->
    <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource"
          init-method="init" destroy-method="close">
        <property name="driverClassName" value="${ds.druid.driver}"/>
        <property name="url" value="${ds.druid.url}"/>
        <property name="username" value="${ds.druid.username}"/>
        <property name="password" value="${ds.druid.password}"/>
        <property name="initialSize" value="${ds.druid.initialSize}"/>
        <property name="minIdle" value="${ds.druid.minIdle}"/>
        <property name="maxActive" value="${ds.druid.maxActive}"/>
        <property name="maxWait" value="${ds.druid.maxWait}"/>
        <property name="timeBetweenEvictionRunsMillis" value="${ds.druid.timeBetweenEvictionRunsMillis}"/>
        <property name="minEvictableIdleTimeMillis" value="${ds.druid.minEvictableIdleTimeMillis}"/>
        <property name="filters" value="stat,wall" />
        <!-- optional -->
        <property name="proxyFilters">
            <list>
                <ref bean="stat-filter"/>
            </list>
        </property>
    </bean>

<!-- The optional druid monitoring statistics bean corresponds to the proxyFilters in the dataSource above -->
    <bean id="stat-filter" class="com.alibaba.druid.filter.stat.StatFilter">
         <property name="slowSqlMillis" value="1000" />
        <property name="logSlowSql" value="true" />
        <property name="mergeSql" value="true" />
    </bean>

 3. Find the web.xml under the project and add the following configuration:

 

 

<!-- Database monitoring start -->
    <servlet>
        <servlet-name>DruidStatView</servlet-name>
        <!-- The servlet that displays the monitoring page -->
        <servlet-class>com.alibaba.druid.support.http.StatViewServlet</servlet-class>
        <init-param>
            <param-name>profileEnable</param-name>
            <param-value>true</param-value>
        </init-param>
        <init-param>
            <param-name>resetEnable</param-name>
            <param-value>false</param-value>
        </init-param>
        <!-- Optional login username and password-->  
        <init-param>  
            <param-name>loginUsername</param-name>  
            <param-value>druid</param-value>  
        </init-param>  
        <init-param>  
            <param-name>loginPassword</param-name>  
            <param-value>druid</param-value>  
        </init-param>
    </servlet>
    <servlet-mapping>
        <servlet-name>DruidStatView</servlet-name>
        <url-pattern>/druid/*</url-pattern>
    </servlet-mapping>

 4. After starting the project, enter the following address in the browser, you can see the login interface

http://localhost:8888/druid/

Enter username and password: druid



 5. Click "Data Source", and " (*)druid property for user to setup " will appear



 

6. Reduce the version of the jar package introduced by maven from 1.0.12 to 1.0.11

 

 

<dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid</artifactId>
            <version>1.0.11</version>
        </dependency>
or use:

 

       <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid</artifactId>
            <version>1.0.29</version>
        </dependency>
 

 

7,  start again, as shown below, you're done~~~



 

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326655756&siteId=291194637