系列八、IOC操作bean管理(外部属性文件)

# jdbc.properties
db.driverClassName: com.mysql.cj.jdbc.Driver
db.url: jdbc:mysql://localhost:3306/20230503_jdbc?useSSL=false&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT
db.username: root
db.password: 123456

# applicationContext.xml



    
    

    
    
        
        
        
        
    



/**
 * IOC操作bean管理(外部属性文件)
 */
@Test
public void beanManagementTest14() {
	ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("applicationContext14.xml");
	DruidDataSource druidDataSource = context.getBean("druidDataSource", DruidDataSource.class);
	System.out.println("druidDataSource = " + druidDataSource);
}

你可能感兴趣的:(Spring5系列,java)