Java tutorial
/************************************************************************** * Copyright 2015 ECS Team, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. **************************************************************************/ package com.ecsteam.springutils.pattern; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.context.embedded.FilterRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.security.config.annotation.web.builders.WebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import com.ecsteam.springutils.pattern.filter.CORSFilter; /** * The main entry point. Added a configure method to disable security, since having spring-boot-starter-security on the * classpath enables it by default * * @author Josh Ghiloni * */ @SpringBootApplication public class PatternTesterApplication extends WebSecurityConfigurerAdapter { public static void main(String[] args) { SpringApplication.run(PatternTesterApplication.class, args); } @Override public void configure(WebSecurity web) throws Exception { web.ignoring().anyRequest(); } @Bean public FilterRegistrationBean corsFilter() { FilterRegistrationBean bean = new FilterRegistrationBean(); bean.setFilter(new CORSFilter()); bean.setOrder(0); return bean; } }