001/* 002 * Copyright 2012-2018 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.boot.autoconfigure.h2; 018 019import org.springframework.boot.context.properties.ConfigurationProperties; 020import org.springframework.util.Assert; 021 022/** 023 * Configuration properties for H2's console. 024 * 025 * @author Andy Wilkinson 026 * @author Marten Deinum 027 * @author Stephane Nicoll 028 * @since 1.3.0 029 */ 030@ConfigurationProperties(prefix = "spring.h2.console") 031public class H2ConsoleProperties { 032 033 /** 034 * Path at which the console is available. 035 */ 036 private String path = "/h2-console"; 037 038 /** 039 * Whether to enable the console. 040 */ 041 private boolean enabled = false; 042 043 private final Settings settings = new Settings(); 044 045 public String getPath() { 046 return this.path; 047 } 048 049 public void setPath(String path) { 050 Assert.notNull(path, "Path must not be null"); 051 Assert.isTrue(path.length() > 1, "Path must have length greater than 1"); 052 Assert.isTrue(path.startsWith("/"), "Path must start with '/'"); 053 this.path = path; 054 } 055 056 public boolean getEnabled() { 057 return this.enabled; 058 } 059 060 public void setEnabled(boolean enabled) { 061 this.enabled = enabled; 062 } 063 064 public Settings getSettings() { 065 return this.settings; 066 } 067 068 public static class Settings { 069 070 /** 071 * Whether to enable trace output. 072 */ 073 private boolean trace = false; 074 075 /** 076 * Whether to enable remote access. 077 */ 078 private boolean webAllowOthers = false; 079 080 public boolean isTrace() { 081 return this.trace; 082 } 083 084 public void setTrace(boolean trace) { 085 this.trace = trace; 086 } 087 088 public boolean isWebAllowOthers() { 089 return this.webAllowOthers; 090 } 091 092 public void setWebAllowOthers(boolean webAllowOthers) { 093 this.webAllowOthers = webAllowOthers; 094 } 095 096 } 097 098}