Add CORS management with Tomcat and Angular-Js

In one of my projects, I decided to setup a SOA architecture using Angular-Js as the UI layer. My main focus is to have a clear separation between the business and the presentation. Another benefit of this is that it is possible the use different servers to these 2 parts. But doing this causes an… Continue reading Add CORS management with Tomcat and Angular-Js

Define configuration file outside of the classpath

Here I describe the way I use to configure my applications. The main idea is to define a property file outside of the application, doing this, it is possible to deploy the same application in several environments (dev/test/prod) without any changes. First of all, the property file: net.classnotfound.app.jdbc.server=db-server net.classnotfound.app.jdbc.port=1521 net.classnotfound.app.jdbc.sid=xe net.classnotfound.app.jdbc.user=scott net.classnotfound.app.jdbc.password=koala The tips is… Continue reading Define configuration file outside of the classpath

Starting of Spring context in web application

Using Spring in a web application, we need to load the context when the application starts. Fortunately, it can be done in a simple way, by adding the right listener in the application web.xml. Using Maven, you need to add the Spring-web dependency in your pom.xml: <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> <version>4.0.0.RELEASE</version> <scope>compile</scope> </dependency> And in the… Continue reading Starting of Spring context in web application

Tomcat Datasource configuration

I describe here my favorite solution to define the datasource of my web applications. To do that in Tomcat : Copy the JDBC driver jar into the Tomcat lib directory define the datasource in the file server.xml: <GlobalNamingResources> <Resource auth=”Container” driverClassName=”oracle.jdbc.OracleDriver” maxActive=”20″ maxIdle=”10″ maxWait=”-1″ name=”jdbc/myGlobalDatasource” password=”password” type=”javax.sql.DataSource” url=”jdbc:oracle:thin:@[server]:[port]:[sid]” username=”user”/> </GlobalNamingResources> map this datasource to your… Continue reading Tomcat Datasource configuration