Esse artigo é continuação do TUTORIAL JAVA + FLEX NA PRÁTICA 1/6.
Continuando o nosso tutorial vamos codificar os nossos arquivos de configuração necessário que ficam dentro do WEB-INF.
Vamos ao que interessa
WEB-INF/FLEX
remoting-config.xml
XML:
-
<!--?xml version="1.0" encoding="UTF-8"?-->
-
class="flex.messaging.services.RemotingService">
-
-
-
-
spring
-
<source />EstadoService
-
-
services-config.xml
XML:
-
<!--?xml version="1.0" encoding="UTF-8"?-->
-
<!-- Spring factory registration -->
-
-
class="com.saberprogramar.infrastructure.SpringFactory"/>
-
class="flex.messaging.security.TomcatLoginCommand" server="Tomcat" />
-
<!-- Uncomment the correct app server
-
<login-command class="flex.messaging.security.TomcatLoginCommand" server="JBoss">
-
<login-command class="flex.messaging.security.JRunLoginCommand" server="JRun"/>
-
<login-command class="flex.messaging.security.WeblogicLoginCommand" server="Weblogic"/>
-
<login-command class="flex.messaging.security.WebSphereLoginCommand" server="WebSphere"/>
-
-->
-
-
-
-
-
-
class="mx.messaging.channels.AMFChannel">
-
url="http://{server.name}:{server.port}/{context.root}/messagebroker/amf"
-
class="flex.messaging.endpoints.AMFEndpoint" />
-
-
class="mx.messaging.channels.SecureAMFChannel">
-
url="https://{server.name}:{server.port}/{context.root}/messagebroker/amfsecure"
-
class="flex.messaging.endpoints.SecureAMFEndpoint" />
-
-
false
-
-
class="mx.messaging.channels.AMFChannel">
-
url="http://{server.name}:{server.port}/{context.root}/messagebroker/amfpolling"
-
class="flex.messaging.endpoints.AMFEndpoint" />
-
-
true4
-
-
-
level="Error">
-
-
[BlazeDS] false
-
false
-
true
-
false Endpoint.* Service.* DataService.* Configuration
-
-
-
false
-
20
-
-
{context.root}/WEB-INF/flex/services-config.xml
-
-
-
{context.root}/WEB-INF/flex/remoting-config.xml
-
-
{context.root}/WEB-INF/web.xml
-
WEB-INF
applicationContext.xml
XML:
-
<!--?xml version="1.0" encoding="UTF-8"?-->
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-
xmlns:context="http://www.springframework.org/schema/context"
-
xmlns:jee="http://www.springframework.org/schema/jee"
-
xmlns:tx="http://www.springframework.org/schema/tx"
-
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
-
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
-
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd
-
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
-
-
-
-
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
-
<p style="text-align: left;">${jdbc.driverClassName}${jdbc.url}${jdbc.username}${jdbc.password}</p>
-
-
-
-
-
class="com.saberprogramar.infrastructure.AnnotationOptimizedSessionFactoryBean"
-
dependency-check="none">
-
-
-
-
org.hibernate.dialect.MySQL5InnoDBDialecttrueupdate
-
-
-
-
com.saberprogramar.business.entitys
-
-
-
-
<!-- Transaction Manager -->
-
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
-
base-package="com.saberprogramar.business.services">
-
-
base-package="com.saberprogramar.data.daos">
-
-
jdbcMysql.properties
CODE:
-
# Properties file com as configuracoes do JDBC.
-
# Aplicado pelo PropertyPlaceholderConfigurer do Spring
-
jdbc.driverClassName=com.mysql.jdbc.Driver
-
jdbc.url=jdbc:mysql://localhost:3306/crud
-
#PRESTA ATENÇÃO
-
jdbc.username=root #seu usuário aqui
-
jdbc.password=123 #sua senha aqui
-
#Properties que determina o dialeto do Banco de Dados.
-
hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
E emfim nosso web.xml
XML:
-
<!--?xml version="1.0" encoding="UTF-8"?-->
-
-
CrudJava
-
-
-
-
-
-
contextConfigLocation/WEB-INF/applicationContext.xml org.springframework.web.context.ContextLoaderListenerorg.springframework.web.context.request.RequestContextListener
-
-
-
-
flex.messaging.HttpFlexSession
-
-
-
-
flex.class.path/WEB-INF/flex/hotfixes
-
MessageBrokerServlet
-
<!-- <display-name>MessageBrokerServlet</display-name> -->
-
-
flex.messaging.MessageBrokerServlet
-
-
-
-
services.configuration.file/WEB-INF/flex/services-config.xml
-
-
-
-
flex.write.path/WEB-INF/flex
-
-
1
-
-
-
MessageBrokerServlet
-
/messagebroker/*
-
index.html
-
index.htm
-
index.jsp
Banco de Dados
Para criar nossa banco de dados o código está logo abaixo, normalmente será usado sua GUI para Mysql preferida, no meu caso uso o Sqlyog,
CODE:
-
CREATE DATABASE `crud`
Com esse código nosso backend está pronto, para testar é só iniciar o servidor de aplicação ou o Tomcat e verificar se deu algum erro.
na próxima parte deste tutorial vamos fazer a camada View, toda em flex e como bom padrão vamos usar um MVC show!!!
Vlw e até a próx.




Pingback: TUTORIAL JAVA + FLEX NA PRÁTICA 3/6 | SaberProgramar.com
Pingback: TUTORIAL JAVA + FLEX NA PRÁTICA 4/6 | SaberProgramar.com
Pingback: TUTORIAL JAVA + FLEX NA PRÁTICA 7/6 - Bônus | SaberProgramar.com
Pingback: Junit – Testando Métodos Privados com Reflection - redeRIA | Agregador de noticias, artigos, tutoriais Flex, Flash, JavaFX, AJAX e Rich internet applications em geral!
Pingback: best designed websites