Skip to content

Instantly share code, notes, and snippets.

@krisskross
Created May 18, 2012 17:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krisskross/2726488 to your computer and use it in GitHub Desktop.
Save krisskross/2726488 to your computer and use it in GitHub Desktop.
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
@Configuration
public class MysqlXADataSource {
@Property(desc = "User name to use for connection authentication.")
@Size(min = 6, max = 255)
private String user = ""; // default value - hence optional property
@Property(desc = "Password to use for connection authentication.")
@Size(min = 6, max = 255)
private String password = ""; // default value - hence optional property
@Property(desc = "A JDBC URL.")
@Pattern(regexp = "([a-zA-Z]{3,})://([\w-]+\.)+[\w-]+(/[\w- ./?*)?")
private URL url; // required property
@Property(desc = "Port number where a server is listening for requests.")
@Min(0)
@Max(65535)
private Integer portNumber = 1521; // default value - hence optional property
@Resource
private List<ConfigurableItem> items; // configuration childs
}
@Stateless
public class SessionBean {
@Resource(name = "jdbc/mysql-ds")
private DataSource ds;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment