Skip to content

Commit dc8813a

Browse files
committed
cleanup work and lesson 4 initial code
1 parent 74175bf commit dc8813a

216 files changed

Lines changed: 11235 additions & 8 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType">
3+
<booleanAttribute key="M2_DEBUG_OUTPUT" value="false"/>
4+
<stringAttribute key="M2_GOALS" value="cargo:run"/>
5+
<booleanAttribute key="M2_NON_RECURSIVE" value="false"/>
6+
<booleanAttribute key="M2_OFFLINE" value="false"/>
7+
<stringAttribute key="M2_PROFILES" value=""/>
8+
<listAttribute key="M2_PROPERTIES"/>
9+
<stringAttribute key="M2_RUNTIME" value="EMBEDDED"/>
10+
<booleanAttribute key="M2_SKIP_TESTS" value="true"/>
11+
<intAttribute key="M2_THREADS" value="1"/>
12+
<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/>
13+
<stringAttribute key="M2_USER_SETTINGS" value=""/>
14+
<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="false"/>
15+
<stringAttribute key="org.eclipse.debug.core.source_locator_id" value="org.eclipse.m2e.launching.MavenSourceLocator"/>
16+
<stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;sourceLookupDirector&gt;&#10;&lt;sourceContainers duplicates=&quot;true&quot;&gt;&#10;&lt;container memento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#10;&amp;lt;default/&amp;gt;&amp;#10;&quot; typeId=&quot;org.eclipse.debug.core.containerType.default&quot;/&gt;&#10;&lt;/sourceContainers&gt;&#10;&lt;/sourceLookupDirector&gt;&#10;"/>
17+
<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
18+
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;runtimeClasspathEntry containerPath=&quot;org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/java-6-sun-1.6.0.33&quot; path=&quot;1&quot; type=&quot;4&quot;/&gt;&#10;"/>
19+
</listAttribute>
20+
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
21+
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${project_loc}"/>
22+
</launchConfiguration>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType">
3+
<booleanAttribute key="M2_DEBUG_OUTPUT" value="false"/>
4+
<stringAttribute key="M2_GOALS" value="clean install"/>
5+
<booleanAttribute key="M2_NON_RECURSIVE" value="false"/>
6+
<booleanAttribute key="M2_OFFLINE" value="false"/>
7+
<stringAttribute key="M2_PROFILES" value=""/>
8+
<listAttribute key="M2_PROPERTIES"/>
9+
<stringAttribute key="M2_RUNTIME" value="EMBEDDED"/>
10+
<booleanAttribute key="M2_SKIP_TESTS" value="false"/>
11+
<intAttribute key="M2_THREADS" value="1"/>
12+
<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/>
13+
<stringAttribute key="M2_USER_SETTINGS" value=""/>
14+
<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="false"/>
15+
<stringAttribute key="org.eclipse.debug.core.source_locator_id" value="org.eclipse.m2e.launching.MavenSourceLocator"/>
16+
<stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;sourceLookupDirector&gt;&#10;&lt;sourceContainers duplicates=&quot;true&quot;&gt;&#10;&lt;container memento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#10;&amp;lt;default/&amp;gt;&amp;#10;&quot; typeId=&quot;org.eclipse.debug.core.containerType.default&quot;/&gt;&#10;&lt;/sourceContainers&gt;&#10;&lt;/sourceLookupDirector&gt;&#10;"/>
17+
<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
18+
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;runtimeClasspathEntry containerPath=&quot;org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/java-6-sun-1.6.0.33&quot; path=&quot;1&quot; type=&quot;4&quot;/&gt;&#10;"/>
19+
</listAttribute>
20+
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
21+
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${project_loc}"/>
22+
</launchConfiguration>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType">
3+
<booleanAttribute key="M2_DEBUG_OUTPUT" value="false"/>
4+
<stringAttribute key="M2_GOALS" value="clean install"/>
5+
<booleanAttribute key="M2_NON_RECURSIVE" value="false"/>
6+
<booleanAttribute key="M2_OFFLINE" value="false"/>
7+
<stringAttribute key="M2_PROFILES" value="live"/>
8+
<listAttribute key="M2_PROPERTIES"/>
9+
<stringAttribute key="M2_RUNTIME" value="EMBEDDED"/>
10+
<booleanAttribute key="M2_SKIP_TESTS" value="false"/>
11+
<intAttribute key="M2_THREADS" value="1"/>
12+
<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/>
13+
<stringAttribute key="M2_USER_SETTINGS" value=""/>
14+
<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="false"/>
15+
<stringAttribute key="org.eclipse.debug.core.source_locator_id" value="org.eclipse.m2e.launching.MavenSourceLocator"/>
16+
<stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;sourceLookupDirector&gt;&#10;&lt;sourceContainers duplicates=&quot;true&quot;&gt;&#10;&lt;container memento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#10;&amp;lt;default/&amp;gt;&amp;#10;&quot; typeId=&quot;org.eclipse.debug.core.containerType.default&quot;/&gt;&#10;&lt;/sourceContainers&gt;&#10;&lt;/sourceLookupDirector&gt;&#10;"/>
17+
<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
18+
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;runtimeClasspathEntry containerPath=&quot;org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/java-6-sun-1.6.0.33&quot; path=&quot;1&quot; type=&quot;4&quot;/&gt;&#10;"/>
19+
</listAttribute>
20+
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
21+
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${project_loc}"/>
22+
</launchConfiguration>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType">
3+
<booleanAttribute key="M2_DEBUG_OUTPUT" value="false"/>
4+
<stringAttribute key="M2_GOALS" value="clean install"/>
5+
<booleanAttribute key="M2_NON_RECURSIVE" value="false"/>
6+
<booleanAttribute key="M2_OFFLINE" value="false"/>
7+
<stringAttribute key="M2_PROFILES" value="integration"/>
8+
<listAttribute key="M2_PROPERTIES"/>
9+
<stringAttribute key="M2_RUNTIME" value="EMBEDDED"/>
10+
<booleanAttribute key="M2_SKIP_TESTS" value="false"/>
11+
<intAttribute key="M2_THREADS" value="1"/>
12+
<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/>
13+
<stringAttribute key="M2_USER_SETTINGS" value=""/>
14+
<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="false"/>
15+
<stringAttribute key="org.eclipse.debug.core.source_locator_id" value="org.eclipse.m2e.launching.MavenSourceLocator"/>
16+
<stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;sourceLookupDirector&gt;&#10;&lt;sourceContainers duplicates=&quot;true&quot;&gt;&#10;&lt;container memento=&quot;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot; standalone=&amp;quot;no&amp;quot;?&amp;gt;&amp;#10;&amp;lt;default/&amp;gt;&amp;#10;&quot; typeId=&quot;org.eclipse.debug.core.containerType.default&quot;/&gt;&#10;&lt;/sourceContainers&gt;&#10;&lt;/sourceLookupDirector&gt;&#10;"/>
17+
<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
18+
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;runtimeClasspathEntry containerPath=&quot;org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/java-6-sun-1.6.0.33&quot; path=&quot;1&quot; type=&quot;4&quot;/&gt;&#10;"/>
19+
</listAttribute>
20+
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
21+
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${project_loc}"/>
22+
</launchConfiguration>

