Skip to content

Instantly share code, notes, and snippets.

View Guvenir's full-sized avatar
😊
Focusing

Ömer Güvenir Guvenir

😊
Focusing
View GitHub Profile
@Guvenir
Guvenir / pom.xml
Created July 10, 2016 11:03
spring boot actuator
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
var module = angular.module("sampleApp", ['ngRoute']);
module.config(['$routeProvider', '$locationProvider',
function($routeProvider, $locationProvider) {
$routeProvider.
when('/route1', {
templateUrl: 'pages/about.html',
controller: 'RouteController'
}).
when('/route2', {
<!DOCTYPE html>
<html lang="en">
<head>
<title>AngularJS Routes example</title>
<base href="/" />
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular-route.min.js"></script>
<script src="testCtrl.js"></script>
</head>
@Guvenir
Guvenir / pom.xml
Created June 11, 2016 08:55
Spring Boot Tomcat provided
<dependencies>
<!-- … -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<!-- … -->
</dependencies>
@Guvenir
Guvenir / springbootservlet.java
Created June 11, 2016 08:45
Spring Boot Servlet Initializer
@SpringBootApplication
public class Application extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(Application.class);
}
public static void main(String[] args) throws Exception {
SpringApplication.run(Application.class, args);
@Configuration
public class RestConfiguration {
@Bean
public CorsFilter corsFilter() {
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
CorsConfiguration config = new CorsConfiguration();
config.setAllowCredentials(true); // you USUALLY want this
config.addAllowedOrigin("*");
@Guvenir
Guvenir / SesFactory.java
Created November 24, 2015 20:39
Hibernate SessionFactory
import org.hibernate.SessionFactory;
import org.hibernate.boot.MetadataSources;
import org.hibernate.boot.registry.StandardServiceRegistry;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
public class SesFactory {
public static SessionFactory getSessionFactory(){
final StandardServiceRegistry registry = new StandardServiceRegistryBuilder()
@Guvenir
Guvenir / pom.xml
Created November 24, 2015 20:36
hibernate config
<dependencies>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>5.3</version>
</dependency>
<!-- Hibernate -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
@Guvenir
Guvenir / form.xhtml
Created October 9, 2015 18:40
Jsf form sorunu
<p:dialog id="Test" header="Test" widgetVar="dlg" modal="true" showEffect="fade" hideEffect="fade" resizable="false">
<p:outputPanel>
<h:form>
<p:panelGrid columns="2" columnClasses="label,value">
<h:outputLabel value="Tarih" />
<p:calendar locale="tr" pattern="MM/dd/yyyy HH:mm" value="#{testBean.test.tarih}"/>
<h:outputLabel value="İlaç" />
<p:inputText value="#{testBean.test.ilac}"/>
<h:outputLabel value="Durum"/>
<p:selectOneMenu id="cons" value="#{testBean.durum}" style="width:96%">
<Context>
<Resource name="BeanManager"
auth="Container"
type="javax.enterprise.inject.spi.BeanManager"
factory="org.jboss.weld.resources.ManagerObjectFactory" />
</Context>