Friday, July 13, 2018

jboss_official_doc_note

https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/6.4/html/administration_and_configuration_guide/sect-start_and_stop_jboss_eap_6
1.  Start JBoss as a Standalone Server
EAP_HOME\bin\standalone.bat
    To list all available parameters for the start-up scripts, use the -h parameter:
EAP-6.4.0\bin>standalone.bat -h
    Run multiple instances of JBoss EAP standalone servers on a single machine:
Create a copy of the EAP_HOME/standalone/ directory directly under EAP_HOME
Start each JBoss EAP standalone instance by specifying node name, IP, port offset...
If you would like to manage two nodes at once or two nodes that have the same configuration,
you are recommended to run them in a managed domain instead of running a standalone server.
Using an Alternate Configuration file for a Standalone Server in Microsoft Windows Server
C:\EAP_HOME\bin> standalone.bat --server-config=standalone-alternate.xml
2.  Stop JBoss
Stop an instance which was started interactively from a command prompt.
Press Ctrl-C in the terminal where JBoss EAP 6 is running.
3.  Configuration files
EAP_HOME/bin/standalone.sh -c standalone-full-ha.xml
Backup:
EAP_HOME/standalone/configuration/
Descriptor-based Property Replacement:
Java EE descriptor replacement is disabled by default. When enabled, descriptors can be replaced
in the following configuration files: ejb-jar.xml and persistence.xml.
<subsystem xmlns="urn:jboss:domain:ee:1.2">
  <spec-descriptor-property-replacement>
true
  </spec-descriptor-property-replacement>
  <jboss-descriptor-property-replacement>
true
  </jboss-descriptor-property-replacement>
</subsystem>

spring_note

https://docs.spring.io/spring/docs/4.3.8.RELEASE/spring-framework-reference/html/overview.html

1. BOM to resolve the version conflict
You can import the spring-framework-bom in your dependencyManagement section to ensure that all spring dependencies (both direct and transitive) are at the same version.
An added benefit of using the BOM is that you no longer need to specify the <version> attribute when depending on Spring Framework artifacts.
Artifacts specified in the <dependencies> section will ALWAYS be included as a dependency of the child module(s).
Artifacts specified in the <dependencyManagement> section, will only be included in the child module if they were also specified in the <dependencies> section of the child module itself.

2. Instantiation with a static factory method
<bean id="clientService"
    class="examples.ClientService"
    factory-method="createInstance"/>

Spring in Action 4th Edition

Spring in Action 4th Edition

1. The act of creating associations between application components is commonly
referred to as wiring. In Spring, there are many ways to wire components together, but
a common approach has always been via XML.
2. In a Spring application, an application context loads bean definitions and wires them
together. The Spring application context is fully responsible for the creation of and
wiring of the objects that make up the application.
For XML based, ClassPathXmlApplicationContext
For Java-based configurations, Spring offers AnnotationConfigApplicationContext.
3.
Spring attacks automatic wiring from two angles:
a. Component scanning—Spring automatically discovers beans to be created in the
application context.
b. Autowiring—Spring automatically satisfies bean dependencies.
4.
@Component. This simple annotation identifies this class as a component class and
serves as a clue to Spring that a bean should be created for the class.
With no further configuration, @ComponentScan will default to scanning the same
package as the configuration class. Therefore, because CDPlayerConfig is in the
soundsystem package, Spring will scan that package and any subpackages underneath
it, looking for classes that are annotated with @Component. It should find the Compact-
Disc class and automatically create a bean for it in Spring.

@Configuration
@ComponentScan(basePackageClasses={CDPlayer.class, DVDPlayer.class})
public class CDPlayerConfig {}

With a
marker interface, you can still have a refactor-friendly reference to an interface, but
without references to any actual application code

Put succinctly, autowiring is a means of letting Spring automatically satisfy a bean’s
dependencies by finding other beans in the application context that are a match to
the bean’s needs. To indicate that autowiring should be performed, you can use
Spring’s @Autowired annotation.

The @Autowired annotation’s use isn’t limited to constructors. It can also be used on a
property’s setter method.

Actually, there’s nothing special about setter methods. @Autowired can also be
applied on any method on the class.

When required is false, Spring will attempt to perform autowiring; but if there are no
matching beans, it will leave the bean unwired. You should be careful setting required
to false, however. Leaving the property unwired could lead to NullPointer-
Exceptions if you don’t check for null in your code.
The key to creating a JavaConfig class is to annotate it with @Configuration.

5.
By default, all beans in Spring are singletons

Sunday, July 8, 2018

JBoss local environment setup

JBoss local environment setup
1. Download and install jboss-eap-6.4.0-installer.jar
2. Update standalone.conf.bat, add the below
set "JAVA_OPTS=%JAVA_OPTS%  -Djboss.server.default.config=standalone-full-ha.xml"
3. Verify through http://localhost:8080
4. Stop JBoss, retrieve /opt/jboss/security, standalone-full-ha.xml and CCAuthorizationRealTimeMDB.ear, modules/com to local
Copy the files to your JBoss directory
Update standalone-full-ha.xml, all the items with linux folder /opt/jboss/security
Update urn:jboss:domain:1.8 to urn:jboss:domain:1.7
APPLICATION_LOG_ROOT to C:/Apps/EAP-6.4.0-CC/fromDev/DDR_1000/
5. Check log: C:\Apps\EAP-6.4.0-CC\standalone\log\server.log
   Check log: C:/Apps/EAP-6.4.0-CC/fromDev/DDR_1000/server.log
   Verify MQExplorer that the listener is up