Polish sample package names

This commit is contained in:
Phillip Webb 2015-06-23 00:47:12 -07:00
parent 9c0335fc29
commit 1ce617f1ae
163 changed files with 401 additions and 760 deletions

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.actuator;
package sample.actuator.noweb;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.actuator;
package sample.actuator.noweb;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.actuator;
package sample.actuator.noweb;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.actuator;
package sample.actuator.noweb;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -24,6 +24,7 @@ import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import sample.actuator.noweb.SampleActuatorNoWebApplication;
import static org.junit.Assert.assertNotNull;
/**

View File

@ -45,10 +45,6 @@ public class SampleActuatorUiApplication {
throw new RuntimeException("Expected exception in controller");
}
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleActuatorUiApplication.class, args);
}
@Bean
public SecurityProperties securityProperties() {
SecurityProperties security = new SecurityProperties();
@ -56,4 +52,8 @@ public class SampleActuatorUiApplication {
return security;
}
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleActuatorUiApplication.class, args);
}
}

View File

@ -24,13 +24,13 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SampleActuatorApplication implements HealthIndicator {
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleActuatorApplication.class, args);
}
@Override
public Health health() {
return Health.up().withDetail("hello", "world").build();
}
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleActuatorApplication.class, args);
}
}

View File

@ -72,6 +72,7 @@ public class SampleController {
public void setValue(String value) {
this.value = value;
}
}
}

View File

@ -64,4 +64,5 @@ public class SampleAmqpSimpleApplication {
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleAmqpSimpleApplication.class, args);
}
}

View File

@ -39,4 +39,5 @@ public class SampleAopApplication implements CommandLineRunner {
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleAopApplication.class, args);
}
}

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample;
package sample.atmosphere;
import java.io.IOException;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample;
package sample.atmosphere;
import java.util.Date;
@ -49,4 +49,5 @@ public class Message {
public void setTime(long time) {
this.time = time;
}
}

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample;
package sample.atmosphere;
import java.util.Collections;
@ -80,4 +80,5 @@ public class SampleAtmosphereApplication {
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleAtmosphereApplication.class, args);
}
}

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample;
package sample.atmosphere;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@ -41,6 +41,7 @@ import org.springframework.web.socket.client.WebSocketConnectionManager;
import org.springframework.web.socket.client.standard.StandardWebSocketClient;
import org.springframework.web.socket.handler.TextWebSocketHandler;
import sample.atmosphere.SampleAtmosphereApplication;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat;

View File

@ -67,4 +67,5 @@ public class SampleBatchApplication {
System.exit(SpringApplication.exit(SpringApplication.run(
SampleBatchApplication.class, args)));
}
}

View File

@ -14,8 +14,10 @@
* limitations under the License.
*/
package sample;
package sample.cache;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.cache.CacheManager;
@ -24,6 +26,9 @@ import org.springframework.stereotype.Component;
@Component
public class CacheManagerCheck implements CommandLineRunner {
private static final Logger logger = LoggerFactory
.getLogger(SampleCacheApplication.class);
private final CacheManager cacheManager;
@Autowired
@ -33,7 +38,7 @@ public class CacheManagerCheck implements CommandLineRunner {
@Override
public void run(String... strings) throws Exception {
SampleCacheApplication.logger.info("\n\n"
logger.info("\n\n"
+ "=========================================================\n"
+ "Using cache manager: " + this.cacheManager.getClass().getName() + "\n"
+ "=========================================================\n\n");

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample;
package sample.cache;
import java.io.Serializable;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample;
package sample.cache;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;

View File

@ -14,10 +14,8 @@
* limitations under the License.
*/
package sample;
package sample.cache;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cache.annotation.EnableCaching;
@ -28,8 +26,6 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication
public class SampleCacheApplication {
static final Logger logger = LoggerFactory.getLogger(SampleCacheApplication.class);
public static void main(String[] args) {
new SpringApplicationBuilder().sources(SampleCacheApplication.class)
.profiles("app").run(args);

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample;
package sample.cache;
import java.util.Arrays;
import java.util.List;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample;
package sample.cache;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -24,6 +24,9 @@ import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import sample.cache.Country;
import sample.cache.CountryRepository;
import sample.cache.SampleCacheApplication;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;

View File

@ -64,4 +64,5 @@ public class SampleElasticsearchApplication implements CommandLineRunner {
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleElasticsearchApplication.class, "--debug").close();
}
}

View File

@ -164,6 +164,7 @@ public class GemstoneServiceImpl implements GemstoneService {
public IllegalGemstoneException(final String message, final Throwable cause) {
super(message, cause);
}
}
}

View File

@ -29,7 +29,6 @@ public class SampleMongoApplication implements CommandLineRunner {
@Override
public void run(String... args) throws Exception {
this.repository.deleteAll();
// save a couple of customers
@ -54,10 +53,10 @@ public class SampleMongoApplication implements CommandLineRunner {
for (Customer customer : this.repository.findByLastName("Smith")) {
System.out.println(customer);
}
}
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleMongoApplication.class, args);
}
}

View File

@ -23,7 +23,6 @@ import org.junit.Test;
import org.springframework.boot.test.OutputCapture;
import org.springframework.core.NestedCheckedException;
import com.mongodb.MongoServerSelectionException;
import com.mongodb.MongoTimeoutException;
import static org.junit.Assert.assertTrue;
@ -61,8 +60,7 @@ public class SampleMongoApplicationTests {
NestedCheckedException nested = new NestedCheckedException("failed", ex) {
};
Throwable root = nested.getRootCause();
if (root instanceof MongoServerSelectionException
|| root instanceof MongoTimeoutException) {
if (root instanceof MongoTimeoutException) {
if (root.getMessage().contains("Unable to connect to any server")) {
return true;
}

View File

@ -43,4 +43,5 @@ public class SampleRedisApplication implements CommandLineRunner {
// Close the context so it doesn't stay awake listening for redis
SpringApplication.run(SampleRedisApplication.class, args).close();
}
}

View File

@ -1,29 +0,0 @@
/*
* Copyright 2012-2014 the original author or authors.
*
* 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 sample.data.jpa;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SampleDataRestApplication {
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleDataRestApplication.class, args);
}
}

View File

@ -1,76 +0,0 @@
/*
* Copyright 2012-2014 the original author or authors.
*
* 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 sample.data.jpa.domain;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
@Entity
public class City implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
private Long id;
@Column(nullable = false)
private String name;
@Column(nullable = false)
private String state;
@Column(nullable = false)
private String country;
@Column(nullable = false)
private String map;
protected City() {
}
public City(String name, String country) {
super();
this.name = name;
this.country = country;
}
public String getName() {
return this.name;
}
public String getState() {
return this.state;
}
public String getCountry() {
return this.country;
}
public String getMap() {
return this.map;
}
@Override
public String toString() {
return getName() + "," + getState() + "," + getCountry();
}
}

View File

@ -1,75 +0,0 @@
/*
* Copyright 2012-2014 the original author or authors.
*
* 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 sample.data.jpa.domain;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import org.hibernate.annotations.NaturalId;
@Entity
public class Hotel implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
private Long id;
@ManyToOne(optional = false)
@NaturalId
private City city;
@Column(nullable = false)
@NaturalId
private String name;
@Column(nullable = false)
private String address;
@Column(nullable = false)
private String zip;
protected Hotel() {
}
public Hotel(City city, String name) {
this.city = city;
this.name = name;
}
public City getCity() {
return this.city;
}
public String getName() {
return this.name;
}
public String getAddress() {
return this.address;
}
public String getZip() {
return this.zip;
}
}

View File

@ -1,37 +0,0 @@
/*
* Copyright 2012-2014 the original author or authors.
*
* 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 sample.data.jpa.service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import sample.data.jpa.domain.City;
@RepositoryRestResource(collectionResourceRel = "citys", path = "cities")
interface CityRepository extends PagingAndSortingRepository<City, Long> {
Page<City> findByNameContainingAndCountryContainingAllIgnoringCase(
@Param("name") String name, @Param("country") String country,
Pageable pageable);
City findByNameAndCountryAllIgnoringCase(@Param("name") String name,
@Param("country") String country);
}

View File

@ -1,44 +0,0 @@
/*
* Copyright 2012-2014 the original author or authors.
*
* 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 sample.data.jpa.service;
import java.io.Serializable;
import org.springframework.util.Assert;
public class CitySearchCriteria implements Serializable {
private static final long serialVersionUID = 1L;
private String name;
public CitySearchCriteria() {
}
public CitySearchCriteria(String name) {
Assert.notNull(name, "Name must not be null");
this.name = name;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
}

View File

@ -1,30 +0,0 @@
/*
* Copyright 2012-2014 the original author or authors.
*
* 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 sample.data.jpa.service;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import sample.data.jpa.domain.City;
import sample.data.jpa.domain.Hotel;
@RepositoryRestResource(collectionResourceRel = "hotels", path = "hotels")
interface HotelRepository extends PagingAndSortingRepository<Hotel, Long> {
Hotel findByCityAndName(City city, String name);
}

View File

@ -1,87 +0,0 @@
/*
* Copyright 2012-2015 the original author or authors.
*
* 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 sample.data.jpa;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasSize;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
/**
* Integration test to run the application.
*
* @author Oliver Gierke
* @author Andy Wilkinson
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = SampleDataRestApplication.class)
@WebAppConfiguration
@ActiveProfiles("scratch")
// Separate profile for web tests to avoid clashing databases
public class SampleDataRestApplicationTests {
@Autowired
private WebApplicationContext context;
private MockMvc mvc;
@Before
public void setUp() {
this.mvc = MockMvcBuilders.webAppContextSetup(this.context).build();
}
@Test
public void testHome() throws Exception {
this.mvc.perform(get("/api")).andExpect(status().isOk())
.andExpect(content().string(containsString("hotels")));
}
@Test
public void findByNameAndCountry() throws Exception {
this.mvc.perform(
get("/api/cities/search/findByNameAndCountryAllIgnoringCase?name=Melbourne&country=Australia"))
.andExpect(status().isOk())
.andExpect(jsonPath("state", equalTo("Victoria")))
.andExpect(jsonPath("name", equalTo("Melbourne")));
}
@Test
public void findByContaining() throws Exception {
this.mvc.perform(
get("/api/cities/search/findByNameContainingAndCountryContainingAllIgnoringCase?name=&country=UK"))
.andExpect(status().isOk())
.andExpect(jsonPath("_embedded.citys", hasSize(3)));
}
}

View File

@ -1,71 +0,0 @@
/*
* Copyright 2012-2014 the original author or authors.
*
* 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 sample.data.jpa.service;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import sample.data.jpa.SampleDataRestApplication;
import sample.data.jpa.domain.City;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.Assert.assertThat;
/**
* Integration tests for {@link CityRepository}.
*
* @author Oliver Gierke
* @author Andy Wilkinson
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = SampleDataRestApplication.class)
public class CityRepositoryIntegrationTests {
@Autowired
CityRepository repository;
@Test
public void findsFirstPageOfCities() {
Page<City> cities = this.repository.findAll(new PageRequest(0, 10));
assertThat(cities.getTotalElements(), is(greaterThan(20L)));
}
@Test
public void findByNameAndCountry() {
City city = this.repository.findByNameAndCountryAllIgnoringCase("Melbourne",
"Australia");
assertThat(city, notNullValue());
assertThat(city.getName(), is(equalTo("Melbourne")));
}
@Test
public void findContaining() {
Page<City> cities = this.repository
.findByNameContainingAndCountryContainingAllIgnoringCase("", "UK",
new PageRequest(0, 10));
assertThat(cities.getTotalElements(), is(equalTo(3L)));
}
}

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package demo;
package sample.devtools;
public class Message {

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package demo;
package sample.devtools;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package demo;
package sample.devtools;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

View File

@ -0,0 +1,52 @@
/*
* Copyright 2012-2015 the original author or authors.
*
* 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 sample.flyway;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
@Entity
public class Person {
@Id
@GeneratedValue
private Long id;
private String firstName;
private String lastName;
public String getFirstName() {
return this.firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return this.lastName;
}
public void setLastName(String lastname) {
this.lastName = lastname;
}
@Override
public String toString() {
return "Person [firstName=" + this.firstName + ", lastName=" + this.lastName
+ "]";
}
}

View File

@ -0,0 +1,25 @@
/*
* Copyright 2012-2015 the original author or authors.
*
* 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 sample.flyway;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface PersonRepository extends CrudRepository<Person, Long> {
}

View File

@ -16,16 +16,10 @@
package sample.flyway;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
@SpringBootApplication
public class SampleFlywayApplication implements CommandLineRunner {
@ -41,40 +35,5 @@ public class SampleFlywayApplication implements CommandLineRunner {
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleFlywayApplication.class, args);
}
}
@Repository
interface PersonRepository extends CrudRepository<Person, Long> {
}
@Entity
class Person {
@Id
@GeneratedValue
private Long id;
private String firstName;
private String lastName;
public String getFirstName() {
return this.firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return this.lastName;
}
public void setLastName(String lastname) {
this.lastName = lastname;
}
@Override
public String toString() {
return "Person [firstName=" + this.firstName + ", lastName=" + this.lastName
+ "]";
}
}

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample;
package sample.hateoas;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.domain;
package sample.hateoas.domain;
public class Customer {

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.domain;
package sample.hateoas.domain;
import java.util.List;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.domain;
package sample.hateoas.domain;
import java.util.ArrayList;
import java.util.List;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.web;
package sample.hateoas.web;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.hateoas.EntityLinks;
@ -29,8 +29,8 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import sample.domain.Customer;
import sample.domain.CustomerRepository;
import sample.hateoas.domain.Customer;
import sample.hateoas.domain.CustomerRepository;
@Controller
@RequestMapping("/customers")

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample;
package sample.hateoas;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -28,6 +28,7 @@ import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import sample.hateoas.SampleHateoasApplication;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.startsWith;

View File

@ -61,4 +61,5 @@ public class SampleHornetQApplication {
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleHornetQApplication.class, args);
}
}

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.jetty;
package sample.jetty.ssl;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.jetty.service;
package sample.jetty.ssl.service;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

View File

@ -14,14 +14,14 @@
* limitations under the License.
*/
package sample.jetty.web;
package sample.jetty.ssl.web;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import sample.jetty.service.HelloWorldService;
import sample.jetty.ssl.service.HelloWorldService;
@Controller
public class SampleController {

View File

@ -14,13 +14,13 @@
* limitations under the License.
*/
package sample.jetty;
package sample.jetty.ssl;
import org.apache.http.client.HttpClient;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.conn.ssl.SSLContextBuilder;
import org.apache.http.conn.ssl.TrustSelfSignedStrategy;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.ssl.SSLContextBuilder;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Value;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.jetty;
package sample.jetty8.ssl;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.jetty.service;
package sample.jetty8.ssl.service;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

View File

@ -14,14 +14,14 @@
* limitations under the License.
*/
package sample.jetty.web;
package sample.jetty8.ssl.web;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import sample.jetty.service.HelloWorldService;
import sample.jetty8.ssl.service.HelloWorldService;
@Controller
public class SampleController {

View File

@ -14,13 +14,13 @@
* limitations under the License.
*/
package sample.jetty;
package sample.jetty8.ssl;
import org.apache.http.client.HttpClient;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.conn.ssl.SSLContextBuilder;
import org.apache.http.conn.ssl.TrustSelfSignedStrategy;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.ssl.SSLContextBuilder;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Value;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.jetty;
package sample.jetty8;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.jetty.service;
package sample.jetty8.service;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

View File

@ -14,14 +14,14 @@
* limitations under the License.
*/
package sample.jetty.web;
package sample.jetty8.web;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import sample.jetty.service.HelloWorldService;
import sample.jetty8.service.HelloWorldService;
@Controller
public class SampleController {

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.jetty;
package sample.jetty8;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -28,6 +28,7 @@ import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import sample.jetty8.SampleJetty8Application;
import static org.junit.Assert.assertEquals;
/**

View File

@ -28,10 +28,6 @@ import org.springframework.context.annotation.Bean;
@SpringBootApplication
public class SampleOpenTsdbExportApplication {
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleOpenTsdbExportApplication.class, args);
}
@Bean
@ConfigurationProperties("metrics.export")
public MetricWriter openTsdbMetricWriter() {
@ -46,4 +42,8 @@ public class SampleOpenTsdbExportApplication {
return new DefaultOpenTsdbNamingStrategy();
}
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleOpenTsdbExportApplication.class, args);
}
}

View File

@ -34,10 +34,6 @@ public class SampleRedisExportApplication {
@Autowired
private MetricExportProperties export;
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleRedisExportApplication.class, args);
}
@Bean
@ExportMetricWriter
public RedisMetricRepository redisMetricWriter(
@ -53,4 +49,8 @@ public class SampleRedisExportApplication {
return new JmxMetricWriter(exporter);
}
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleRedisExportApplication.class, args);
}
}

View File

@ -26,15 +26,15 @@ import org.springframework.context.annotation.ImportResource;
@EnableConfigurationProperties(ServiceProperties.class)
public class SampleParentContextApplication {
public static void main(String[] args) throws Exception {
new SpringApplicationBuilder(Parent.class).child(
SampleParentContextApplication.class).run(args);
}
@EnableAutoConfiguration
@ImportResource("integration-context.xml")
protected static class Parent {
}
public static void main(String[] args) throws Exception {
new SpringApplicationBuilder(Parent.class).child(
SampleParentContextApplication.class).run(args);
}
}

View File

@ -41,4 +41,5 @@ public class SampleProfileApplication implements CommandLineRunner {
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleProfileApplication.class, args);
}
}

View File

@ -48,13 +48,13 @@ public class SampleServletApplication extends SpringBootServletInitializer {
};
}
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleServletApplication.class, args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(SampleServletApplication.class);
}
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleServletApplication.class, args);
}
}

View File

@ -0,0 +1,39 @@
/*
* Copyright 2012-2015 the original author or authors.
*
* 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 sample.session.redis;
import java.util.UUID;
import javax.servlet.http.HttpSession;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloRestController {
@RequestMapping("/")
String uid(HttpSession session) {
UUID uid = (UUID) session.getAttribute("uid");
if (uid == null) {
uid = UUID.randomUUID();
}
session.setAttribute("uid", uid);
return uid.toString();
}
}

View File

@ -16,14 +16,8 @@
package sample.session.redis;
import java.util.UUID;
import javax.servlet.http.HttpSession;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@SpringBootApplication
public class SampleSessionRedisApplication {
@ -32,17 +26,4 @@ public class SampleSessionRedisApplication {
SpringApplication.run(SampleSessionRedisApplication.class);
}
@RestController
static class HelloRestController {
@RequestMapping("/")
String uid(HttpSession session) {
UUID uid = (UUID) session.getAttribute("uid");
if (uid == null) {
uid = UUID.randomUUID();
}
session.setAttribute("uid", uid);
return uid.toString();
}
}
}

View File

@ -41,4 +41,5 @@ public class SampleSimpleApplication implements CommandLineRunner {
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleSimpleApplication.class, args);
}
}

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.jsp;
package sample.tomcat.jsp;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.velocity;
package sample.tomcat.jsp;
import java.util.Date;
import java.util.Map;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.jsp;
package sample.tomcat.jsp;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -28,6 +28,7 @@ import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import sample.tomcat.jsp.SampleTomcatJspApplication;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.tomcat.web;
package sample.tomcat.multiconnector.web;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.tomcat;
package sample.tomcat.multiconnector;
import java.io.IOException;
import java.net.HttpURLConnection;
@ -42,6 +42,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.web.client.RestTemplate;
import sample.tomcat.multiconnector.SampleTomcatTwoConnectorsApplication;
import static org.junit.Assert.assertEquals;
/**

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.tomcat;
package sample.tomcat.ssl;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.tomcat.web;
package sample.tomcat.ssl.web;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

View File

@ -18,9 +18,9 @@ package sample.tomcat;
import org.apache.http.client.HttpClient;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.conn.ssl.SSLContextBuilder;
import org.apache.http.conn.ssl.TrustSelfSignedStrategy;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.ssl.SSLContextBuilder;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Value;
@ -34,6 +34,8 @@ import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import sample.tomcat.ssl.SampleTomcatSslApplication;
import static org.junit.Assert.assertEquals;
@RunWith(SpringJUnit4ClassRunner.class)

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.jsp;
package sample.tomcat7.jsp;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.jsp;
package sample.tomcat7.jsp;
import java.util.Date;
import java.util.Map;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.jsp;
package sample.tomcat7.jsp;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -28,6 +28,7 @@ import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import sample.tomcat7.jsp.SampleTomcat7JspApplication;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.undertow;
package sample.undertow.ssl;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.undertow.service;
package sample.undertow.ssl.service;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

View File

@ -14,14 +14,14 @@
* limitations under the License.
*/
package sample.undertow.web;
package sample.undertow.ssl.web;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import sample.undertow.service.HelloWorldService;
import sample.undertow.ssl.service.HelloWorldService;
@Controller
public class SampleController {

View File

@ -14,13 +14,13 @@
* limitations under the License.
*/
package sample.undertow;
package sample.undertow.ssl;
import org.apache.http.client.HttpClient;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.conn.ssl.SSLContextBuilder;
import org.apache.http.conn.ssl.TrustSelfSignedStrategy;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.ssl.SSLContextBuilder;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Value;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.ui;
package sample.groovytemplates;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.ui;
package sample.groovytemplates;
import java.util.Date;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.ui;
package sample.groovytemplates;
public interface MessageRepository {

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.ui;
package sample.groovytemplates;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package sample.ui.mvc;
package sample.groovytemplates.mvc;
import java.util.HashMap;
import java.util.Map;
@ -32,8 +32,8 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import sample.ui.Message;
import sample.ui.MessageRepository;
import sample.groovytemplates.Message;
import sample.groovytemplates.MessageRepository;
@Controller
@RequestMapping("/")

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.ui;
package sample.groovytemplates;
import java.util.regex.Pattern;
@ -32,6 +32,7 @@ import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
import sample.groovytemplates.SampleGroovyTemplateApplication;
import static org.hamcrest.Matchers.containsString;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.ui;
package sample.groovytemplates;
import java.net.URI;
@ -32,6 +32,7 @@ import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import sample.groovytemplates.SampleGroovyTemplateApplication;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.ui.method;
package sample.security.method;
import java.util.Date;
import java.util.Map;
@ -58,10 +58,6 @@ public class SampleMethodSecurityApplication extends WebMvcConfigurerAdapter {
}
public static void main(String[] args) throws Exception {
new SpringApplicationBuilder(SampleMethodSecurityApplication.class).run(args);
}
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/login").setViewName("login");
@ -73,6 +69,10 @@ public class SampleMethodSecurityApplication extends WebMvcConfigurerAdapter {
return new ApplicationSecurity();
}
public static void main(String[] args) throws Exception {
new SpringApplicationBuilder(SampleMethodSecurityApplication.class).run(args);
}
@Order(Ordered.HIGHEST_PRECEDENCE)
@Configuration
protected static class AuthenticationSecurity extends
@ -80,12 +80,11 @@ public class SampleMethodSecurityApplication extends WebMvcConfigurerAdapter {
@Override
public void init(AuthenticationManagerBuilder auth) throws Exception {
// @formatter:off
auth.inMemoryAuthentication().withUser("admin").password("admin")
.roles("ADMIN", "USER").and().withUser("user").password("user")
.roles("USER");
// @formatter:on
}
}
@Order(SecurityProperties.ACCESS_OVERRIDE_ORDER)
@ -93,13 +92,11 @@ public class SampleMethodSecurityApplication extends WebMvcConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
// @formatter:off
http.authorizeRequests().antMatchers("/login").permitAll().anyRequest()
.fullyAuthenticated().and().formLogin().loginPage("/login")
.failureUrl("/login?error").and().logout()
.logoutRequestMatcher(new AntPathRequestMatcher("/logout")).and()
.exceptionHandling().accessDeniedPage("/access?error");
// @formatter:on
}
}

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.ui.method;
package sample.security.method;
import java.util.Arrays;
import java.util.regex.Matcher;
@ -38,6 +38,7 @@ import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import sample.security.method.SampleMethodSecurityApplication;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.ui.secure;
package sample.web.secure.custom;
import java.util.Date;
import java.util.Map;
@ -52,10 +52,6 @@ public class SampleWebSecureCustomApplication extends WebMvcConfigurerAdapter {
throw new RuntimeException("Expected exception in controller");
}
public static void main(String[] args) throws Exception {
new SpringApplicationBuilder(SampleWebSecureCustomApplication.class).run(args);
}
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/login").setViewName("login");
@ -66,6 +62,10 @@ public class SampleWebSecureCustomApplication extends WebMvcConfigurerAdapter {
return new ApplicationSecurity();
}
public static void main(String[] args) throws Exception {
new SpringApplicationBuilder(SampleWebSecureCustomApplication.class).run(args);
}
@Order(SecurityProperties.ACCESS_OVERRIDE_ORDER)
protected static class ApplicationSecurity extends WebSecurityConfigurerAdapter {

View File

@ -38,6 +38,7 @@ import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import sample.web.secure.custom.SampleWebSecureCustomApplication;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.ui.github;
package sample.web.secure.github;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.ui.github;
package sample.web.secure.github;
import org.junit.Before;
import org.junit.Test;
@ -30,6 +30,7 @@ import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.web.context.WebApplicationContext;
import sample.web.secure.github.SampleGithubSecureApplication;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.redirectedUrlPattern;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.ui.secure;
package sample.web.secure.jdbc;
import java.util.Date;
import java.util.Map;
@ -54,10 +54,6 @@ public class SampleWebSecureCustomApplication extends WebMvcConfigurerAdapter {
throw new RuntimeException("Expected exception in controller");
}
public static void main(String[] args) throws Exception {
new SpringApplicationBuilder(SampleWebSecureCustomApplication.class).run(args);
}
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/login").setViewName("login");
@ -68,6 +64,10 @@ public class SampleWebSecureCustomApplication extends WebMvcConfigurerAdapter {
return new ApplicationSecurity();
}
public static void main(String[] args) throws Exception {
new SpringApplicationBuilder(SampleWebSecureCustomApplication.class).run(args);
}
@Order(SecurityProperties.ACCESS_OVERRIDE_ORDER)
protected static class ApplicationSecurity extends WebSecurityConfigurerAdapter {

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.ui.secure;
package sample.web.secure.jdbc;
import java.util.Arrays;
import java.util.regex.Matcher;
@ -38,6 +38,7 @@ import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import sample.web.secure.jdbc.SampleWebSecureCustomApplication;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.ui.secure;
package sample.web.secure;
import java.util.Date;
import java.util.Map;
@ -52,15 +52,15 @@ public class SampleWebSecureApplication extends WebMvcConfigurerAdapter {
throw new RuntimeException("Expected exception in controller");
}
public static void main(String[] args) throws Exception {
new SpringApplicationBuilder(SampleWebSecureApplication.class).run(args);
}
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/login").setViewName("login");
}
public static void main(String[] args) throws Exception {
new SpringApplicationBuilder(SampleWebSecureApplication.class).run(args);
}
@Configuration
@Order(SecurityProperties.ACCESS_OVERRIDE_ORDER)
protected static class ApplicationSecurity extends WebSecurityConfigurerAdapter {

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.ui.secure;
package sample.web.secure;
import java.util.Arrays;
import java.util.regex.Matcher;
@ -38,6 +38,7 @@ import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import sample.web.secure.SampleWebSecureApplication;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package sample.ui;
package sample.web.staticcontent;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@ -24,13 +24,13 @@ import org.springframework.boot.context.web.SpringBootServletInitializer;
@SpringBootApplication
public class SampleWebStaticApplication extends SpringBootServletInitializer {
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleWebStaticApplication.class, args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(SampleWebStaticApplication.class);
}
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleWebStaticApplication.class, args);
}
}

Some files were not shown because too many files have changed in this diff Show More