‎m10-lesson4-start/common/pom.xml‎

Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<modelVersion>4.0.0</modelVersion>
3+
<name>common</name>
4+
5+
<artifactId>common-m10-l4-start</artifactId>
6+
7+
<parent>
8+
<groupId>com.baeldung.m10</groupId>
9+
<artifactId>user-management-parent-m10-l4-start</artifactId>
10+
<version>1.1.0-SNAPSHOT</version>
11+
</parent>
12+
13+
<dependencies>
14+
15+
<!-- util -->
16+
17+
<dependency>
18+
<groupId>com.google.guava</groupId>
19+
<artifactId>guava</artifactId>
20+
<version>${guava.version}</version>
21+
</dependency>
22+
23+
<dependency>
24+
<groupId>org.apache.commons</groupId>
25+
<artifactId>commons-lang3</artifactId>
26+
<version>${commons-lang3.version}</version>
27+
</dependency>
28+
29+
<dependency>
30+
<groupId>org.apache.httpcomponents</groupId>
31+
<artifactId>httpcore</artifactId>
32+
<exclusions>
33+
<exclusion>
34+
<artifactId>commons-logging</artifactId>
35+
<groupId>commons-logging</groupId>
36+
</exclusion>
37+
</exclusions>
38+
</dependency>
39+
40+
<dependency>
41+
<groupId>commons-codec</groupId>
42+
<artifactId>commons-codec</artifactId>
43+
</dependency>
44+
45+
<!-- spring -->
46+
47+
<dependency>
48+
<groupId>org.springframework</groupId>
49+
<artifactId>spring-webmvc</artifactId>
50+
<exclusions>
51+
<exclusion>
52+
<artifactId>commons-logging</artifactId>
53+
<groupId>commons-logging</groupId>
54+
</exclusion>
55+
</exclusions>
56+
</dependency>
57+
58+
<!-- web -->
59+
60+
<dependency>
61+
<groupId>org.apache.tomcat</groupId>
62+
<artifactId>tomcat-servlet-api</artifactId>
63+
<version>${tomcat.version}</version>
64+
<scope>provided</scope>
65+
</dependency>
66+
67+
<!-- security -->
68+
69+
<dependency>
70+
<groupId>org.springframework.security</groupId>
71+
<artifactId>spring-security-core</artifactId>
72+
</dependency>
73+
74+
<!-- validation -->
75+
76+
<dependency>
77+
<groupId>javax.validation</groupId>
78+
<artifactId>validation-api</artifactId>
79+
<version>${validation-api.version}</version>
80+
</dependency>
81+
<dependency>
82+
<groupId>org.hibernate</groupId>
83+
<artifactId>hibernate-validator</artifactId>
84+
</dependency>
85+
86+
87+
<!-- marshalling -->
88+
89+
<dependency>
90+
<groupId>com.fasterxml.jackson.core</groupId>
91+
<artifactId>jackson-databind</artifactId>
92+
</dependency>
93+
94+
<!-- persistence -->
95+
96+
<dependency>
97+
<groupId>org.springframework</groupId>
98+
<artifactId>spring-jdbc</artifactId>
99+
</dependency>
100+
<dependency>
101+
<groupId>org.springframework</groupId>
102+
<artifactId>spring-orm</artifactId>
103+
</dependency>
104+
<dependency>
105+
<groupId>org.springframework.data</groupId>
106+
<artifactId>spring-data-jpa</artifactId>
107+
</dependency>
108+
109+
<dependency>
110+
<groupId>org.hibernate</groupId>
111+
<artifactId>hibernate-entitymanager</artifactId>
112+
</dependency>
113+
<dependency>
114+
<groupId>org.hibernate</groupId>
115+
<artifactId>hibernate-core</artifactId>
116+
</dependency>
117+
118+
<!-- proxying -->
119+
120+
<dependency>
121+
<groupId>org.aspectj</groupId>
122+
<artifactId>aspectjweaver</artifactId>
123+
<scope>runtime</scope>
124+
</dependency>
125+
126+
<!-- persistence - providers -->
127+
128+
<dependency>
129+
<groupId>com.h2database</groupId>
130+
<artifactId>h2</artifactId>
131+
</dependency>
132+
133+
<dependency>
134+
<groupId>mysql</groupId>
135+
<artifactId>mysql-connector-java</artifactId>
136+
<scope>runtime</scope>
137+
</dependency>
138+
139+
<dependency>
140+
<groupId>org.hsqldb</groupId>
141+
<artifactId>hsqldb</artifactId>
142+
</dependency>
143+
144+
<!-- persistence - JPA 2 metamodel -->
145+
146+
<dependency>
147+
<groupId>org.hibernate</groupId>
148+
<artifactId>hibernate-jpamodelgen</artifactId>
149+
</dependency>
150+
151+
<!-- logging -->
152+
153+
<dependency>
154+
<groupId>org.slf4j</groupId>
155+
<artifactId>slf4j-api</artifactId>
156+
</dependency>
157+
<dependency>
158+
<groupId>ch.qos.logback</groupId>
159+
<artifactId>logback-classic</artifactId>
160+
<!-- <scope>runtime</scope> -->
161+
</dependency>
162+
<dependency>
163+
<groupId>org.slf4j</groupId>
164+
<artifactId>jcl-over-slf4j</artifactId>
165+
</dependency>
166+
<dependency> <!-- needed to bridge to slf4j for projects that use the log4j APIs directly -->
167+
<groupId>org.slf4j</groupId>
168+
<artifactId>log4j-over-slf4j</artifactId>
169+
</dependency>
170+
171+
<!-- test scoped -->
172+
173+
<dependency>
174+
<groupId>junit</groupId>
175+
<artifactId>junit</artifactId>
176+
<scope>test</scope>
177+
</dependency>
178+
179+
<dependency>
180+
<groupId>org.hamcrest</groupId>
181+
<artifactId>hamcrest-core</artifactId>
182+
<scope>test</scope>
183+
</dependency>
184+
<dependency>
185+
<groupId>org.hamcrest</groupId>
186+
<artifactId>hamcrest-library</artifactId>
187+
<scope>test</scope>
188+
</dependency>
189+
190+
191+
<dependency>
192+
<groupId>com.jayway.restassured</groupId>
193+
<artifactId>rest-assured</artifactId>
194+
<version>${rest-assured.version}</version>
195+
<scope>test</scope>
196+
<exclusions>
197+
<exclusion>
198+
<artifactId>commons-logging</artifactId>
199+
<groupId>commons-logging</groupId>
200+
</exclusion>
201+
</exclusions>
202+
</dependency>
203+
204+
</dependencies>
205+
206+
<build>
207+
<resources>
208+
<resource>
209+
<directory>src/main/resources</directory>
210+
<filtering>true</filtering>
211+
</resource>
212+
</resources>
213+
214+
</build>
215+
216+
</project>
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package com.baeldung.common.client;
2+
3+
import org.springframework.beans.factory.InitializingBean;
4+
import org.springframework.beans.factory.annotation.Autowired;
5+
import org.springframework.beans.factory.annotation.Value;
6+
import org.springframework.context.annotation.Profile;
7+
import org.springframework.core.env.Environment;
8+
import org.springframework.stereotype.Component;
9+
10+
import com.google.common.base.Preconditions;
11+
12+
@Component
13+
@Profile("client")
14+
public final class CommonPaths implements InitializingBean {
15+
16+
@Autowired
17+
private Environment env;
18+
19+
@Value("${http.protocol}")
20+
private String protocol;
21+
@Value("${http.host}")
22+
private String host;
23+
@Value("${http.port}")
24+
private String port;
25+
26+
public CommonPaths() {
27+
super();
28+
}
29+
30+
// API
31+
32+
public final String getServerRoot() {
33+
if (port.equals("80")) {
34+
return protocol + "://" + host;
35+
}
36+
return protocol + "://" + host + ":" + port;
37+
}
38+
39+
//
40+
41+
@Override
42+
public void afterPropertiesSet() {
43+
if (protocol == null || protocol.equals("${http.protocol}")) {
44+
protocol = Preconditions.checkNotNull(env.getProperty("http.protocol"));
45+
}
46+
if (host == null || host.equals("${http.host}")) {
47+
host = Preconditions.checkNotNull(env.getProperty("http.host"));
48+
}
49+
if (port == null || port.equals("${http.port}")) {
50+
port = Preconditions.checkNotNull(env.getProperty("http.port"));
51+
}
52+
}
53+
54+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.baeldung.common.interfaces;
2+
3+
public interface IByNameApi<T extends IWithName> {
4+
5+
T findByName(final String name);
6+
7+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.baeldung.common.interfaces;
2+
3+
import java.io.Serializable;
4+
5+
public interface IDto extends IWithLongId, Serializable {
6+
7+
//
8+
9+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.baeldung.common.interfaces;
2+
3+
public interface INameableDto extends IDto, IWithName {
4+
5+
//
6+
7+
}

0 commit comments

Comments
 (0)