`
conkeyn
  • 浏览: 1521071 次
  • 性别: Icon_minigender_1
  • 来自: 厦门
社区版块
存档分类
最新评论

spring3使用profile

 
阅读更多

在spring3与web.xml的环境中使用spring的profile

spring-ftp-file-service.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
      http://www.springframework.org/schema/beans/spring-beans-3.2.xsd


         http://www.springframework.org/schema/mvc
		http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd" profile="gqbjbi,gqbjlsxk,gqhbbs">
    <bean id="ftpFileMsgConsumerService" class="cn.xx.FtpFileMsgConsumerService">
    </bean>
</beans>

 WEB-INF/web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns="http://java.sun.com/xml/ns/javaee"
	xmlns:jsp="http://java.sun.com/xml/ns/javaee/jsp"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
	id="WebApp_ID" version="3.0">
	<display-name>xxx</display-name>
	<context-param>
		<param-name>spring.profiles.default</param-name>
		<param-value>gqbjlsxk</param-value>
	</context-param>
	<welcome-file-list>
		<welcome-file>/index.jsp</welcome-file>
	</welcome-file-list>
	<jsp-config>
		<taglib>
			<taglib-uri>http://www.xx.cn/xx</taglib-uri>
			<taglib-location>/WEB-INF/xx.tld</taglib-location>
		</taglib>
	</jsp-config>
</web-app>

 

分享到:
评论

相关推荐

    SpringBoot中的Profile配置的使用示例源码

    在Spring Boot中,Profile配置是一项强大的特性,它允许我们在不同的环境下使用不同的配置,例如开发、测试和生产环境。本文将深入探讨Spring Boot中Profile的使用,并通过源码示例进行详细解析。 首先,理解...

    Spring 3.x 中文开发手册.pdf

    Spring 3.x 还引入了属性抽象层,这使得开发者可以在配置文件中使用占位符(placeholder),从而减少因环境变化而频繁更改配置文件的需求。例如,可以使用 `${JAVA_HOME}/com/bank/service/${env}-config.xml"/&gt;` 来...

    spring3全部jar包

    3. `spring-core`: 提供基本的工具类和资源处理。 4. `spring-expression`: 提供了强大的表达式语言,用于运行时查询和操作对象属性。 5. `spring-web`: 包含Spring MVC和Web上下文的相关组件。 6. `spring-jdbc`: ...

    spring3注解详解

    3. `@Component`:这是Spring的组件注解,用于标记一个类为Spring管理的Bean。它是`@Service`、`@Repository`和`@Controller`的基础,这三个是它的特殊形式,分别对应服务层、数据访问层和表现层。 4. `@Service`:...

    Spring Boot使用profile如何配置不同环境的配置文件

    Spring Boot 使用 Profile 配置不同环境的配置文件 在 Spring Boot 中,使用 Profile 来配置不同环境的配置文件是一种非常有用的方法。在本文中,我们将详细介绍如何使用 Profile 配置不同环境的配置文件,包括使用...

    idea spring assistant插件

    除此之外,该插件还包含了对Spring Profile的支持。开发者可以在IDE内方便地切换不同环境的配置,适应开发、测试和生产等不同阶段的需求。 Spring Assistant与IntelliJ IDEA的集成非常紧密,它可以无缝配合其他...

    使用Spring的注解方式实现AOP的细节

    在Spring中,我们可以使用注解来声明切面、切点和通知。下面将详细介绍这些关键组件: 1. **@Aspect**: 这个注解用于标记一个类作为切面,这个类通常会包含切点和通知。 ```java @Aspect public class ...

    Spring in Action 使用Maven 构建Spring 工程

    《Spring in Action》一书是Spring框架的实践指南,它深入介绍了如何使用Maven构建Spring工程。Maven是一个流行的项目管理和综合工具,它通过提供一套标准化的构建过程,简化了Java项目的构建、依赖管理和部署。在...

    idp-profile-spring-3.1.1.jar

    Profile是Spring Boot 对不同环境下提供不同配置功能的支持

    Spring3单元测试和集成测试

    在Spring3中,我们可以使用JUnit作为主要的测试框架,结合`@RunWith(SpringJUnit4ClassRunner.class)`注解来启动Spring上下文,使得测试类能够访问到Spring的bean。例如: ```java import org.junit.Test; import ...

    spring Profile如何为不同环境提供不同的配置支持

    下面我们将深入探讨 Spring Profile 的使用方法及其在传统 Spring 和 Spring Boot 中的应用。 ### 1. 传统 Spring Profile 使用 在传统 Spring 中,`@Profile` 注解与 `@Configuration` 和 `@Bean` 结合使用。`@...

    Spring入门实战之Profile详解

    `embeddedDataSource`方法使用`@Bean`注解声明了一个数据源Bean,它会在开发环境(dev Profile激活时)被Spring容器创建。 Profile的激活有多种方式: 1. **通过环境变量**:设置`spring.profiles.active`环境变量...

    Spring中文文档下载

    3.2还引入了Spring Framework Profile特性,允许开发者针对不同的运行环境定制应用的配置。 学习Spring,开发者应了解其核心模块,如IoC(Inversion of Control,控制反转)容器、AOP(Aspect-Oriented Programming...

    Java课程实验 Spring Boo 配置文件以及 Profile 多环境配置

    在Spring Boot中,可以使用配置文件来管理应用程序的配置。这些配置文件可以根据不同的环境进行分离和管理,Spring...Spring Boot还提供了更多高级的配置方式,如使用@Profile注解、条件注解等来实现更精细的配置管理。

    spring3.1.1jar及其关联jar

    org.springframework.aop-3.1.1.RELEASE org.springframework.asm-3.1.1.RELEASE org.springframework.aspects-3.1.1.RELEASE org.springframework.beans-3.1.1.RELEASE org.springframework.context.support-3.1.1....

    通过实例了解Spring中@Profile的作用

    Spring 中 @Profile 的作用...3. 代码重用:@Profile 可以使代码更加 tái用,例如可以在不同的环境中使用同一个 bean。 @Profile 是 Spring 框架中的一种非常有用的注解,可以帮助开发者更好地管理不同的环境和配置。

    spring boot实战.pdf高清无水印

    1.2.2 使用Spring Initializr初始化Spring Boot项目 10 1.3 小结 18 第2章 开发第一个应用程序 19 2.1 运用Spring Boot 19 2.1.1 查看初始化的Spring Boot新项目 21 2.1.2 Spring Boot项目构建过程解析 ...

    spring @profile注解的使用方法

    Spring @Profile注解的使用方法 Spring @Profile注解是Spring Framework中的一种注解,它用于标明当前运行环境,可以根据不同的环境注入相应的Bean。下面将详细介绍Spring @Profile注解的使用方法和它的应用场景。 ...

    25个经典的Spring面试问题包含答案

    3. **Spring中的IoC(Inversion of Control)是什么?** IoC是DI的同义词,它指的是控制权的反转,即应用程序的控制权从代码内部转移到了外部容器(如Spring框架)。 4. **Spring的AOP是什么?** AOP(Aspect-...

Global site tag (gtag.js) - Google Analytics