<profiles>
<profile>
<id>qa</id>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
public class HostFilter implements Filter {
@Override
public void init(FilterConfig filterConfig) throws ServletException {
}
@Override
public void destroy() {
}
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletRequest httpServletRequest = (HttpServletRequest) request;
HttpServletResponse httpServletResponse = (HttpServletResponse) response;
String host = httpServletRequest.getHeader("Host");
if ("domain1.com".equalsIgnoreCase(host)) {
httpServletResponse.sendRedirect("https://domain2.com" + httpServletRequest.getRequestURI() + "?" + httpServletRequest.getQueryString());
return;
}
chain.doFilter(request, response);
}
}
class User {
int id;
String name;
List<Comment> comments;
// get/set-методы
}
class Comment {
int id;
String content;
User user;
// get/set-методы
}
comment.getUser().getName();
user.getComments().size();
@Column(nullable = false)
private Long aId;
@ManyToOne
@JoinColumn(name = "a_id", nullable = false, insertable = false, updatable = false)
private AEntity a;