com.ling.spring.environment.AppConfig.java Source code

Java tutorial

Introduction

Here is the source code for com.ling.spring.environment.AppConfig.java

Source

/*
 * Copyright 2005-2020 Daxia Team All rights reserved.
 * Support: zhangzhen
 * License: Daxia Team license
 */
package com.ling.spring.environment;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;

@Profile("test")
@Configuration
// @PropertySource environment?applicationContext.getEnvironment().getProperty("jdbc.driver")?
@PropertySource(value = "classpath:config.properties", ignoreResourceNotFound = false, name = "myconf")
public class AppConfig {

    /**
     * ?bean@value???@Bean
     * @return
     */
    @Bean
    public PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
        return new PropertySourcesPlaceholderConfigurer();
    }
}