- 浏览: 341718 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (198)
- HIBERNATE (8)
- JAVA (13)
- 数据库 (24)
- SPRING (1)
- LINUX (0)
- 需求管理 (3)
- 职业提升 (6)
- 团队建设 (1)
- 日常用到语句 (1)
- FLEX (6)
- 用户体验 (3)
- 设计模式 (6)
- weblogic (2)
- PowerDesigner (3)
- HTML (7)
- ANT (7)
- 工具. (1)
- bat (5)
- 存储过程 (1)
- strus2 (1)
- DWR (2)
- jfreechart (4)
- 上线测试优化 (17)
- JVM (9)
- 工具使用 (2)
- 算法 (3)
- 私事 (0)
- 数据库-Oracle session (1)
- 软件开发 (5)
- 产品 (2)
- 项目管理 (4)
- oracle语句 (1)
- IntelliJ IDEA (4)
- GRAILS (10)
- Groovy (1)
- JS (1)
- DUBBO (1)
- JAVA EXCEL (3)
- netty websocket (1)
- kafka (1)
- 秘钥体系 (2)
- golang (6)
- gradle (1)
- spring cloud (0)
最新评论
-
wujt:
...
Grails_数据库逆向工程插件 db-reverse-engineer -
yy8093:
我也遇到这个问题,不过并不觉得是个好的方法。。。。不过最后也确 ...
关于dubbo服务产生异常之:Caused by: com.alibaba.dubbo.remoting.TimeoutException: Waiting s -
wujt:
# ----- Execute The Requested C ...
jconsole基础配置(原创) -
gaowei52306:
你好,请问remotedir="/home/dmwe ...
Ant FTP -
抢街饭:
ant生成日志 在命令行也能看见 怎么去做啊
ant生成日志
转载:Flex+Spring配置
flex拓扑图制作只是一个简单的例子,可以运行,只是简单的呈现部分,如果要实现具体的拓扑图的功能,需要连接数据库,这里只简单说说flex与spring的结合,有了spring,再与hibernate以及struts就简单多了。
1、首先是web.xml需要添加flex的配置,增加如下的内容:
- <listener>
- <listener-class>flex.messaging.HttpFlexSession</listener-class>
- </listener>
- <!-- MessageBroker Servlet -->
- <servlet>
- <servlet-name>MessageBrokerServlet</servlet-name>
- <display-name>MessageBrokerServlet</display-name>
- <servlet-class>flex.messaging.MessageBrokerServlet</servlet-class>
- <init-param>
- <param-name>services.configuration.file</param-name>
- <param-value>/WEB-INF/flex/services-config.xml</param-value>
- </init-param>
- <init-param>
- <param-name>flex.write.path</param-name>
- <param-value>/WEB-INF/flex</param-value>
- </init-param>
- <load-on-startup>1</load-on-startup>
- </servlet>
- <servlet>
- <servlet-name>FlexMxmlServlet</servlet-name>
- <display-name>MXML Processor</display-name>
- <description>Servlet wrapper for the Mxml Compiler</description>
- <servlet-class>flex.bootstrap.BootstrapServlet</servlet-class>
- <init-param>
- <param-name>servlet.class</param-name>
- <param-value>flex.webtier.server.j2ee.MxmlServlet</param-value>
- </init-param>
- <init-param>
- <param-name>webtier.configuration.file</param-name>
- <param-value>/WEB-INF/flex/flex-webtier-config.xml</param-value>
- </init-param>
- <load-on-startup>1</load-on-startup>
- </servlet>
- <servlet>
- <servlet-name>FlexSwfServlet</servlet-name>
- <display-name>SWF Retriever</display-name>
- <servlet-class>flex.bootstrap.BootstrapServlet</servlet-class>
- <init-param>
- <param-name>servlet.class</param-name>
- <param-value>flex.webtier.server.j2ee.SwfServlet</param-value>
- </init-param>
- <!-- SwfServlet must be initialized after MxmlServlet -->
- <load-on-startup>2</load-on-startup>
- </servlet>
- <servlet>
- <servlet-name>FlexForbiddenServlet</servlet-name>
- <display-name>Prevents access to *.as/*.swc files</display-name>
- <servlet-class>flex.bootstrap.BootstrapServlet</servlet-class>
- <init-param>
- <param-name>servlet.class</param-name>
- <param-value>flex.webtier.server.j2ee.ForbiddenServlet</param-value>
- </init-param>
- </servlet>
- <servlet>
- <servlet-name>FlexInternalServlet</servlet-name>
- <servlet-class>flex.bootstrap.BootstrapServlet</servlet-class>
- <init-param>
- <param-name>servlet.class</param-name>
- <param-value>flex.webtier.server.j2ee.filemanager.FileManagerServlet</param-value>
- </init-param>
- <load-on-startup>10</load-on-startup>
- </servlet>
- <servlet-mapping>
- <servlet-name>MessageBrokerServlet</servlet-name>
- <url-pattern>/messagebroker/*</url-pattern>
- </servlet-mapping>
- <servlet-mapping>
- <servlet-name>FlexMxmlServlet</servlet-name>
- <url-pattern>*.mxml</url-pattern>
- </servlet-mapping>
- <servlet-mapping>
- <servlet-name>FlexSwfServlet</servlet-name>
- <url-pattern>*.swf</url-pattern>
- </servlet-mapping>
- <servlet-mapping>
- <servlet-name>FlexForbiddenServlet</servlet-name>
- <url-pattern>*.as</url-pattern>
- </servlet-mapping>
- <servlet-mapping>
- <servlet-name>FlexForbiddenServlet</servlet-name>
- <url-pattern>*.swc</url-pattern>
- </servlet-mapping>
- <servlet-mapping>
- <servlet-name>FlexInternalServlet</servlet-name>
- <url-pattern>/flex-internal/*</url-pattern>
- </servlet-mapping>
<listener> <listener-class>flex.messaging.HttpFlexSession</listener-class> </listener> <!-- MessageBroker Servlet --> <servlet> <servlet-name>MessageBrokerServlet</servlet-name> <display-name>MessageBrokerServlet</display-name> <servlet-class>flex.messaging.MessageBrokerServlet</servlet-class> <init-param> <param-name>services.configuration.file</param-name> <param-value>/WEB-INF/flex/services-config.xml</param-value> </init-param> <init-param> <param-name>flex.write.path</param-name> <param-value>/WEB-INF/flex</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet> <servlet-name>FlexMxmlServlet</servlet-name> <display-name>MXML Processor</display-name> <description>Servlet wrapper for the Mxml Compiler</description> <servlet-class>flex.bootstrap.BootstrapServlet</servlet-class> <init-param> <param-name>servlet.class</param-name> <param-value>flex.webtier.server.j2ee.MxmlServlet</param-value> </init-param> <init-param> <param-name>webtier.configuration.file</param-name> <param-value>/WEB-INF/flex/flex-webtier-config.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet> <servlet-name>FlexSwfServlet</servlet-name> <display-name>SWF Retriever</display-name> <servlet-class>flex.bootstrap.BootstrapServlet</servlet-class> <init-param> <param-name>servlet.class</param-name> <param-value>flex.webtier.server.j2ee.SwfServlet</param-value> </init-param> <!-- SwfServlet must be initialized after MxmlServlet --> <load-on-startup>2</load-on-startup> </servlet> <servlet> <servlet-name>FlexForbiddenServlet</servlet-name> <display-name>Prevents access to *.as/*.swc files</display-name> <servlet-class>flex.bootstrap.BootstrapServlet</servlet-class> <init-param> <param-name>servlet.class</param-name> <param-value>flex.webtier.server.j2ee.ForbiddenServlet</param-value> </init-param> </servlet> <servlet> <servlet-name>FlexInternalServlet</servlet-name> <servlet-class>flex.bootstrap.BootstrapServlet</servlet-class> <init-param> <param-name>servlet.class</param-name> <param-value>flex.webtier.server.j2ee.filemanager.FileManagerServlet</param-value> </init-param> <load-on-startup>10</load-on-startup> </servlet> <servlet-mapping> <servlet-name>MessageBrokerServlet</servlet-name> <url-pattern>/messagebroker/*</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>FlexMxmlServlet</servlet-name> <url-pattern>*.mxml</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>FlexSwfServlet</servlet-name> <url-pattern>*.swf</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>FlexForbiddenServlet</servlet-name> <url-pattern>*.as</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>FlexForbiddenServlet</servlet-name> <url-pattern>*.swc</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>FlexInternalServlet</servlet-name> <url-pattern>/flex-internal/*</url-pattern> </servlet-mapping>
2、在spring的配置文件中增加:
- <bean id="topoMapViewService" parent="baseTransaction">
- <property name="target">
- <bean
- class="com.jeffrey.nms.service.impl.TopoServiceImpl"><!---这里的方法可以通过flex进行调用--->
- <property name="topoMapDao" ref="topoMapDao" />
- <property name="linkInfoDao" ref="linkInfoDao" />
- </bean>
- </property>
- </bean>
<bean id="topoMapViewService" parent="baseTransaction"> <property name="target"> <bean class="com.jeffrey.nms.service.impl.TopoServiceImpl"><!---这里的方法可以通过flex进行调用---> <property name="topoMapDao" ref="topoMapDao" /> <property name="linkInfoDao" ref="linkInfoDao" /> </bean> </property> </bean>
3、然后需要配置flex的配置文件,flex文件下有个services-config.xml,
增加:
- <factories>
- <factory id="spring" class="com.jeffrey.nms.web.topo.SpringFactory"/>
- </factories>
<factories> <factory id="spring" class="com.jeffrey.nms.web.topo.SpringFactory"/> </factories>
其中类如下(通过网上查的)
- package com.jeffrey.nms.web.topo;
- import org.springframework.context.ApplicationContext;
- import org.springframework.web.context.support.WebApplicationContextUtils;
- import org.springframework.beans.BeansException;
- import org.springframework.beans.factory.NoSuchBeanDefinitionException;
- import flex.messaging.FactoryInstance;
- import flex.messaging.FlexFactory;
- import flex.messaging.config.ConfigMap;
- import flex.messaging.services.ServiceException;
- public class SpringFactory implements FlexFactory
- {
- private static final String SOURCE = "source";
- public void initialize(String id, ConfigMap configMap) {}
- public FactoryInstance createFactoryInstance(String id, ConfigMap properties)
- {
- SpringFactoryInstance instance = new SpringFactoryInstance(this, id, properties);
- instance.setSource(properties.getPropertyAsString(SOURCE, instance.getId()));
- return instance;
- } // end method createFactoryInstance()
- public Object lookup(FactoryInstance inst)
- {
- SpringFactoryInstance factoryInstance = (SpringFactoryInstance) inst;
- return factoryInstance.lookup();
- }
- static class SpringFactoryInstance extends FactoryInstance
- {
- SpringFactoryInstance(SpringFactory factory, String id, ConfigMap properties)
- {
- super(factory, id, properties);
- }
- public String toString()
- {
- return "SpringFactory instance for id=" + getId() + " source=" + getSource() + " scope=" + getScope();
- }
- public Object lookup()
- {
- ApplicationContext appContext = WebApplicationContextUtils.getWebApplicationContext(flex.messaging.FlexContext.getServletConfig().getServletContext());
- String beanName = getSource();
- try
- {
- return appContext.getBean(beanName);
- }
- catch (NoSuchBeanDefinitionException nexc)
- {
- ServiceException e = new ServiceException();
- String msg = "Spring service named '" + beanName + "' does not exist.";
- e.setMessage(msg);
- e.setRootCause(nexc);
- e.setDetails(msg);
- e.setCode("Server.Processing");
- throw e;
- }
- catch (BeansException bexc)
- {
- ServiceException e = new ServiceException();
- String msg = "Unable to create Spring service named '" + beanName + "' ";
- e.setMessage(msg);
- e.setRootCause(bexc);
- e.setDetails(msg);
- e.setCode("Server.Processing");
- throw e;
- }
- }
- }
- }
package com.jeffrey.nms.web.topo; import org.springframework.context.ApplicationContext; import org.springframework.web.context.support.WebApplicationContextUtils; import org.springframework.beans.BeansException; import org.springframework.beans.factory.NoSuchBeanDefinitionException; import flex.messaging.FactoryInstance; import flex.messaging.FlexFactory; import flex.messaging.config.ConfigMap; import flex.messaging.services.ServiceException; public class SpringFactory implements FlexFactory { private static final String SOURCE = "source"; public void initialize(String id, ConfigMap configMap) {} public FactoryInstance createFactoryInstance(String id, ConfigMap properties) { SpringFactoryInstance instance = new SpringFactoryInstance(this, id, properties); instance.setSource(properties.getPropertyAsString(SOURCE, instance.getId())); return instance; } // end method createFactoryInstance() public Object lookup(FactoryInstance inst) { SpringFactoryInstance factoryInstance = (SpringFactoryInstance) inst; return factoryInstance.lookup(); } static class SpringFactoryInstance extends FactoryInstance { SpringFactoryInstance(SpringFactory factory, String id, ConfigMap properties) { super(factory, id, properties); } public String toString() { return "SpringFactory instance for id=" + getId() + " source=" + getSource() + " scope=" + getScope(); } public Object lookup() { ApplicationContext appContext = WebApplicationContextUtils.getWebApplicationContext(flex.messaging.FlexContext.getServletConfig().getServletContext()); String beanName = getSource(); try { return appContext.getBean(beanName); } catch (NoSuchBeanDefinitionException nexc) { ServiceException e = new ServiceException(); String msg = "Spring service named '" + beanName + "' does not exist."; e.setMessage(msg); e.setRootCause(nexc); e.setDetails(msg); e.setCode("Server.Processing"); throw e; } catch (BeansException bexc) { ServiceException e = new ServiceException(); String msg = "Unable to create Spring service named '" + beanName + "' "; e.setMessage(msg); e.setRootCause(bexc); e.setDetails(msg); e.setCode("Server.Processing"); throw e; } } } }
4、本人做flex时是使用的直接调用java的运程类,以下都是按照这个配置的,还有一个webservice的方法,各位可以收集收集。
在flex文件夹下有个remoting-config.xml文件,需要增加:
- <destination id="topoMap">
- <properties>
- <factory>spring</factory>
- <source>topoMapViewService</source>
- </properties>
- lt;/destination>
<destination id="topoMap"> <properties> <factory>spring</factory> <source>topoMapViewService</source> </properties> </destination>
这样topoMap可以在flex进行定义了,如下:
<mx:RemoteObject id="topo" destination="topoMap">
这样flex+spring配置即完成。
发表评论
-
flex编译不生成HTML文件的解决方法
2011-08-24 18:31 3123flex编译不生成H ... -
Flex参考资源
2011-08-19 18:10 821一、国外站点 1.资源类 ... -
FLEX学习网站
2011-08-19 08:25 870http://blog.minidx.com/ http ... -
MyEclipse6.5 + Adobe Flex Builder 3 插件版
2011-08-17 08:05 11411. 安装MyEclipse6.5(在此不再详 ... -
.FB3_WWEJ_Plugin.exe下载地址
2011-08-17 08:03 7396一级页面: http://www.adobe.com/cfu ...
相关推荐
Flex+Spring+Hibernate 整合是企业级应用开发中常见的一种技术栈组合,它结合了Flex前端的富互联网应用程序(RIA)开发能力、Spring框架的依赖注入和事务管理功能,以及Hibernate持久化框架的数据库操作便捷性。...
Flex+Spring+Hibernate示例是一种常见的企业级应用架构,它结合了Adobe Flex前端技术、Spring后端框架和Hibernate持久层框架,以构建高效、灵活且易于维护的Web应用程序。在这个示例中,开发者可能已经展示了如何...
在Spring配置文件中引入Mapper扫描器,使Spring能够自动发现并管理Mapper。 5. **创建HTTP服务**:在Spring MVC中创建Controller,定义处理HTTP请求的方法,这些方法将调用Service层的业务逻辑。 6. **Flex与...
3. **定义Spring服务**:在Spring配置文件中定义需要暴露给Flex的Bean,这些Bean通常是业务服务或DAO。例如,可以有一个名为`UserService`的Bean,提供用户管理功能。 4. **配置BlazeDS服务代理**:在Flex项目中,...
文档的描述提到了安装和配置各个组件的步骤,包括MyEclipse、Flex Builder、BlazeDS、Tomcat、SQL Server、JDBC驱动和proxool连接池等,这些都是为了搭建一个完整的开发环境。此外,文档还涵盖了项目构建的各个阶段...
- **配置Spring**:首先,需要在Spring配置文件中定义数据源、SessionFactory(Hibernate的会话工厂)以及事务管理器。Spring能够管理和控制Hibernate的生命周期,简化了数据库操作。 - **配置Hibernate**:设置...
flex+spring+struts2+ibatis 整合的eclipse工程,可以导入eclipse环境下直接使用,因为加入开发的jar大于了上传的最大限制,只能把jar另外打包上传,下载可以从我上传资源的lib1,lib2下载,这个工程的搭建花费了我两...
在 Flex 应用中,通常会通过 Spring 配置 iBATIS,创建 DAO(Data Access Object)层,实现与数据库的交互。 Cairngorm 和 pureMVC 是两种常用的 Flex 应用架构模式。Cairngorm 是一种轻量级的 MVC(Model-View-...
在提供的压缩包文件"Flex+Spring+Hibernate Environment"中,可能包含了上述所有配置文件、源代码和部署资源。开发者可以通过直接部署运行,避免了从零开始搭建环境的繁琐过程。这个项目对于学习和理解Flex、Spring...
flex+spring+blazeds在MyEclipse下非常详细的结合配置
Flex、Hibernate 和 ...通过这些示例,你可以动手尝试配置和运行一个整合Flex、Hibernate和Spring的简单应用,进一步加深理解。在实际开发中,这种整合方式能够提供高性能、易维护的Web应用,满足复杂的业务需求。
- 在Spring配置文件中注册`EmployeeMapper`的Bean。 3. **更新Service实现**: - 修改`EmployeeServiceImpl`,使其能够通过MyBatis操作数据库。 ```java package com.sample.service.impl; import org.spring...
flex+bleazeds+spring+hibernate配置的教程,有详尽过程,是flex与spring结合的不错的教程
1. 配置Spring服务器端:创建Spring配置文件,定义服务接口及其实现,使用Spring的`@Service`注解标记服务类。 2. 配置AMF通道:在服务器端集成BlazeDS或LCDS,配置AMF通道,使得Flex可以与Spring服务进行AMF通信。 ...
5. **整合过程**:接着,开发者需要在Spring配置文件中定义Bean,BlazeDS会自动暴露这些Bean为Flex客户端可调用的服务。在Flex客户端,通过使用AMF(Action Message Format)协议,可以调用这些服务并接收返回的数据...
2. **Spring配置**:了解Spring的核心配置文件,如`applicationContext.xml`,用于定义Bean的实例化和依赖关系。 3. **Flex-Spring通信**:学习如何在Flex中使用 BlazeDS 或 GraniteDS 这样的中间件来与Spring服务...
这个项目结合了前端的Flex(一种基于ActionScript和Flash的RIA开发框架)与后端的Spring(一个全面的Java应用框架)、Hibernate(一个对象关系映射框架)以及MySQL(一个流行的开源关系型数据库),实现了一个完整的...
3. 配置remoting-config.xml文件,这是Flex与服务器通信的关键配置,通常会涉及到Spring中的bean定义。 4. 添加Spring框架,包括过滤器、事务管理配置,以及数据库连接池配置。 5. 创建数据源相关文件,比如在src...
2. **Spring配置**:在Spring中,需要配置服务代理(Service Proxy)以便Flex客户端可以调用。这些代理通常基于HTTPInvoker或RemotingDestination,使得Flex能够调用Spring Bean。 3. **数据访问对象(DAO)**:...