|
1 | | -package org.woehlke.simpleworklist.config; |
2 | | - |
3 | | -import org.springframework.boot.context.properties.ConfigurationProperties; |
4 | | -import org.springframework.stereotype.Component; |
5 | | -import org.springframework.validation.annotation.Validated; |
6 | | - |
7 | | -import javax.validation.Valid; |
8 | | -import javax.validation.constraints.NotNull; |
9 | | - |
10 | | -@Component |
11 | | -@Validated |
12 | | -@ConfigurationProperties(prefix="org.woehlke.simpleworklist") |
13 | | -public class ApplicationProperties { |
14 | | - |
15 | | - @Valid |
16 | | - private Mail mail = new Mail(); |
17 | | - |
18 | | - @Valid |
19 | | - private Mvc mvc = new Mvc(); |
20 | | - |
21 | | - @Valid |
22 | | - private Registration registration = new Registration(); |
23 | | - |
24 | | - @Valid |
25 | | - private User user = new User(); |
26 | | - |
27 | | - @Validated |
28 | | - public static class Mail { |
29 | | - |
30 | | - @NotNull |
31 | | - private String host; |
32 | | - |
33 | | - @NotNull |
34 | | - private Integer port; |
35 | | - |
36 | | - @NotNull |
37 | | - private String username; |
38 | | - |
39 | | - @NotNull |
40 | | - private String password; |
41 | | - |
42 | | - @Valid |
43 | | - private Smtp smtp = new Smtp(); |
44 | | - |
45 | | - public static class Smtp { |
46 | | - |
47 | | - @NotNull |
48 | | - private Boolean auth; |
49 | | - |
50 | | - @NotNull |
51 | | - private Boolean sslEnable; |
52 | | - |
53 | | - @NotNull |
54 | | - private String socketFactoryPort; |
55 | | - |
56 | | - @NotNull |
57 | | - private String socketFactoryClass; |
58 | | - |
59 | | - public Boolean getAuth() { |
60 | | - return auth; |
61 | | - } |
62 | | - |
63 | | - public void setAuth(Boolean auth) { |
64 | | - this.auth = auth; |
65 | | - } |
66 | | - |
67 | | - public Boolean getSslEnable() { |
68 | | - return sslEnable; |
69 | | - } |
70 | | - |
71 | | - public void setSslEnable(Boolean sslEnable) { |
72 | | - this.sslEnable = sslEnable; |
73 | | - } |
74 | | - |
75 | | - public String getSocketFactoryPort() { |
76 | | - return socketFactoryPort; |
77 | | - } |
78 | | - |
79 | | - public void setSocketFactoryPort(String socketFactoryPort) { |
80 | | - this.socketFactoryPort = socketFactoryPort; |
81 | | - } |
82 | | - |
83 | | - public String getSocketFactoryClass() { |
84 | | - return socketFactoryClass; |
85 | | - } |
86 | | - |
87 | | - public void setSocketFactoryClass(String socketFactoryClass) { |
88 | | - this.socketFactoryClass = socketFactoryClass; |
89 | | - } |
90 | | - } |
91 | | - |
92 | | - public String getHost() { |
93 | | - return host; |
94 | | - } |
95 | | - |
96 | | - public void setHost(String host) { |
97 | | - this.host = host; |
98 | | - } |
99 | | - |
100 | | - public Integer getPort() { |
101 | | - return port; |
102 | | - } |
103 | | - |
104 | | - public void setPort(Integer port) { |
105 | | - this.port = port; |
106 | | - } |
107 | | - |
108 | | - public String getUsername() { |
109 | | - return username; |
110 | | - } |
111 | | - |
112 | | - public void setUsername(String username) { |
113 | | - this.username = username; |
114 | | - } |
115 | | - |
116 | | - public String getPassword() { |
117 | | - return password; |
118 | | - } |
119 | | - |
120 | | - public void setPassword(String password) { |
121 | | - this.password = password; |
122 | | - } |
123 | | - |
124 | | - public Smtp getSmtp() { |
125 | | - return smtp; |
126 | | - } |
127 | | - |
128 | | - public void setSmtp(Smtp smtp) { |
129 | | - this.smtp = smtp; |
130 | | - } |
131 | | - } |
132 | | - |
133 | | - @Validated |
134 | | - public static class Registration { |
135 | | - |
136 | | - @NotNull |
137 | | - private Integer maxRetries; |
138 | | - |
139 | | - @NotNull |
140 | | - private Long ttlEmailVerificationRequest; |
141 | | - |
142 | | - @NotNull |
143 | | - private String urlHost; |
144 | | - |
145 | | - @NotNull |
146 | | - private String mailFrom; |
147 | | - |
148 | | - public Integer getMaxRetries() { |
149 | | - return maxRetries; |
150 | | - } |
151 | | - |
152 | | - public void setMaxRetries(Integer maxRetries) { |
153 | | - this.maxRetries = maxRetries; |
154 | | - } |
155 | | - |
156 | | - public Long getTtlEmailVerificationRequest() { |
157 | | - return ttlEmailVerificationRequest; |
158 | | - } |
159 | | - |
160 | | - public void setTtlEmailVerificationRequest(Long ttlEmailVerificationRequest) { |
161 | | - this.ttlEmailVerificationRequest = ttlEmailVerificationRequest; |
162 | | - } |
163 | | - |
164 | | - public String getUrlHost() { |
165 | | - return urlHost; |
166 | | - } |
167 | | - |
168 | | - public void setUrlHost(String urlHost) { |
169 | | - this.urlHost = urlHost; |
170 | | - } |
171 | | - |
172 | | - public String getMailFrom() { |
173 | | - return mailFrom; |
174 | | - } |
175 | | - |
176 | | - public void setMailFrom(String mailFrom) { |
177 | | - this.mailFrom = mailFrom; |
178 | | - } |
179 | | - } |
180 | | - |
181 | | - @Validated |
182 | | - public static class Mvc { |
183 | | - |
184 | | - @NotNull |
185 | | - private Integer controllerPageSize; |
186 | | - |
187 | | - public Integer getControllerPageSize() { |
188 | | - return controllerPageSize; |
189 | | - } |
190 | | - |
191 | | - public void setControllerPageSize(Integer controllerPageSize) { |
192 | | - this.controllerPageSize = controllerPageSize; |
193 | | - } |
194 | | - } |
195 | | - |
196 | | - @Validated |
197 | | - public static class User { |
198 | | - |
199 | | - @NotNull |
200 | | - private Integer strengthBCryptPasswordEncoder; |
201 | | - |
202 | | - public Integer getStrengthBCryptPasswordEncoder() { |
203 | | - return strengthBCryptPasswordEncoder; |
204 | | - } |
205 | | - |
206 | | - public void setStrengthBCryptPasswordEncoder(Integer strengthBCryptPasswordEncoder) { |
207 | | - this.strengthBCryptPasswordEncoder = strengthBCryptPasswordEncoder; |
208 | | - } |
209 | | - } |
210 | | - |
211 | | - public Mail getMail() { |
212 | | - return mail; |
213 | | - } |
214 | | - |
215 | | - public void setMail(Mail mail) { |
216 | | - this.mail = mail; |
217 | | - } |
218 | | - |
219 | | - public Mvc getMvc() { |
220 | | - return mvc; |
221 | | - } |
222 | | - |
223 | | - public void setMvc(Mvc mvc) { |
224 | | - this.mvc = mvc; |
225 | | - } |
226 | | - |
227 | | - public Registration getRegistration() { |
228 | | - return registration; |
229 | | - } |
230 | | - |
231 | | - public void setRegistration(Registration registration) { |
232 | | - this.registration = registration; |
233 | | - } |
234 | | - |
235 | | - public User getUser() { |
236 | | - return user; |
237 | | - } |
238 | | - |
239 | | - public void setUser(User user) { |
240 | | - this.user = user; |
241 | | - } |
242 | | -} |
| 1 | +package org.woehlke.simpleworklist.config; |
| 2 | + |
| 3 | +import lombok.Getter; |
| 4 | +import lombok.Setter; |
| 5 | +import org.springframework.boot.context.properties.ConfigurationProperties; |
| 6 | +import org.springframework.stereotype.Component; |
| 7 | +import org.springframework.validation.annotation.Validated; |
| 8 | + |
| 9 | +import javax.validation.Valid; |
| 10 | +import javax.validation.constraints.NotEmpty; |
| 11 | +import javax.validation.constraints.NotNull; |
| 12 | + |
| 13 | +@Component |
| 14 | +@Validated |
| 15 | +@Getter |
| 16 | +@Setter |
| 17 | +@ConfigurationProperties(prefix="org.woehlke.simpleworklist") |
| 18 | +public class ApplicationProperties { |
| 19 | + |
| 20 | + @Valid |
| 21 | + private Mail mail = new Mail(); |
| 22 | + |
| 23 | + @Valid |
| 24 | + private WebMvc webMvc = new WebMvc(); |
| 25 | + |
| 26 | + @Valid |
| 27 | + private WebSecurity webSecurity = new WebSecurity(); |
| 28 | + |
| 29 | + @Valid |
| 30 | + private Registration registration = new Registration(); |
| 31 | + |
| 32 | + @Getter |
| 33 | + @Setter |
| 34 | + @Validated |
| 35 | + public static class Mail { |
| 36 | + |
| 37 | + @NotNull |
| 38 | + private String host; |
| 39 | + |
| 40 | + @NotNull |
| 41 | + private Integer port; |
| 42 | + |
| 43 | + @NotNull |
| 44 | + private String username; |
| 45 | + |
| 46 | + @NotNull |
| 47 | + private String password; |
| 48 | + |
| 49 | + @NotNull |
| 50 | + private Boolean auth; |
| 51 | + |
| 52 | + @NotNull |
| 53 | + private Boolean sslEnable; |
| 54 | + |
| 55 | + @NotNull |
| 56 | + private String socketFactoryPort; |
| 57 | + |
| 58 | + @NotNull |
| 59 | + private String socketFactoryClass; |
| 60 | + } |
| 61 | + |
| 62 | + @Getter |
| 63 | + @Setter |
| 64 | + @Validated |
| 65 | + public static class Registration { |
| 66 | + |
| 67 | + @NotNull |
| 68 | + private Integer maxRetries; |
| 69 | + |
| 70 | + @NotNull |
| 71 | + private Long ttlEmailVerificationRequest; |
| 72 | + |
| 73 | + @NotNull |
| 74 | + private String urlHost; |
| 75 | + |
| 76 | + @NotNull |
| 77 | + private String mailFrom; |
| 78 | + } |
| 79 | + |
| 80 | + @Getter |
| 81 | + @Setter |
| 82 | + @Validated |
| 83 | + public static class WebMvc { |
| 84 | + |
| 85 | + @NotNull |
| 86 | + private Integer controllerPageSize; |
| 87 | + } |
| 88 | + |
| 89 | + @Getter |
| 90 | + @Setter |
| 91 | + @Validated |
| 92 | + public static class WebSecurity { |
| 93 | + |
| 94 | + @NotNull |
| 95 | + private String loginProcessingUrl; |
| 96 | + |
| 97 | + @NotNull |
| 98 | + private String logoutUrl; |
| 99 | + |
| 100 | + @NotNull |
| 101 | + private String[] cookieNamesToClear; |
| 102 | + |
| 103 | + @NotNull |
| 104 | + private Boolean invalidateHttpSession; |
| 105 | + |
| 106 | + @NotNull |
| 107 | + private String defaultSuccessUrl; |
| 108 | + |
| 109 | + @NotNull |
| 110 | + private String failureForwardUrl; |
| 111 | + |
| 112 | + @NotNull |
| 113 | + private String usernameParameter; |
| 114 | + |
| 115 | + @NotNull |
| 116 | + private String passwordParameter; |
| 117 | + |
| 118 | + @NotNull |
| 119 | + private String loginPage; |
| 120 | + |
| 121 | + @NotNull |
| 122 | + private String[] antPatternsPublic; |
| 123 | + |
| 124 | + @NotNull |
| 125 | + private Integer strengthBCryptPasswordEncoder; |
| 126 | + } |
| 127 | + |
| 128 | +} |
0 commit comments